All of lore.kernel.org
 help / color / mirror / Atom feed
* [gatesgarth][PATCH 0/4] Patch review request
@ 2021-09-06  3:06 Anuj Mittal
  2021-09-06  3:06 ` [gatesgarth][PATCH 1/4] lib/package_manager: Use shutil.copy instead of bb.utils.copyfile for intercepts Anuj Mittal
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Anuj Mittal @ 2021-09-06  3:06 UTC (permalink / raw)
  To: openembedded-core

Gatesgarth isn't maintained anymore but it was pointed out that it's
missing an important fix. I tested it along with a few others and
didn't see any issue.

https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/2536

Thanks,

Anuj

The following changes since commit d47b7cdc3508343349f3bb3eacb2dc3227dd94d2:

  build-appliance-image: Update to gatesgarth head revision (2021-05-06 11:20:38 +0100)

are available in the Git repository at:

  git://push.openembedded.org/openembedded-core-contrib anujm/gatesgarth

Anatol Belski (1):
  tar: Fix CVE-2021-20193

Richard Purdie (3):
  lib/package_manager: Use shutil.copy instead of bb.utils.copyfile for
    intercepts
  kernel: Fix interaction when packaging disabled
  kernel-devicetree: Fix interaction when packaging disabled

 meta/classes/kernel-devicetree.bbclass        |  11 +-
 meta/classes/kernel.bbclass                   |   2 +
 meta/lib/oe/package_manager/__init__.py       |   2 +-
 .../tar/tar/CVE-2021-20193.patch              | 133 ++++++++++++++++++
 meta/recipes-extended/tar/tar_1.32.bb         |   1 +
 5 files changed, 144 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-extended/tar/tar/CVE-2021-20193.patch

-- 
2.31.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gatesgarth][PATCH 1/4] lib/package_manager: Use shutil.copy instead of bb.utils.copyfile for intercepts
  2021-09-06  3:06 [gatesgarth][PATCH 0/4] Patch review request Anuj Mittal
@ 2021-09-06  3:06 ` Anuj Mittal
  2021-09-06  3:06 ` [gatesgarth][PATCH 2/4] tar: Fix CVE-2021-20193 Anuj Mittal
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Anuj Mittal @ 2021-09-06  3:06 UTC (permalink / raw)
  To: openembedded-core

From: Richard Purdie <richard.purdie@linuxfoundation.org>

If the scripts/postinst-intercepts is owned by root/root then the copyfile() calls
will fail due to chown issues. We don't care about ownership of these files so
use shutil.copy() instead which won't perform any chown.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 1a03c70c282b3445b93a4c70ea6d40a1778750c5)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 meta/lib/oe/package_manager/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py
index 42225a3b2e..26f9f82aaa 100644
--- a/meta/lib/oe/package_manager/__init__.py
+++ b/meta/lib/oe/package_manager/__init__.py
@@ -189,7 +189,7 @@ class PackageManager(object, metaclass=ABCMeta):
         bb.utils.remove(self.intercepts_dir, True)
         bb.utils.mkdirhier(self.intercepts_dir)
         for intercept in postinst_intercepts:
-            bb.utils.copyfile(intercept, os.path.join(self.intercepts_dir, os.path.basename(intercept)))
+            shutil.copy(intercept, os.path.join(self.intercepts_dir, os.path.basename(intercept)))
 
     @abstractmethod
     def _handle_intercept_failure(self, failed_script):
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gatesgarth][PATCH 2/4] tar: Fix CVE-2021-20193
  2021-09-06  3:06 [gatesgarth][PATCH 0/4] Patch review request Anuj Mittal
  2021-09-06  3:06 ` [gatesgarth][PATCH 1/4] lib/package_manager: Use shutil.copy instead of bb.utils.copyfile for intercepts Anuj Mittal
@ 2021-09-06  3:06 ` Anuj Mittal
  2021-09-06  3:06 ` [gatesgarth][PATCH 3/4] kernel: Fix interaction when packaging disabled Anuj Mittal
  2021-09-06  3:06 ` [gatesgarth][PATCH 4/4] kernel-devicetree: " Anuj Mittal
  3 siblings, 0 replies; 5+ messages in thread
From: Anuj Mittal @ 2021-09-06  3:06 UTC (permalink / raw)
  To: openembedded-core

From: Anatol Belski <anbelski@linux.microsoft.com>

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 .../tar/tar/CVE-2021-20193.patch              | 133 ++++++++++++++++++
 meta/recipes-extended/tar/tar_1.32.bb         |   1 +
 2 files changed, 134 insertions(+)
 create mode 100644 meta/recipes-extended/tar/tar/CVE-2021-20193.patch

diff --git a/meta/recipes-extended/tar/tar/CVE-2021-20193.patch b/meta/recipes-extended/tar/tar/CVE-2021-20193.patch
new file mode 100644
index 0000000000..89e8e20844
--- /dev/null
+++ b/meta/recipes-extended/tar/tar/CVE-2021-20193.patch
@@ -0,0 +1,133 @@
+From d9d4435692150fa8ff68e1b1a473d187cc3fd777 Mon Sep 17 00:00:00 2001
+From: Sergey Poznyakoff <gray@gnu.org>
+Date: Sun, 17 Jan 2021 20:41:11 +0200
+Subject: Fix memory leak in read_header
+
+Bug reported in https://savannah.gnu.org/bugs/?59897
+
+* src/list.c (read_header): Don't return directly from the loop.
+Instead set the status and break.  Return the status.  Free
+next_long_name and next_long_link before returning.
+
+CVE: CVE-2021-20193
+Upstream-Status: Backport
+[https://git.savannah.gnu.org/cgit/tar.git/patch/?id=d9d4435692150fa8ff68e1b1a473d187cc3fd777]
+Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
+
+---
+ src/list.c | 40 ++++++++++++++++++++++++++++------------
+ 1 file changed, 28 insertions(+), 12 deletions(-)
+
+diff --git a/src/list.c b/src/list.c
+index e40a5c8..d7ef441 100644
+--- a/src/list.c
++++ b/src/list.c
+@@ -408,26 +408,27 @@ read_header (union block **return_block, struct tar_stat_info *info,
+ 	     enum read_header_mode mode)
+ {
+   union block *header;
+-  union block *header_copy;
+   char *bp;
+   union block *data_block;
+   size_t size, written;
+-  union block *next_long_name = 0;
+-  union block *next_long_link = 0;
++  union block *next_long_name = NULL;
++  union block *next_long_link = NULL;
+   size_t next_long_name_blocks = 0;
+   size_t next_long_link_blocks = 0;
+-
++  enum read_header status = HEADER_SUCCESS;
++  
+   while (1)
+     {
+-      enum read_header status;
+-
+       header = find_next_block ();
+       *return_block = header;
+       if (!header)
+-	return HEADER_END_OF_FILE;
++	{
++	  status = HEADER_END_OF_FILE;
++	  break;
++	}
+ 
+       if ((status = tar_checksum (header, false)) != HEADER_SUCCESS)
+-	return status;
++	break;
+ 
+       /* Good block.  Decode file size and return.  */
+ 
+@@ -437,7 +438,10 @@ read_header (union block **return_block, struct tar_stat_info *info,
+ 	{
+ 	  info->stat.st_size = OFF_FROM_HEADER (header->header.size);
+ 	  if (info->stat.st_size < 0)
+-	    return HEADER_FAILURE;
++	    {
++	      status = HEADER_FAILURE;
++	      break;
++	    }
+ 	}
+ 
+       if (header->header.typeflag == GNUTYPE_LONGNAME
+@@ -447,10 +451,14 @@ read_header (union block **return_block, struct tar_stat_info *info,
+ 	  || header->header.typeflag == SOLARIS_XHDTYPE)
+ 	{
+ 	  if (mode == read_header_x_raw)
+-	    return HEADER_SUCCESS_EXTENDED;
++	    {
++	      status = HEADER_SUCCESS_EXTENDED;
++	      break;
++	    }
+ 	  else if (header->header.typeflag == GNUTYPE_LONGNAME
+ 		   || header->header.typeflag == GNUTYPE_LONGLINK)
+ 	    {
++	      union block *header_copy;
+ 	      size_t name_size = info->stat.st_size;
+ 	      size_t n = name_size % BLOCKSIZE;
+ 	      size = name_size + BLOCKSIZE;
+@@ -517,7 +525,10 @@ read_header (union block **return_block, struct tar_stat_info *info,
+ 	      xheader_decode_global (&xhdr);
+ 	      xheader_destroy (&xhdr);
+ 	      if (mode == read_header_x_global)
+-		return HEADER_SUCCESS_EXTENDED;
++		{
++		  status = HEADER_SUCCESS_EXTENDED;
++		  break;
++		}
+ 	    }
+ 
+ 	  /* Loop!  */
+@@ -536,6 +547,7 @@ read_header (union block **return_block, struct tar_stat_info *info,
+ 	      name = next_long_name->buffer + BLOCKSIZE;
+ 	      recent_long_name = next_long_name;
+ 	      recent_long_name_blocks = next_long_name_blocks;
++	      next_long_name = NULL;
+ 	    }
+ 	  else
+ 	    {
+@@ -567,6 +579,7 @@ read_header (union block **return_block, struct tar_stat_info *info,
+ 	      name = next_long_link->buffer + BLOCKSIZE;
+ 	      recent_long_link = next_long_link;
+ 	      recent_long_link_blocks = next_long_link_blocks;
++	      next_long_link = NULL;
+ 	    }
+ 	  else
+ 	    {
+@@ -578,9 +591,12 @@ read_header (union block **return_block, struct tar_stat_info *info,
+ 	    }
+ 	  assign_string (&info->link_name, name);
+ 
+-	  return HEADER_SUCCESS;
++	  break;
+ 	}
+     }
++  free (next_long_name);
++  free (next_long_link);
++  return status;
+ }
+ 
+ #define ISOCTAL(c) ((c)>='0'&&(c)<='7')
+-- 
+cgit v1.2.1
+
diff --git a/meta/recipes-extended/tar/tar_1.32.bb b/meta/recipes-extended/tar/tar_1.32.bb
index ebe6cb0dbd..3ae6d674a5 100644
--- a/meta/recipes-extended/tar/tar_1.32.bb
+++ b/meta/recipes-extended/tar/tar_1.32.bb
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
 SRC_URI = "${GNU_MIRROR}/tar/tar-${PV}.tar.bz2 \
            file://musl_dirent.patch \
+           file://CVE-2021-20193.patch \
 "
 
 SRC_URI[md5sum] = "17917356fff5cb4bd3cd5a6c3e727b05"
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gatesgarth][PATCH 3/4] kernel: Fix interaction when packaging disabled
  2021-09-06  3:06 [gatesgarth][PATCH 0/4] Patch review request Anuj Mittal
  2021-09-06  3:06 ` [gatesgarth][PATCH 1/4] lib/package_manager: Use shutil.copy instead of bb.utils.copyfile for intercepts Anuj Mittal
  2021-09-06  3:06 ` [gatesgarth][PATCH 2/4] tar: Fix CVE-2021-20193 Anuj Mittal
@ 2021-09-06  3:06 ` Anuj Mittal
  2021-09-06  3:06 ` [gatesgarth][PATCH 4/4] kernel-devicetree: " Anuj Mittal
  3 siblings, 0 replies; 5+ messages in thread
From: Anuj Mittal @ 2021-09-06  3:06 UTC (permalink / raw)
  To: openembedded-core

From: Richard Purdie <richard.purdie@linuxfoundation.org>

When packaging is disabled using the nopackages class, ensure we don't
add to PACKAGES. This fixes builds where we have an unpackaged kernel
alongside a packaged kernel.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 2522daf22e2c27dd9c7926feda0345978217c6c3)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 meta/classes/kernel.bbclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index f405b6e523..b03a286ed4 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -90,6 +90,8 @@ python __anonymous () {
     imagedest = d.getVar('KERNEL_IMAGEDEST')
 
     for type in types.split():
+        if bb.data.inherits_class('nopackages', d):
+            continue
         typelower = type.lower()
         d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
         d.setVar('FILES_' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gatesgarth][PATCH 4/4] kernel-devicetree: Fix interaction when packaging disabled
  2021-09-06  3:06 [gatesgarth][PATCH 0/4] Patch review request Anuj Mittal
                   ` (2 preceding siblings ...)
  2021-09-06  3:06 ` [gatesgarth][PATCH 3/4] kernel: Fix interaction when packaging disabled Anuj Mittal
@ 2021-09-06  3:06 ` Anuj Mittal
  3 siblings, 0 replies; 5+ messages in thread
From: Anuj Mittal @ 2021-09-06  3:06 UTC (permalink / raw)
  To: openembedded-core

From: Richard Purdie <richard.purdie@linuxfoundation.org>

When packaging is disabled using the nopackages class, ensure we don't
add to PACKAGES. This fixes builds where we have an unpackaged kernel
alongside a packaged kernel.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit d6b114cf5a9b22688c0b59a3afc46a07450d87b5)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 meta/classes/kernel-devicetree.bbclass | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass
index 81dda8003f..3c5def1041 100644
--- a/meta/classes/kernel-devicetree.bbclass
+++ b/meta/classes/kernel-devicetree.bbclass
@@ -1,8 +1,11 @@
 # Support for device tree generation
-PACKAGES_append = " \
-    ${KERNEL_PACKAGE_NAME}-devicetree \
-    ${@[d.getVar('KERNEL_PACKAGE_NAME') + '-image-zimage-bundle', ''][d.getVar('KERNEL_DEVICETREE_BUNDLE') != '1']} \
-"
+python () {
+    if not bb.data.inherits_class('nopackages', d):
+        d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
+        if d.getVar('KERNEL_DEVICETREE_BUNDLE') == '1':
+            d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-image-zimage-bundle")
+}
+
 FILES_${KERNEL_PACKAGE_NAME}-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo"
 FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin"
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-06  3:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06  3:06 [gatesgarth][PATCH 0/4] Patch review request Anuj Mittal
2021-09-06  3:06 ` [gatesgarth][PATCH 1/4] lib/package_manager: Use shutil.copy instead of bb.utils.copyfile for intercepts Anuj Mittal
2021-09-06  3:06 ` [gatesgarth][PATCH 2/4] tar: Fix CVE-2021-20193 Anuj Mittal
2021-09-06  3:06 ` [gatesgarth][PATCH 3/4] kernel: Fix interaction when packaging disabled Anuj Mittal
2021-09-06  3:06 ` [gatesgarth][PATCH 4/4] kernel-devicetree: " Anuj Mittal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.