Skip to contentSkip to conversation

Revert "package/tar: allowing building even on non-Y2038 compliant systems"

PATCH In review Peter Korsgaard 1 participant 11 messages Nov 12, 2023 – Nov 14, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 Revert "package/tar: allowing building even on non-Y2038 compliant systems"

This reverts commit 7f1088f9cae9f191740423a0084bb31f94af2e75.

We're going back to tar 1.34, so this needs to be reverted as well.

---
 package/tar/tar.mk | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
package/tar/tar.mk +3 -9
index 8a612b6f45..eea112ebc7 100644
@@ -7,15 +7,9 @@
 TAR_VERSION = 1.35
 TAR_SOURCE = tar-$(TAR_VERSION).tar.xz
 TAR_SITE = $(BR2_GNU_MIRROR)/tar
-# --exec-prefix=/: busybox installs in /bin, so we need tar to install
-# as well in /bin so that we don't end up with two different tar
-#
-# --disable-year2038: tells the configure script to not abort if the
-# system is not Y2038 compliant. tar will support year2038 if the
-# system is compliant even with this option passed
-TAR_CONF_OPTS = \
-	--exec-prefix=/ \
-	--disable-year2038
+# busybox installs in /bin, so we need tar to install as well in /bin
+# so that we don't end up with two different tar
+TAR_CONF_OPTS = --exec-prefix=/
 TAR_LICENSE = GPL-3.0+
 TAR_LICENSE_FILES = COPYING
 TAR_CPE_ID_VENDOR = gnu
Signature · 6 lines
2.39.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/4 Revert "package/tar: security bump to version 1.35"

This reverts commit d4d483451f0a305781b94b96c15a6cf4b489cd84.

Tar 1.35 unfortunately changes the behaviour for the devmajor/devminor fields, breaking the download hash validation. From the release notes:

* Leave the devmajor and devminor fields empty (rather than zero) for non-special files, as this is more compatible with traditional tar.

https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00005.html

So revert the bump for now.

---
 package/tar/tar.hash | 6 +++---
 package/tar/tar.mk   | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
package/tar/tar.hash +3 -3
index 108a95ee62..1914a9f3b4 100644
@@ -1,4 +1,4 @@
 # Locally calculated after checking signature
-sha256  4d62ff37342ec7aed748535323930c7cf94acf71c3591882b26a7ea50f3edc16  tar-1.35.tar.xz
-sha256  c77a38fcf25b21fd8209d20d35638744344ded239cfc7df80138bf46d3c6b16d  tar-1.35.cpio.gz
-sha256  3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986  COPYING
+sha256  63bebd26879c5e1eea4352f0d03c991f966aeb3ddeb3c7445c902568d5411d28  tar-1.34.tar.xz
+sha256  51337b19c71df92cd4f51c50efe4dc6ddc267d31fd54679be9e9bc2e6ce8132b  tar-1.34.cpio.gz
+sha256  8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903  COPYING
package/tar/tar.mk +1 -1
index eea112ebc7..690a5952ba 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-TAR_VERSION = 1.35
+TAR_VERSION = 1.34
 TAR_SOURCE = tar-$(TAR_VERSION).tar.xz
 TAR_SITE = $(BR2_GNU_MIRROR)/tar
 # busybox installs in /bin, so we need tar to install as well in /bin
Signature · 6 lines
2.39.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/4] Revert "package/tar: security bump to version 1.35"

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

This reverts commit d4d483451f0a305781b94b96c15a6cf4b489cd84. Tar 1.35 unfortunately changes the behaviour for the devmajor/devminor fields, breaking the download hash validation. From the release notes:

Quoted 8 lines

* Leave the devmajor and devminor fields empty (rather than zero) for non-special files, as this is more compatible with traditional tar.

https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00005.html

So revert the bump for now.

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH 2/4] Revert "package/tar: security bump to version 1.35"

In reply to Peter Korsgaard
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

This reverts commit d4d483451f0a305781b94b96c15a6cf4b489cd84. Tar 1.35 unfortunately changes the behaviour for the devmajor/devminor fields, breaking the download hash validation. From the release notes:

Quoted 8 lines

* Leave the devmajor and devminor fields empty (rather than zero) for non-special files, as this is more compatible with traditional tar.

https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00005.html

So revert the bump for now.

Committed to 2023.02.x and 2023.08.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

PATCH 3/4 package/tar: add upstream patch for CVE-2022-48303

In reply to Peter Korsgaard

Fixes CVE-2022-48303: GNU Tar through 1.34 has a one-byte out-of-bounds read that results in use of uninitialized memory for a conditional jump. Exploitation to change the flow of control has not been demonstrated. The issue occurs in from_header in list.c via a V7 archive in which mtime has approximately 11 whitespace characters.

---
 ...oundary-checking-in-base-256-decoder.patch | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 package/tar/0002-Fix-boundary-checking-in-base-256-decoder.patch
