From patchwork Mon Jun 10 15:30:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Jean Texier X-Patchwork-Id: 1113146 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=koncepto.io Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=koncepto.io header.i=@koncepto.io header.b="ZqQSHdaP"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45MxyK2qRFz9sBp for ; Tue, 11 Jun 2019 01:34:33 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8949220362; Mon, 10 Jun 2019 15:34:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aP7zSxJ3taGb; Mon, 10 Jun 2019 15:34:28 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 4E57320383; Mon, 10 Jun 2019 15:34:28 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 9C2691BF399 for ; Mon, 10 Jun 2019 15:34:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 93BD58653D for ; Mon, 10 Jun 2019 15:34:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iQtEFRAwuDwr for ; Mon, 10 Jun 2019 15:34:25 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from koncepto.io (koncepto.io [195.154.119.111]) by whitealder.osuosl.org (Postfix) with ESMTPS id 3A3B286519 for ; Mon, 10 Jun 2019 15:34:25 +0000 (UTC) Received: from localhost.localdomain (lfbn-1-8938-37.w193-250.abo.wanadoo.fr [193.250.79.37]) by koncepto.io (Postfix) with ESMTPSA id 8DCA0600FE; Mon, 10 Jun 2019 17:34:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=koncepto.io; s=default; t=1560180851; bh=hIaxPmvBTCuKFi8FMYDZE2REga0QfBGis1i5M4B31LU=; h=From:To:Cc:Subject:Date:From; b=ZqQSHdaP+gFfHDqkGoOp3+OFHGszqmAFNL1rIt4Gg1N8/4P0sdf9GetjwQyODhsbA bk2phzgcM9EL0pw/0W/Msnh/0aC79l2gr2wtEB7q8pPFz/cIYpz0DJEq3Hv4EveuHC AvILJkz2NZzwPSG4hXnVyy3+Vw14S3lGuNHNVfcTJBmjL0olQ8VZkJMpB1OD7St+1I XOocmuXEiHB8htlLZ0T3HZkWb91gAc/sI0AXyc0KvPs1ou9Yz85eFUAxZjhNVE3GD1 qeV6X5mWmtmo5XZEeNGReRcJrV3f+skr5BZssfoZiYhqpWHhsTbsEz3udV4F+eOY4k wrdrxwH0WvRgg== From: Pierre-Jean Texier To: buildroot@buildroot.org Date: Mon, 10 Jun 2019 17:30:56 +0200 Message-Id: <1560180656-17519-1-git-send-email-pjtexier@koncepto.io> X-Mailer: git-send-email 2.7.4 Subject: [Buildroot] [PATCH v2 1/1] package/swupdate: bump to version 2019.04 X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pierre-Jean Texier MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" New features in this release: - Improved documentation - delta updates based on rdiff library - support for libubootenv - dry-run option - CA certificates for signed images - Fix security leak in parser This commit also: - introduce BR2_PACKAGE_LIBRSYNC - introduce BR2_PACKAGE_LIBUBOOTENV - drop upstreamed patch - backport upstream patches (important fix) Signed-off-by: Pierre-Jean Texier --- Changes v1 -> v2 - add librsync dependency (suggested by Peter Korsgaard) - add libubootenv dependency (suggested by Peter Korsgaard) - backport patches (suggested by James Hilliard) - Update the default config file (make swupdate-menuconfig / make swupdate-update-config) - test-pkg result: ./utils/test-pkg -c swu.config -p swupdate br-arm-full [1/6]: OK br-arm-cortex-a9-glibc [2/6]: OK br-arm-cortex-m4-full [3/6]: SKIPPED br-x86-64-musl [4/6]: OK br-arm-full-static [5/6]: OK sourcery-arm [6/6]: OK 6 builds, 1 skipped, 0 build failed, 0 legal-info failed .../swupdate/0001-Makefile-fix-static-build.patch | 62 --------------------- ...archive-handler-set-locale-for-libarchive.patch | 64 ++++++++++++++++++++++ ...a-fix-segfault-in-image-property-handling.patch | 41 ++++++++++++++ ...ix-script-format-when-CONFIG_UBOOT_NEWAPI.patch | 43 +++++++++++++++ package/swupdate/Config.in | 4 ++ package/swupdate/swupdate.config | 12 ++-- package/swupdate/swupdate.hash | 2 +- package/swupdate/swupdate.mk | 9 ++- 8 files changed, 167 insertions(+), 70 deletions(-) delete mode 100644 package/swupdate/0001-Makefile-fix-static-build.patch create mode 100644 package/swupdate/0001-archive-handler-set-locale-for-libarchive.patch create mode 100644 package/swupdate/0002-Lua-fix-segfault-in-image-property-handling.patch create mode 100644 package/swupdate/0003-u-boot-fix-script-format-when-CONFIG_UBOOT_NEWAPI.patch diff --git a/package/swupdate/0001-Makefile-fix-static-build.patch b/package/swupdate/0001-Makefile-fix-static-build.patch deleted file mode 100644 index 56901f9..0000000 --- a/package/swupdate/0001-Makefile-fix-static-build.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 15a324f8c67548f219256a5a75ba8123cc5bdac6 Mon Sep 17 00:00:00 2001 -From: Fabrice Fontaine -Date: Mon, 4 Mar 2019 21:51:36 +0100 -Subject: [PATCH] Makefile: fix static build - -Don't build and install lua_swupdate.so if HAVE_LUA isn't set to y -otherwise build will fail if the toolchain only suports building static -libraries - -Fixes: - - http://autobuild.buildroot.org/results/c11c4d26983e0347d96f3dda62e6d72b031967bb - -Signed-off-by: Fabrice Fontaine -[Upstream status: https://github.com/sbabic/swupdate/pull/49] ---- - Makefile | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/Makefile b/Makefile -index cfeb9a6..cac99b5 100644 ---- a/Makefile -+++ b/Makefile -@@ -369,11 +369,15 @@ tools-bins := $(patsubst $(tools-y)/%.c,$(tools-y)/%,$(wildcard $(tools-y)/*.c)) - tools-bins-unstr:= $(patsubst %,%_unstripped,$(tools-bins)) - tools-all := $(tools-objs) - -+ifeq ($(HAVE_LUA),y) -+lua_swupdate := lua_swupdate.so -+endif -+ - shared-dirs := $(shareds-y) - shared-libs := $(patsubst %,%/built-in.o, $(shareds-y)) - shared-all := $(shared-libs) - --all: swupdate ${tools-bins} lua_swupdate.so -+all: swupdate ${tools-bins} ${lua_swupdate} - - # Do modpost on a prelinked vmlinux. The finally linked vmlinux has - # relevant sections renamed as per the linker script. -@@ -434,7 +438,6 @@ install: all - install -d ${DESTDIR}/usr/bin - install -d ${DESTDIR}/usr/include - install -d ${DESTDIR}/usr/lib -- install -d ${DESTDIR}/usr/lib/lua/$(LUAVER) - install -m 755 swupdate ${DESTDIR}/usr/bin - for i in ${tools-bins};do \ - install -m 755 $$i ${DESTDIR}/usr/bin; \ -@@ -443,7 +446,10 @@ install: all - install -m 0644 include/swupdate_status.h ${DESTDIR}/usr/include - install -m 0644 include/progress_ipc.h ${DESTDIR}/usr/include - install -m 0755 ipc/lib.a ${DESTDIR}/usr/lib/libswupdate.a -- install -m 0755 lua_swupdate.so $(DESTDIR)/usr/lib/lua/$(LUAVER) -+ if [ $(HAVE_LUA) = y ]; then \ -+ install -d ${DESTDIR}/usr/lib/lua/$(LUAVER); \ -+ install -m 0755 ${lua_swupdate} $(DESTDIR)/usr/lib/lua/$(LUAVER); \ -+ fi - - PHONY += run-tests - tests: \ --- -2.14.1 - diff --git a/package/swupdate/0001-archive-handler-set-locale-for-libarchive.patch b/package/swupdate/0001-archive-handler-set-locale-for-libarchive.patch new file mode 100644 index 0000000..7403097 --- /dev/null +++ b/package/swupdate/0001-archive-handler-set-locale-for-libarchive.patch @@ -0,0 +1,64 @@ +From 95a2b9961119aac80aea1eeabbc1cd52b72d876a Mon Sep 17 00:00:00 2001 +From: James Hilliard +Date: Sat, 4 May 2019 11:38:37 -0600 +Subject: [PATCH] archive handler: set locale for libarchive + +Signed-off-by: James Hilliard +[Backported from: 95a2b9961119aac80aea1eeabbc1cd52b72d876a] +--- + handlers/archive_handler.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/handlers/archive_handler.c b/handlers/archive_handler.c +index 7f12761..993bc10 100644 +--- a/handlers/archive_handler.c ++++ b/handlers/archive_handler.c +@@ -6,6 +6,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -68,6 +69,8 @@ copy_data(struct archive *ar, struct archive *aw) + static void * + extract(void *p) + { ++ locale_t archive_locale; ++ locale_t old_locale; + struct archive *a; + struct archive *ext = NULL; + struct archive_entry *entry = NULL; +@@ -77,6 +80,20 @@ extract(void *p) + flags = data->flags; + int exitval = -EFAULT; + ++ /* ++ * Enable system locale - change from the standard (C) to system locale. ++ * This allows libarchive (in case it is activated) to handle filenames. ++ * We only change LC_CTYPE since libarchive only needs the charset set. ++ * We don't use LC_ALL because it causes problems on some systems. ++ * We restore the original LC_CTYPE after extraction to avoid side effects. ++ * We use uselocale instead of setlocale to avoid setting LC_CTYPE globally. ++ * See on libarchive Website for a more complete description of the issue: ++ * https://github.com/libarchive/libarchive/issues/587 ++ * https://github.com/libarchive/libarchive/wiki/Filenames ++ */ ++ archive_locale = newlocale(LC_CTYPE_MASK, "", (locale_t)0); ++ old_locale = uselocale(archive_locale); ++ + a = archive_read_new(); + if (!a) { + goto out; +@@ -155,6 +172,7 @@ out: + archive_read_free(a); + } + ++ uselocale(old_locale); + data->exitval = exitval; + pthread_exit(NULL); + } +-- +2.7.4 + diff --git a/package/swupdate/0002-Lua-fix-segfault-in-image-property-handling.patch b/package/swupdate/0002-Lua-fix-segfault-in-image-property-handling.patch new file mode 100644 index 0000000..29c052c --- /dev/null +++ b/package/swupdate/0002-Lua-fix-segfault-in-image-property-handling.patch @@ -0,0 +1,41 @@ +From ee17493d470ae7fd7b34241f263cfa6d790ce1b3 Mon Sep 17 00:00:00 2001 +From: Christian Storm +Date: Tue, 21 May 2019 14:45:51 +0200 +Subject: [PATCH] Lua: fix segfault in image property handling + +table2image() calls lua_dump_table() with the 'key' parameter being +NULL and the 'img' parameter set. Subsequently, dict_insert_value() is +called with key == NULL if the Lua stack key's type is string or number, +segfaulting SWUpdate. + +Signed-off-by: Christian Storm +Reported-by: Akihiro Suzuki +Acked-by: Stefano Babic +[Backported from: ee17493d470ae7fd7b34241f263cfa6d790ce1b3] +--- + corelib/lua_interface.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c +index d4ebe4a..443f149 100644 +--- a/corelib/lua_interface.c ++++ b/corelib/lua_interface.c +@@ -80,11 +80,11 @@ static void lua_dump_table(lua_State *L, char *str, struct img_type *img, const + lua_tostring(L, -1), + lua_tostring(L, -2)); + if (img) { +- TRACE("Inserting property %s[%s] = %s", +- key, +- lua_tostring(L, -1), ++ TRACE("Inserting property %s = %s", ++ key ? key : lua_tostring(L, -1), + lua_tostring(L, -2)); +- dict_insert_value(&img->properties, key, ++ dict_insert_value(&img->properties, ++ key ? key : lua_tostring(L, -1), + lua_tostring(L, -2)); + } + break; +-- +2.7.4 + diff --git a/package/swupdate/0003-u-boot-fix-script-format-when-CONFIG_UBOOT_NEWAPI.patch b/package/swupdate/0003-u-boot-fix-script-format-when-CONFIG_UBOOT_NEWAPI.patch new file mode 100644 index 0000000..56e436c --- /dev/null +++ b/package/swupdate/0003-u-boot-fix-script-format-when-CONFIG_UBOOT_NEWAPI.patch @@ -0,0 +1,43 @@ +From f811c91c06bffe32f46472524059914987e653ba Mon Sep 17 00:00:00 2001 +From: Christian Storm +Date: Tue, 21 May 2019 16:20:02 +0200 +Subject: [PATCH] u-boot: fix script format when !CONFIG_UBOOT_NEWAPI + +When !CONFIG_UBOOT_NEWAPI and hence linking against U-Boot's +tools/env/lib.a, SWUpdate's bootloader/uboot.c calls lib.a's +fw_parse_script() which expects input to be in format, quoting: + ... + * Each line has a couple with name, value: + * variable_namevariable_value + +This was changed in SWUpdate by commit dab1b70 "Unify bootloader +script format" to be '='-separated instead of space-separated, +hence breaking the integration with the "old" libubootenv binding. + +Signed-off-by: Christian Storm +Reported-by: Akihiro Suzuki +Acked-by: Stefano Babic +[Backported from: f811c91c06bffe32f46472524059914987e653ba] +--- + corelib/installer.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/corelib/installer.c b/corelib/installer.c +index edfcb6a..2dda40a 100644 +--- a/corelib/installer.c ++++ b/corelib/installer.c +@@ -169,7 +169,11 @@ static int update_bootloader_env(struct swupdate_cfg *cfg, const char *script) + + if (!key || !value) + continue; ++#if defined(CONFIG_UBOOT) && !defined(CONFIG_UBOOT_NEWAPI) ++ snprintf(buf, sizeof(buf), "%s %s\n", key, value); ++#else + snprintf(buf, sizeof(buf), "%s=%s\n", key, value); ++#endif + if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf)) { + TRACE("Error saving temporary bootloader environment file"); + close(fd); +-- +2.7.4 + diff --git a/package/swupdate/Config.in b/package/swupdate/Config.in index ca2eaf2..53f8b09 100644 --- a/package/swupdate/Config.in +++ b/package/swupdate/Config.in @@ -34,6 +34,10 @@ config BR2_PACKAGE_SWUPDATE support for setting the U-Boot environment. * Select BR2_PACKAGE_ZEROMQ to add support for using a remote handler. + * Select BR2_PACKAGE_LIBRSYNC to add support for using + rdiff handler. + * Select BR2_PACKAGE_LIBUBOOTENV and BR2_PACKAGE_ZLIB to add + support for setting the U-Boot environment with the new API. https://sbabic.github.io/swupdate diff --git a/package/swupdate/swupdate.config b/package/swupdate/swupdate.config index 730ebe5..3cb39d8 100644 --- a/package/swupdate/swupdate.config +++ b/package/swupdate/swupdate.config @@ -49,16 +49,13 @@ CONFIG_EXTRA_LDLIBS="" # CONFIG_DEBUG is not set # CONFIG_WERROR is not set # CONFIG_NOCLEANUP is not set - -# -# EFI Boot Guard needs libebgenv and libz -# +# CONFIG_BOOTLOADER_EBG is not set +CONFIG_BOOTLOADER_NONE=y +# CONFIG_BOOTLOADER_GRUB is not set # # U-Boot support needs libubootenv, libz # -CONFIG_BOOTLOADER_NONE=y -# CONFIG_BOOTLOADER_GRUB is not set # # Image downloading support needs libcurl @@ -83,6 +80,7 @@ CONFIG_MONGOOSEIPV6=y # # SSL support needs libcrypto, libssl # +CONFIG_GUNZIP=y # # Parser Features @@ -103,6 +101,7 @@ CONFIG_PARSERROOT="" # ubivol support needs libubi # CONFIG_RAW=y +# CONFIG_RDIFFHANDLER is not set # CONFIG_SHELLSCRIPTHANDLER is not set # @@ -121,3 +120,4 @@ CONFIG_RAW=y # SWU forwarder requires libcurl # # CONFIG_BOOTLOADERHANDLER is not set +# CONFIG_UCFWHANDLER is not set diff --git a/package/swupdate/swupdate.hash b/package/swupdate/swupdate.hash index 138bd6d..8194de6 100644 --- a/package/swupdate/swupdate.hash +++ b/package/swupdate/swupdate.hash @@ -1,5 +1,5 @@ # Locally calculated -sha256 a65884ca18523cde1b0744d952d6f91462dbd4ad07941305f5684c6d4ec833dc swupdate-2018.11.tar.gz +sha256 96b2c59558e847ddb7c23b666c1bbe61e03ab90a64c30d233bd5e9029df8519b swupdate-2019.04.tar.gz sha256 43492b377cf2fb67942d1dd231146bd4e6578646ad13ef289297c9dd75cbc478 Licenses/Exceptions sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 Licenses/gpl-2.0.txt sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 Licenses/lgpl-2.1.txt diff --git a/package/swupdate/swupdate.mk b/package/swupdate/swupdate.mk index 78f23ec..39d7d38 100644 --- a/package/swupdate/swupdate.mk +++ b/package/swupdate/swupdate.mk @@ -4,7 +4,7 @@ # ################################################################################ -SWUPDATE_VERSION = 2018.11 +SWUPDATE_VERSION = 2019.04 SWUPDATE_SITE = $(call github,sbabic,swupdate,$(SWUPDATE_VERSION)) SWUPDATE_LICENSE = GPL-2.0+ with OpenSSL exception, LGPL-2.1+, MIT SWUPDATE_LICENSE_FILES = Licenses/Exceptions Licenses/gpl-2.0.txt \ @@ -77,6 +77,9 @@ endif ifeq ($(BR2_PACKAGE_UBOOT_TOOLS),y) SWUPDATE_DEPENDENCIES += uboot-tools SWUPDATE_MAKE_ENV += HAVE_LIBUBOOTENV=y +else ifeq ($(BR2_PACKAGE_LIBUBOOTENV),y) +SWUPDATE_DEPENDENCIES += libubootenv +SWUPDATE_MAKE_ENV += HAVE_LIBUBOOTENV=y else SWUPDATE_MAKE_ENV += HAVE_LIBUBOOTENV=n endif @@ -95,6 +98,10 @@ else SWUPDATE_MAKE_ENV += HAVE_ZLIB=n endif +ifeq ($(BR2_PACKAGE_LIBRSYNC),y) +SWUPDATE_DEPENDENCIES += librsync +endif + SWUPDATE_BUILD_CONFIG = $(@D)/.config SWUPDATE_KCONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_SWUPDATE_CONFIG))