package/tar/0002-Fix-boundary-checking-in-base-256-decoder.patch new file +33 -0
new file mode 100644
index 0000000000..7bad339fe0
@@ -0,0 +1,33 @@
+From 3da78400eafcccb97e2f2fd4b227ea40d794ede8 Mon Sep 17 00:00:00 2001
+From: Sergey Poznyakoff <[email protected]>
+Date: Sat, 11 Feb 2023 11:57:39 +0200
+Subject: [PATCH] Fix boundary checking in base-256 decoder
+
+* src/list.c (from_header): Base-256 encoding is at least 2 bytes
+long.
+
+Signed-off-by: Peter Korsgaard <[email protected]>
+Upstream: https://git.savannah.gnu.org/cgit/tar.git/commit/?id=3da78400eafcccb97e2f2fd4b227ea40d794ede8
+---
+ src/list.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/list.c b/src/list.c
+index 9fafc425..86bcfdd1 100644
+--- a/src/list.c
++++ b/src/list.c
+@@ -881,8 +881,9 @@ from_header (char const *where0, size_t digs, char const *type,
+ 	  where++;
+ 	}
+     }
+-  else if (*where == '\200' /* positive base-256 */
+-	   || *where == '\377' /* negative base-256 */)
++  else if (where <= lim - 2
++	   && (*where == '\200' /* positive base-256 */
++	       || *where == '\377' /* negative base-256 */))
+     {
+       /* Parse base-256 output.  A nonnegative number N is
+ 	 represented as (256**DIGS)/2 + N; a negative number -N is
+-- 
+2.39.2
+
Signature · 6 lines
2.39.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

Re: [Buildroot] [PATCH 3/4] package/tar: add upstream patch for CVE-2022-48303

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Fixes CVE-2022-48303: GNU Tar through 1.34 has a one-byte out-of-bounds read that results in use of uninitialized memory for a conditional jump. Exploitation to change the flow of control has not been demonstrated. The issue occurs in from_header in list.c via a V7 archive in which mtime has approximately 11 whitespace characters.

Committed after adding the TAR_IGNORE_CVES entry for this, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Re: [Buildroot] [PATCH 3/4] package/tar: add upstream patch for CVE-2022-48303

In reply to Peter Korsgaard
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Fixes CVE-2022-48303: GNU Tar through 1.34 has a one-byte out-of-bounds read that results in use of uninitialized memory for a conditional jump. Exploitation to change the flow of control has not been demonstrated. The issue occurs in from_header in list.c via a V7 archive in which mtime has approximately 11 whitespace characters.

Committed to 2023.02.x and 2023.08.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

PATCH 4/4 support/dependencies/check-host-tar.sh: blacklist tar 1.35+

In reply to Peter Korsgaard

GNU tar 1.35 changed the behaviour for the devmajor/devminor fields, breaking the download hash validation. For details, see:

https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00005.html
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

To work around this issue, blacklist tar 1.35+ similar to how we do it for pre-1.27 versions so Buildroot falls back to building host-tar (which is currently 1.34).

---
 support/dependencies/check-host-tar.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
support/dependencies/check-host-tar.sh +11 -1
index b7d607a47a..7d6b3bf688 100755
@@ -33,7 +33,12 @@ fi
 major_min=1
 minor_min=27
 
-if [ $major -lt $major_min ]; then
+# Maximal version = 1.34 (1.35 changed devmajor/devminor for files)
+# https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00005.html
+major_max=1
+minor_max=34
+
+if [ $major -lt $major_min -o $major -gt $major_max ]; then
 	# echo nothing: no suitable tar found
 	exit 1
 fi
@@ -43,5 +48,10 @@ if [ $major -eq $major_min -a $minor -lt $minor_min ]; then
 	exit 1
 fi
 
+if [ $major -eq $major_max -a $minor -gt $minor_max ]; then
+	# echo nothing: no suitable tar found
+	exit 1
+fi
+
 # valid
 echo $tar
Signature · 6 lines
2.39.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

Re: [Buildroot] [PATCH 4/4] support/dependencies/check-host-tar.sh: blacklist tar 1.35+

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

GNU tar 1.35 changed the behaviour for the devmajor/devminor fields, breaking the download hash validation. For details, see:

Quoted 8 lines

https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00005.html
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

To work around this issue, blacklist tar 1.35+ similar to how we do it for pre-1.27 versions so Buildroot falls back to building host-tar (which is currently 1.34).

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw

Re: [Buildroot] [PATCH 4/4] support/dependencies/check-host-tar.sh: blacklist tar 1.35+

In reply to Peter Korsgaard
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

GNU tar 1.35 changed the behaviour for the devmajor/devminor fields, breaking the download hash validation. For details, see:

Quoted 8 lines

https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00005.html
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

To work around this issue, blacklist tar 1.35+ similar to how we do it for pre-1.27 versions so Buildroot falls back to building host-tar (which is currently 1.34).

Committed to 2023.02.x and 2023.08.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw
In reply to Peter Korsgaard
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

This reverts commit 7f1088f9cae9f191740423a0084bb31f94af2e75. We're going back to tar 1.34, so this needs to be reverted as well.

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot