Skip to contentSkip to conversation

shadow: update 4.13 -> 4.14.2

PATCH In review Alexander Kanavin 5 participants 24 messages Jan 11, 2024 – Feb 8, 2024 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 shadow: update 4.13 -> 4.14.2

License-Update: formatting, spdx conversion

Drop:
0001-Disable-use-of-syslog-for-sysroot.patch
(issue fixed upstream)

0001-Fix-can-not-print-full-login.patch
0001-Overhaul-valid_field.patch
CVE-2023-29383.patch
(backports)

libbsd is a new native dependency, as otherwise glibc >= 2.38 is needed.

A similar fix is added to musl in order to define non-standard __BEGIN_DECLS/__END_DECLS.

---
 ...01-Disable-use-of-syslog-for-sysroot.patch |  52 -------
 .../0001-Fix-can-not-print-full-login.patch   |  41 -----
 .../files/0001-Overhaul-valid_field.patch     |  65 --------
 .../shadow/files/CVE-2023-29383.patch         |  53 -------
 .../shadow/files/CVE-2023-4641.patch          | 147 ------------------
 ...nexpected-open-failure-in-chroot-env.patch |  16 +-
 meta/recipes-extended/shadow/shadow.inc       |  20 +--
 .../{shadow_4.13.bb => shadow_4.14.2.bb}      |   0
 8 files changed, 16 insertions(+), 378 deletions(-)
 delete mode 100644 meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch
 delete mode 100644 meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch
 delete mode 100644 meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch
 delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-29383.patch
 delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-4641.patch
 rename meta/recipes-extended/shadow/{shadow_4.13.bb => shadow_4.14.2.bb} (100%)
meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -52
deleted file mode 100644
index fa1532c8317..00000000000
@@ -1,52 +0,0 @@
-From 85d0444229ee3d14fefcf10d093f49c862826f82 Mon Sep 17 00:00:00 2001
-From: Richard Purdie <[email protected]>
-Date: Thu, 14 Apr 2022 23:11:53 +0000
-Subject: [PATCH] Disable use of syslog for shadow-native tools
-
-Disable use of syslog to prevent sysroot user and group additions from
-writing entries to the host's syslog. This patch should only be used
-with the shadow-native recipe.
-
-Upstream-Status: Inappropriate [OE specific configuration]
-Signed-off-by: Richard Purdie <[email protected]>
-Signed-off-by: Peter Kjellerstedt <[email protected]>
-
----
- configure.ac      | 2 +-
- src/login_nopam.c | 3 ++-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 924254a..603af81 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -191,7 +191,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
- 	[Path to passwd program.])
- 
- dnl XXX - quick hack, should disappear before anyone notices :).
--AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
-+#AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
- if test "$ac_cv_func_ruserok" = "yes"; then
- 	AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
- 	AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
-diff --git a/src/login_nopam.c b/src/login_nopam.c
-index df6ba88..fc24e13 100644
---- a/src/login_nopam.c
-+++ b/src/login_nopam.c
-@@ -29,7 +29,6 @@
- #ifndef USE_PAM
- #ident "$Id$"
- 
--#include "prototypes.h"
-     /*
-      * This module implements a simple but effective form of login access
-      * control based on login names and on host (or domain) names, internet
-@@ -57,6 +56,8 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>		/* for inet_ntoa() */
- 
-+#include "prototypes.h"
-+
- #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
- #undef MAXHOSTNAMELEN
- #define MAXHOSTNAMELEN 256
meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -41

41 lines not on this page · raw message

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -65

65 lines not on this page · raw message

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -53

53 lines not on this page · raw message

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -147

147 lines not on this page · raw message

meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch +9 -7
index 85d91751056..4a932d2dbb1 100644
@@ -1,4 +1,4 @@
-From 21583da072aa66901d859ac00ce209bac87ddecc Mon Sep 17 00:00:00 2001
+From a773c6b240d27e23d6be41decef0edf24fcee523 Mon Sep 17 00:00:00 2001
 From: Chen Qi <[email protected]>
 Date: Thu, 17 Jul 2014 15:53:34 +0800
 Subject: [PATCH] commonio.c-fix-unexpected-open-failure-in-chroot-env
@@ -15,35 +15,37 @@ Note that this patch doesn't change the logic in the code, it just expands
 the codes.
 
 Signed-off-by: Chen Qi <[email protected]>
-
 ---
  lib/commonio.c | 16 ++++++++++++----
  1 file changed, 12 insertions(+), 4 deletions(-)
 
 diff --git a/lib/commonio.c b/lib/commonio.c
-index 9a02ce1..61384ec 100644
+index 73fdb3a..d1231e9 100644
 --- a/lib/commonio.c
 +++ b/lib/commonio.c
-@@ -616,10 +616,18 @@ int commonio_open (struct commonio_db *db, int mode)
+@@ -606,10 +606,18 @@ int commonio_open (struct commonio_db *db, int mode)
  	db->cursor = NULL;
  	db->changed = false;
  
 -	fd = open (db->filename,
 -	             (db->readonly ? O_RDONLY : O_RDWR)
--	           | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
+-	           | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);
 -	saved_errno = errno;
 +	if (db->readonly) {
 +		fd = open (db->filename,
 +			   (true ? O_RDONLY : O_RDWR)
-+			   | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++			   | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);
 +		saved_errno = errno;
 +	} else {
 +		fd = open (db->filename,
 +			   (false ? O_RDONLY : O_RDWR)
-+			   | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++			   | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW| O_CLOEXEC);
 +		saved_errno = errno;
 +	}
 +
  	db->fp = NULL;
  	if (fd >= 0) {
  #ifdef WITH_TCB
+-- 
+2.30.2
+
meta/recipes-extended/shadow/shadow.inc +7 -13
index ce3ce627156..c024746d4ff 100644
@@ -5,7 +5,7 @@ BUGTRACKER = "http://github.com/shadow-maint/shadow/issues"
 SECTION = "base/utils"
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://COPYING;md5=c9a450b7be84eac23e6353efecb60b5b \
-                    file://src/passwd.c;beginline=2;endline=30;md5=758c26751513b6795395275969dd3be1 \
+                    file://src/passwd.c;beginline=2;endline=7;md5=67bcf314687820b2f010d4863fce3fc5 \
                     "
 
 DEPENDS = "virtual/crypt"
@@ -14,10 +14,6 @@ GITHUB_BASE_URI = "https://github.com/shadow-maint/shadow/releases"
 SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
            ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
            file://useradd \
-	   file://0001-Fix-can-not-print-full-login.patch \
-           file://CVE-2023-29383.patch \
-           file://0001-Overhaul-valid_field.patch \
-           file://CVE-2023-4641.patch \
            "
 
 SRC_URI:append:class-target = " \
@@ -26,14 +22,9 @@ SRC_URI:append:class-target = " \
            "
 
 SRC_URI:append:class-native = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
            file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
            "
-SRC_URI:append:class-nativesdk = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
-           "
-SRC_URI[sha256sum] = "813057047499c7fe81108adcf0cffa3ad4ec75e19a80151f9cbaa458ff2e86cd"
-
+SRC_URI[sha256sum] = "a305edf5d19bddbdf5e836d2d609fa8bff2d35458819de4d9f06306a1cf24342"
 
 # Additional Policy files for PAM
 PAM_SRC_URI = "file://pam.d/chfn \
@@ -44,7 +35,7 @@ PAM_SRC_URI = "file://pam.d/chfn \
                file://pam.d/passwd \
                file://pam.d/su"
 
-inherit autotools gettext github-releases
+inherit autotools gettext github-releases pkgconfig
 
 export CONFIG_SHELL="/bin/sh"
 
@@ -54,6 +45,8 @@ EXTRA_OECONF += "--without-libcrack \
                  --without-sssd \
                  ${NSCDOPT}"
 
+CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
+
 NSCDOPT = ""
 NSCDOPT:class-native = "--without-nscd"
 NSCDOPT:class-nativesdk = "--without-nscd"
@@ -73,13 +66,14 @@ PAM_PLUGINS = "libpam-runtime \
 
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
-PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
+PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} libbsd"
 PACKAGECONFIG:class-nativesdk = ""
 PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
 PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
 PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl"
 PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit"
 PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage"
+PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"
 
 RDEPENDS:${PN} = "shadow-securetty \
                   base-passwd \
meta/recipes-extended/shadow/shadow_4.14.2.bb renamed from meta/recipes-extended/shadow/shadow_4.13.bb +0 -0
similarity index 100%
rename from meta/recipes-extended/shadow/shadow_4.13.bb
rename to meta/recipes-extended/shadow/shadow_4.14.2.bb
Signature · 1 line
2.39.2
#1 lore raw

PATCH v3 2/2 shadow: link executables statically for -native variant

shadow 4.14.x adds a number of libraries it dynamically links with (md, bsd, attr). This causes troubles in setscene tasks where shadow executables are used (such as useradd), as pulling in the needed dynamic libraries needs unpleasant special-casing.

---
v2: patch only Makefiles that produce executables and libshadow.a (that executables all statically link with), do not patch libsubid/Makefile, as patching in .a linking can clash with producing dynamic libraries. libsubid is used only in getsubids executable, which is not used in setscene user management (or anywhere else from what I can see).

v3: add -no-pie to linker flags, as otherwise some host distros would refuse to link against libattr produced on other host distros and supplied via sstate (libattr made with gcc 13 and used on gcc 11/12 hosts seems to be problematic)

---
 meta/conf/distro/include/no-static-libs.inc |  5 +++++
 meta/recipes-extended/shadow/shadow.inc     | 10 ++++++++++
 2 files changed, 15 insertions(+)
meta/conf/distro/include/no-static-libs.inc +5 -0
index 75359928a14..8898d53d756 100644
@@ -21,6 +21,11 @@ DISABLE_STATIC:pn-libusb1-native = ""
 # needed by rust
 DISABLE_STATIC:pn-musl = ""
 
+# needed by shadow-native to build static executables, particularly useradd
+DISABLE_STATIC:pn-attr-native = ""
+DISABLE_STATIC:pn-libbsd-native = ""
+DISABLE_STATIC:pn-libmd-native = ""
+
 EXTRA_OECONF:append = "${DISABLE_STATIC}"
 
 EXTRA_OECMAKE:append:pn-libical = " -DSHARED_ONLY=True"
meta/recipes-extended/shadow/shadow.inc +10 -0
index c024746d4ff..43f456251a5 100644
@@ -47,6 +47,16 @@ EXTRA_OECONF += "--without-libcrack \
 
 CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
 
+# Force static linking of utilities so we can use from the sysroot/sstate for useradd
+# without worrying about the dependency libraries being available
+LDFLAGS:append:class-native = " -no-pie"
+do_compile:prepend:class-native () {
+	sed -i -e 's#\(LIBS.*\)-lbsd#\1 ${STAGING_LIBDIR}/libbsd.a ${STAGING_LIBDIR}/libmd.a#g' \
+	       -e 's#\(LIBBSD.*\)-lbsd#\1 ${STAGING_LIBDIR}/libbsd.a ${STAGING_LIBDIR}/libmd.a#g' \
+	       -e 's#\(LIBATTR.*\)-lattr#\1 ${STAGING_LIBDIR}/libattr.a#g' \
+               ${B}/lib/Makefile ${B}/src/Makefile
+}
+
 NSCDOPT = ""
 NSCDOPT:class-native = "--without-nscd"
 NSCDOPT:class-nativesdk = "--without-nscd"
Signature · 1 line
2.39.2
#2 lore raw

Re: [OE-core] [PATCH v3 2/2] shadow: link executables statically for -native variant

Quoted 7 lines · Alexander Kanavin

shadow 4.14.x adds a number of libraries it dynamically links with (md, bsd, attr). This causes troubles in setscene tasks where shadow executables are used (such as useradd), as pulling in the needed dynamic libraries needs unpleasant special-casing.

It seems, this is causing issues with the TuxOE builds. We have been observing issues with the TuxOE build environment with the image creation choking on the home dirs. Reverting this patch seems to fix the problem. The build environment is Ubuntu 20.04 running in a container on Ubuntu 22.04.

ERROR: rpb-weston-image-1.0-r0 do_image_tar:
ExecutionError('/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075', 1, None, None)
ERROR: Logfile of failure stored in:
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/log.do_image_tar.160075 Log data follows:

| DEBUG: Executing python function set_image_size
| DEBUG: 1402908.000000 = 1079160 * 1.300000
| DEBUG: 1402908.000000 = max(1402908.000000, 65536)[1402908.000000] + 0
| DEBUG: 1402908.000000 = int(1402908.000000)
| DEBUG: 1404928 = aligned(1402908)
| DEBUG: returning 1404928
| DEBUG: Python function set_image_size finished
| DEBUG: Executing shell function do_image_tar
| tar: ./home/linaro/.bashrc: Unknown file type; file ignored
| tar: ./home/linaro/.profile: Unknown file type; file ignored
| tar: Exiting with failure status due to previous errors
| WARNING: /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075:146

exit 1 from '[ $? -eq 1 ]'
| WARNING: Backtrace (BB generated script):
| #1: do_image_tar, /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075, line 146
| #2: main, /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075, line 152
NOTE: recipe rpb-weston-image-1.0-r0: task do_image_tar: Failed
ERROR: Task (/oe/build/conf/../../layers/meta-rpb/recipes-samples/images/rpb-weston-image.bb:do_image_tar) failed with exit code '1'

| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing python function set_image_size
| DEBUG: 1402908.000000 = 1079160 * 1.300000
| DEBUG: 1402908.000000 = max(1402908.000000, 65536)[1402908.000000] + 0
| DEBUG: 1402908.000000 = int(1402908.000000)
| DEBUG: 1404928 = aligned(1402908)
| DEBUG: returning 1404928
| DEBUG: Python function set_image_size finished
| DEBUG: Executing shell function do_image_ext4
| DEBUG: Executing dd if=/dev/zero
of=/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/deploy-rpb-weston-image-image-complete/rpb-weston-image-qcom-armv8a.rootfs-20240117062023.ext4
seek=1404928 count=0 bs=1024
| 0+0 records in
| 0+0 records out
| 0 bytes copied, 9.0878e-05 s, 0.0 kB/s
| DEBUG: Actual Rootfs size:  1075376

/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/rootfs
| DEBUG: Actual Partition size: 1438646272
| DEBUG: Executing mkfs.ext4 -F -b 4096 /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/deploy-rpb-weston-image-image-complete/rpb-weston-image-qcom-armv8a.rootfs-20240117062023.ext4 -d /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/rootfs
| mke2fs 1.47.0 (5-Feb-2023)
| Discarding device blocks: 0/351232
done

| Creating filesystem with 351232 4k blocks and 87824 inodes
| Filesystem UUID: 27cefb6f-e38e-44ed-ab0f-4b613d3594f2
| Superblock backups stored on blocks:
| 32768, 98304, 163840, 229376, 294912
|
| Allocating group tables:  0/11               done
| Writing inode tables:  0/11               done
| Creating journal (8192 blocks): done
| Copying files into the device: __populate_fs: ignoring entry ".bashrc"
| .bashrc: File not found by ext2_lookup while looking up ".bashrc"
| mkfs.ext4: File not found by ext2_lookup while populating file system
| WARNING: /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_ext4.160095:176

exit 1 from 'mkfs.$fstype -F $extra_imagecmd /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/deploy-rpb-weston-image-image-complete/rpb-weston-image-qcom-armv8a.rootfs-20240117062023.$fstype -d /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/rootfs'
| WARNING: Backtrace (BB generated script):
| #1: oe_mkext234fs,
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_ext4.160095,
line 176
| #2: do_image_ext4,
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_ext4.160095,
line 146
| #3: main, /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_ext4.160095,
line 213
NOTE: recipe rpb-weston-image-1.0-r0: task do_image_ext4: Failed

Quoted 68 lines

---
v2: patch only Makefiles that produce executables and libshadow.a (that executables all statically link with), do not patch libsubid/Makefile, as patching in .a linking can clash with producing dynamic libraries. libsubid is used only in getsubids executable, which is not used in setscene user management (or anywhere else from what I can see).

v3: add -no-pie to linker flags, as otherwise some host distros would refuse to link against libattr produced on other host distros and supplied via sstate (libattr made with gcc 13 and used on gcc 11/12 hosts seems to be problematic)

---
 meta/conf/distro/include/no-static-libs.inc |  5 +++++
 meta/recipes-extended/shadow/shadow.inc     | 10 ++++++++++
 2 files changed, 15 insertions(+)
meta/conf/distro/include/no-static-libs.inc +5 -0
index 75359928a14..8898d53d756 100644
@@ -21,6 +21,11 @@ DISABLE_STATIC:pn-libusb1-native = ""
 # needed by rust
 DISABLE_STATIC:pn-musl = ""
 
+# needed by shadow-native to build static executables, particularly useradd
+DISABLE_STATIC:pn-attr-native = ""
+DISABLE_STATIC:pn-libbsd-native = ""
+DISABLE_STATIC:pn-libmd-native = ""
+
 EXTRA_OECONF:append = "${DISABLE_STATIC}"
 
 EXTRA_OECMAKE:append:pn-libical = " -DSHARED_ONLY=True"
meta/recipes-extended/shadow/shadow.inc +10 -1
index c024746d4ff..43f456251a5 100644
@@ -47,6 +47,16 @@ EXTRA_OECONF += "--without-libcrack \
 
 CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
 
+# Force static linking of utilities so we can use from the sysroot/sstate for useradd
+# without worrying about the dependency libraries being available
+LDFLAGS:append:class-native = " -no-pie"
+do_compile:prepend:class-native () {
+       sed -i -e 's#\(LIBS.*\)-lbsd#\1 ${STAGING_LIBDIR}/libbsd.a ${STAGING_LIBDIR}/libmd.a#g' \
+              -e 's#\(LIBBSD.*\)-lbsd#\1 ${STAGING_LIBDIR}/libbsd.a ${STAGING_LIBDIR}/libmd.a#g' \
+              -e 's#\(LIBATTR.*\)-lattr#\1 ${STAGING_LIBDIR}/libattr.a#g' \
+               ${B}/lib/Makefile ${B}/src/Makefile
+}
+
 NSCDOPT = ""
 NSCDOPT:class-native = "--without-nscd"
 NSCDOPT:class-nativesdk = "--without-nscd"
--

2.39.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#193543): https://lists.openembedded.org/g/openembedded-core/message/193543
Mute This Topic: https://lists.openembedded.org/mt/103661548/3618183
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 2 lines
With best wishes
Dmitry
#3 lore raw

Re: [OE-core] [PATCH v3 2/2] shadow: link executables statically for -native variant

Quoted 81 lines · Dmitry Baryshkov
Quoted 7 lines · Alexander Kanavin

shadow 4.14.x adds a number of libraries it dynamically links with (md, bsd, attr). This causes troubles in setscene tasks where shadow executables are used (such as useradd), as pulling in the needed dynamic libraries needs unpleasant special-casing.

It seems, this is causing issues with the TuxOE builds. We have been observing issues with the TuxOE build environment with the image creation choking on the home dirs. Reverting this patch seems to fix the problem. The build environment is Ubuntu 20.04 running in a container on Ubuntu 22.04.

ERROR: rpb-weston-image-1.0-r0 do_image_tar:
ExecutionError('/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075', 1, None, None)
ERROR: Logfile of failure stored in:
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/log.do_image_tar.160075 Log data follows:

| DEBUG: Executing python function set_image_size
| DEBUG: 1402908.000000 = 1079160 * 1.300000
| DEBUG: 1402908.000000 = max(1402908.000000, 65536)[1402908.000000] + 0
| DEBUG: 1402908.000000 = int(1402908.000000)
| DEBUG: 1404928 = aligned(1402908)
| DEBUG: returning 1404928
| DEBUG: Python function set_image_size finished
| DEBUG: Executing shell function do_image_tar
| tar: ./home/linaro/.bashrc: Unknown file type; file ignored
| tar: ./home/linaro/.profile: Unknown file type; file ignored
| tar: Exiting with failure status due to previous errors
| WARNING: /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075:146

exit 1 from '[ $? -eq 1 ]'
| WARNING: Backtrace (BB generated script):
| #1: do_image_tar, /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075, line 146
| #2: main, /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075, line 152
NOTE: recipe rpb-weston-image-1.0-r0: task do_image_tar: Failed
ERROR: Task (/oe/build/conf/../../layers/meta-rpb/recipes-samples/images/rpb-weston-image.bb:do_image_tar) failed with exit code '1'

| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing python function set_image_size
| DEBUG: 1402908.000000 = 1079160 * 1.300000
| DEBUG: 1402908.000000 = max(1402908.000000, 65536)[1402908.000000] + 0
| DEBUG: 1402908.000000 = int(1402908.000000)
| DEBUG: 1404928 = aligned(1402908)
| DEBUG: returning 1404928
| DEBUG: Python function set_image_size finished
| DEBUG: Executing shell function do_image_ext4
| DEBUG: Executing dd if=/dev/zero
of=/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/deploy-rpb-weston-image-image-complete/rpb-weston-image-qcom-armv8a.rootfs-20240117062023.ext4
seek=1404928 count=0 bs=1024
| 0+0 records in
| 0+0 records out
| 0 bytes copied, 9.0878e-05 s, 0.0 kB/s
| DEBUG: Actual Rootfs size:  1075376

/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/rootfs
| DEBUG: Actual Partition size: 1438646272
| DEBUG: Executing mkfs.ext4 -F -b 4096 /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/deploy-rpb-weston-image-image-complete/rpb-weston-image-qcom-armv8a.rootfs-20240117062023.ext4 -d /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/rootfs
| mke2fs 1.47.0 (5-Feb-2023)
| Discarding device blocks: 0/351232
done

| Creating filesystem with 351232 4k blocks and 87824 inodes
| Filesystem UUID: 27cefb6f-e38e-44ed-ab0f-4b613d3594f2
| Superblock backups stored on blocks:
| 32768, 98304, 163840, 229376, 294912
|
| Allocating group tables:  0/11               done
| Writing inode tables:  0/11               done
| Creating journal (8192 blocks): done
| Copying files into the device: __populate_fs: ignoring entry ".bashrc"
| .bashrc: File not found by ext2_lookup while looking up ".bashrc"
| mkfs.ext4: File not found by ext2_lookup while populating file system
| WARNING: /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_ext4.160095:176
Quoted 13 lines

exit 1 from 'mkfs.$fstype -F $extra_imagecmd /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/deploy-rpb-weston-image-image-complete/rpb-weston-image-qcom-armv8a.rootfs-20240117062023.$fstype -d /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/rootfs'
| WARNING: Backtrace (BB generated script):
| #1: oe_mkext234fs,
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_ext4.160095,
line 176
| #2: do_image_ext4,
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_ext4.160095,
line 146
| #3: main, /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_ext4.160095,
line 213
NOTE: recipe rpb-weston-image-1.0-r0: task do_image_ext4: Failed

Alexander, any additional ideas on how we can debug this? So far we observe this kind of issue randomly. Vishal was able to reproduce the issue on the Ubuntu 22.04 host.
I was not able to reproduce the issue with OE-Core up to the commit e85069acf304 ("shadow: update 4.13 -> 4.14.2").

You can find full success / failure logs e.g. using the following log:
https://tuxapi.tuxsuite.com/v1/groups/linaro/projects/nicolas/plans/2ay49JMJCSuYzpqrGBP8bXqyb78

Quoted 76 lines
Quoted 63 lines

---
v2: patch only Makefiles that produce executables and libshadow.a (that executables all statically link with), do not patch libsubid/Makefile, as patching in .a linking can clash with producing dynamic libraries. libsubid is used only in getsubids executable, which is not used in setscene user management (or anywhere else from what I can see).

v3: add -no-pie to linker flags, as otherwise some host distros would refuse to link against libattr produced on other host distros and supplied via sstate (libattr made with gcc 13 and used on gcc 11/12 hosts seems to be problematic)

---
 meta/conf/distro/include/no-static-libs.inc |  5 +++++
 meta/recipes-extended/shadow/shadow.inc     | 10 ++++++++++
 2 files changed, 15 insertions(+)
meta/conf/distro/include/no-static-libs.inc +5 -0
index 75359928a14..8898d53d756 100644
@@ -21,6 +21,11 @@ DISABLE_STATIC:pn-libusb1-native = ""
 # needed by rust
 DISABLE_STATIC:pn-musl = ""
 
+# needed by shadow-native to build static executables, particularly useradd
+DISABLE_STATIC:pn-attr-native = ""
+DISABLE_STATIC:pn-libbsd-native = ""
+DISABLE_STATIC:pn-libmd-native = ""
+
 EXTRA_OECONF:append = "${DISABLE_STATIC}"
 
 EXTRA_OECMAKE:append:pn-libical = " -DSHARED_ONLY=True"
meta/recipes-extended/shadow/shadow.inc +10 -1
index c024746d4ff..43f456251a5 100644
@@ -47,6 +47,16 @@ EXTRA_OECONF += "--without-libcrack \
 
 CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
 
+# Force static linking of utilities so we can use from the sysroot/sstate for useradd
+# without worrying about the dependency libraries being available
+LDFLAGS:append:class-native = " -no-pie"
+do_compile:prepend:class-native () {
+       sed -i -e 's#\(LIBS.*\)-lbsd#\1 ${STAGING_LIBDIR}/libbsd.a ${STAGING_LIBDIR}/libmd.a#g' \
+              -e 's#\(LIBBSD.*\)-lbsd#\1 ${STAGING_LIBDIR}/libbsd.a ${STAGING_LIBDIR}/libmd.a#g' \
+              -e 's#\(LIBATTR.*\)-lattr#\1 ${STAGING_LIBDIR}/libattr.a#g' \
+               ${B}/lib/Makefile ${B}/src/Makefile
+}
+
 NSCDOPT = ""
 NSCDOPT:class-native = "--without-nscd"
 NSCDOPT:class-nativesdk = "--without-nscd"
--

2.39.2

Quoted 8 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#193543): https://lists.openembedded.org/g/openembedded-core/message/193543
Mute This Topic: https://lists.openembedded.org/mt/103661548/3618183
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

--
With best wishes
Dmitry

Signature · 2 lines
With best wishes
Dmitry
#4 lore raw

Re: [OE-core] [PATCH v3 2/2] shadow: link executables statically for -native variant

In reply to Dmitry Baryshkov
Quoted 33 lines · Dmitry Baryshkov
Quoted 7 lines · Alexander Kanavin

shadow 4.14.x adds a number of libraries it dynamically links with (md, bsd, attr). This causes troubles in setscene tasks where shadow executables are used (such as useradd), as pulling in the needed dynamic libraries needs unpleasant special-casing.

It seems, this is causing issues with the TuxOE builds. We have been observing issues with the TuxOE build environment with the image creation choking on the home dirs. Reverting this patch seems to fix the problem. The build environment is Ubuntu 20.04 running in a container on Ubuntu 22.04.

ERROR: rpb-weston-image-1.0-r0 do_image_tar:
ExecutionError('/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075', 1, None, None)
ERROR: Logfile of failure stored in:
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/log.do_image_tar.160075 Log data follows:

Quoted 4 lines

DEBUG: Executing python function set_image_size
DEBUG: 1402908.000000 = 1079160 * 1.300000
DEBUG: 1402908.000000 = max(1402908.000000, 65536)[1402908.000000] + 0
DEBUG: 1402908.000000 = int(1402908.000000)

Quoted 8 lines

DEBUG: 1404928 = aligned(1402908)
DEBUG: returning 1404928
DEBUG: Python function set_image_size finished
DEBUG: Executing shell function do_image_tar
tar: ./home/linaro/.bashrc: Unknown file type; file ignored
tar: ./home/linaro/.profile: Unknown file type; file ignored
tar: Exiting with failure status due to previous errors
WARNING: /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075:146

Quoted 2 lines

exit 1 from '[ $? -eq 1 ]'

The error is coming from tar during archive creation, "Unknown file type; file ignored". I'm a little confused/concerned about what it is seeing which it can't handle.

It might also be good to work out if that is tar from the host or tar from tar-native. Is the host's tar unable to support something we're relying upon?

If it were me, I'd probably have a look into the tar source code too, see what might trigger an error like that.

Cheers,

Richard

#5 lore raw

Re: [OE-core] [PATCH v3 2/2] shadow: link executables statically for -native variant

I'd like to clarify the 'randomly' part: does the failure disappear if you re-run bitbake on the same build directory, or is it random only between different builds? If it's deterministic in the same build directory, then you can narrow it down to the specific tar invocation directly from command line perhaps, and then try to see what is it in the tree that tar operates on, that triggers the error.

Alex

Quoted 54 lines · Richard Purdie
Quoted 33 lines · Dmitry Baryshkov
Quoted 7 lines · Alexander Kanavin

shadow 4.14.x adds a number of libraries it dynamically links with (md, bsd, attr). This causes troubles in setscene tasks where shadow executables are used (such as useradd), as pulling in the needed dynamic libraries needs unpleasant special-casing.

It seems, this is causing issues with the TuxOE builds. We have been observing issues with the TuxOE build environment with the image creation choking on the home dirs. Reverting this patch seems to fix the problem. The build environment is Ubuntu 20.04 running in a container on Ubuntu 22.04.

ERROR: rpb-weston-image-1.0-r0 do_image_tar:
ExecutionError('/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075', 1, None, None)
ERROR: Logfile of failure stored in:
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/log.do_image_tar.160075 Log data follows:

Quoted 4 lines

DEBUG: Executing python function set_image_size
DEBUG: 1402908.000000 = 1079160 * 1.300000
DEBUG: 1402908.000000 = max(1402908.000000, 65536)[1402908.000000] + 0
DEBUG: 1402908.000000 = int(1402908.000000)

Quoted 8 lines

DEBUG: 1404928 = aligned(1402908)
DEBUG: returning 1404928
DEBUG: Python function set_image_size finished
DEBUG: Executing shell function do_image_tar
tar: ./home/linaro/.bashrc: Unknown file type; file ignored
tar: ./home/linaro/.profile: Unknown file type; file ignored
tar: Exiting with failure status due to previous errors
WARNING: /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075:146

Quoted 2 lines

exit 1 from '[ $? -eq 1 ]'

The error is coming from tar during archive creation, "Unknown file type; file ignored". I'm a little confused/concerned about what it is seeing which it can't handle.

It might also be good to work out if that is tar from the host or tar from tar-native. Is the host's tar unable to support something we're relying upon?

If it were me, I'd probably have a look into the tar source code too, see what might trigger an error like that.

Cheers,

Richard

#6 lore raw

Re: [OE-core] [PATCH v3 2/2] shadow: link executables statically for -native variant

Quoted 4 lines · Alexander Kanavin

I'd like to clarify the 'randomly' part: does the failure disappear if you re-run bitbake on the same build directory, or is it random only between different builds?

It is random between different builds. Rerunning the build frequently (but not always) makes it go away.

Quoted 63 lines

If it's deterministic in the same build
directory, then you can narrow it down to the specific tar invocation directly from command line perhaps, and then try to see what is it in the tree that tar operates on, that triggers the error.

Alex

Quoted 54 lines · Richard Purdie
Quoted 33 lines · Dmitry Baryshkov
Quoted 7 lines · Alexander Kanavin

shadow 4.14.x adds a number of libraries it dynamically links with (md, bsd, attr). This causes troubles in setscene tasks where shadow executables are used (such as useradd), as pulling in the needed dynamic libraries needs unpleasant special-casing.

It seems, this is causing issues with the TuxOE builds. We have been observing issues with the TuxOE build environment with the image creation choking on the home dirs. Reverting this patch seems to fix the problem. The build environment is Ubuntu 20.04 running in a container on Ubuntu 22.04.

ERROR: rpb-weston-image-1.0-r0 do_image_tar:
ExecutionError('/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075', 1, None, None)
ERROR: Logfile of failure stored in:
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/log.do_image_tar.160075 Log data follows:

Quoted 4 lines

DEBUG: Executing python function set_image_size
DEBUG: 1402908.000000 = 1079160 * 1.300000
DEBUG: 1402908.000000 = max(1402908.000000, 65536)[1402908.000000] + 0
DEBUG: 1402908.000000 = int(1402908.000000)

Quoted 8 lines

DEBUG: 1404928 = aligned(1402908)
DEBUG: returning 1404928
DEBUG: Python function set_image_size finished
DEBUG: Executing shell function do_image_tar
tar: ./home/linaro/.bashrc: Unknown file type; file ignored
tar: ./home/linaro/.profile: Unknown file type; file ignored
tar: Exiting with failure status due to previous errors
WARNING: /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075:146

Quoted 2 lines

exit 1 from '[ $? -eq 1 ]'

The error is coming from tar during archive creation, "Unknown file type; file ignored". I'm a little confused/concerned about what it is seeing which it can't handle.

It might also be good to work out if that is tar from the host or tar from tar-native. Is the host's tar unable to support something we're relying upon?

If it were me, I'd probably have a look into the tar source code too, see what might trigger an error like that.

Cheers,

Richard

Signature · 2 lines
With best wishes
Dmitry
#7 lore raw

Re: [OE-core] [PATCH v3 2/2] shadow: link executables statically for -native variant

In reply to Richard Purdie
Quoted 42 lines · Richard Purdie
Quoted 33 lines · Dmitry Baryshkov
Quoted 7 lines · Alexander Kanavin

shadow 4.14.x adds a number of libraries it dynamically links with (md, bsd, attr). This causes troubles in setscene tasks where shadow executables are used (such as useradd), as pulling in the needed dynamic libraries needs unpleasant special-casing.

It seems, this is causing issues with the TuxOE builds. We have been observing issues with the TuxOE build environment with the image creation choking on the home dirs. Reverting this patch seems to fix the problem. The build environment is Ubuntu 20.04 running in a container on Ubuntu 22.04.

ERROR: rpb-weston-image-1.0-r0 do_image_tar:
ExecutionError('/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075', 1, None, None)
ERROR: Logfile of failure stored in:
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/log.do_image_tar.160075 Log data follows:

Quoted 4 lines

DEBUG: Executing python function set_image_size
DEBUG: 1402908.000000 = 1079160 * 1.300000
DEBUG: 1402908.000000 = max(1402908.000000, 65536)[1402908.000000] + 0
DEBUG: 1402908.000000 = int(1402908.000000)

Quoted 8 lines

DEBUG: 1404928 = aligned(1402908)
DEBUG: returning 1404928
DEBUG: Python function set_image_size finished
DEBUG: Executing shell function do_image_tar
tar: ./home/linaro/.bashrc: Unknown file type; file ignored
tar: ./home/linaro/.profile: Unknown file type; file ignored
tar: Exiting with failure status due to previous errors
WARNING: /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075:146

Quoted 2 lines

exit 1 from '[ $? -eq 1 ]'

The error is coming from tar during archive creation, "Unknown file type; file ignored". I'm a little confused/concerned about what it is seeing which it can't handle.

Quoted 6 lines

It might also be good to work out if that is tar from the host or tar from tar-native. Is the host's tar unable to support something we're relying upon?

If it were me, I'd probably have a look into the tar source code too, see what might trigger an error like that.

I compared this to the ext4 creation error. The code for __populate_fs is more easy to follow. Basically this error means that st.st_mode doesn't match S_IFCHR, S_IFBLK, S_IFREG and S_IFDIR checks. I assume the files in home dir are created by useradd in some way that bypasses pseudo. Then when tar / mkfs are executed, pseudo doesn't know about the file and returns bad st_mode through lstat().

Signature · 2 lines
With best wishes
Dmitry
#8 lore raw

Re: [OE-core] [PATCH v3 2/2] shadow: link executables statically for -native variant

Quoted 51 lines · Dmitry Baryshkov
Quoted 42 lines · Richard Purdie
Quoted 33 lines · Dmitry Baryshkov
Quoted 7 lines · Alexander Kanavin

shadow 4.14.x adds a number of libraries it dynamically links with (md, bsd, attr). This causes troubles in setscene tasks where shadow executables are used (such as useradd), as pulling in the needed dynamic libraries needs unpleasant special-casing.

It seems, this is causing issues with the TuxOE builds. We have been observing issues with the TuxOE build environment with the image creation choking on the home dirs. Reverting this patch seems to fix the problem. The build environment is Ubuntu 20.04 running in a container on Ubuntu 22.04.

ERROR: rpb-weston-image-1.0-r0 do_image_tar:
ExecutionError('/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075', 1, None, None)
ERROR: Logfile of failure stored in:
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/log.do_image_tar.160075 Log data follows:

Quoted 4 lines

DEBUG: Executing python function set_image_size
DEBUG: 1402908.000000 = 1079160 * 1.300000
DEBUG: 1402908.000000 = max(1402908.000000, 65536)[1402908.000000] + 0
DEBUG: 1402908.000000 = int(1402908.000000)

Quoted 8 lines

DEBUG: 1404928 = aligned(1402908)
DEBUG: returning 1404928
DEBUG: Python function set_image_size finished
DEBUG: Executing shell function do_image_tar
tar: ./home/linaro/.bashrc: Unknown file type; file ignored
tar: ./home/linaro/.profile: Unknown file type; file ignored
tar: Exiting with failure status due to previous errors
WARNING: /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075:146

Quoted 2 lines

exit 1 from '[ $? -eq 1 ]'

The error is coming from tar during archive creation, "Unknown file type; file ignored". I'm a little confused/concerned about what it is seeing which it can't handle.

Quoted 6 lines

It might also be good to work out if that is tar from the host or tar from tar-native. Is the host's tar unable to support something we're relying upon?

If it were me, I'd probably have a look into the tar source code too, see what might trigger an error like that.

Quoted 6 lines

I compared this to the ext4 creation error. The code for __populate_fs is more easy to follow. Basically this error means that st.st_mode doesn't match S_IFCHR, S_IFBLK, S_IFREG and S_IFDIR checks. I assume the files in home dir are created by useradd in some way that bypasses pseudo. Then when tar / mkfs are executed, pseudo doesn't know about the file and returns bad st_mode through lstat().

Files shouldn't be getting created in useradd that pseudo doesn't know about. If they are, we could be missing an intercept on some glibc function call for example.

Is this in a multiple worker setup with a shared sstate? We need to track down which OS the escape is happening on. In theory it should be reproducible. Do you have anything with a bleeding edge glibc there (e.g. gentoo)?

Cheers,

Richard

#9 lore raw

Re: [OE-core] [PATCH v3 2/2] shadow: link executables statically for -native variant

Quoted 60 lines · Richard Purdie
Quoted 51 lines · Dmitry Baryshkov
Quoted 42 lines · Richard Purdie
Quoted 33 lines · Dmitry Baryshkov
Quoted 7 lines · Alexander Kanavin

shadow 4.14.x adds a number of libraries it dynamically links with (md, bsd, attr). This causes troubles in setscene tasks where shadow executables are used (such as useradd), as pulling in the needed dynamic libraries needs unpleasant special-casing.

It seems, this is causing issues with the TuxOE builds. We have been observing issues with the TuxOE build environment with the image creation choking on the home dirs. Reverting this patch seems to fix the problem. The build environment is Ubuntu 20.04 running in a container on Ubuntu 22.04.

ERROR: rpb-weston-image-1.0-r0 do_image_tar:
ExecutionError('/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075', 1, None, None)
ERROR: Logfile of failure stored in:
/oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/log.do_image_tar.160075 Log data follows:

Quoted 4 lines

DEBUG: Executing python function set_image_size
DEBUG: 1402908.000000 = 1079160 * 1.300000
DEBUG: 1402908.000000 = max(1402908.000000, 65536)[1402908.000000] + 0
DEBUG: 1402908.000000 = int(1402908.000000)

Quoted 8 lines

DEBUG: 1404928 = aligned(1402908)
DEBUG: returning 1404928
DEBUG: Python function set_image_size finished
DEBUG: Executing shell function do_image_tar
tar: ./home/linaro/.bashrc: Unknown file type; file ignored
tar: ./home/linaro/.profile: Unknown file type; file ignored
tar: Exiting with failure status due to previous errors
WARNING: /oe/build/tmp-rpb_wayland-glibc/work/qcom_armv8a-linaro-linux/rpb-weston-image/1.0/temp/run.do_image_tar.160075:146

Quoted 2 lines

exit 1 from '[ $? -eq 1 ]'

The error is coming from tar during archive creation, "Unknown file type; file ignored". I'm a little confused/concerned about what it is seeing which it can't handle.

Quoted 6 lines

It might also be good to work out if that is tar from the host or tar from tar-native. Is the host's tar unable to support something we're relying upon?

If it were me, I'd probably have a look into the tar source code too, see what might trigger an error like that.

Quoted 6 lines

I compared this to the ext4 creation error. The code for __populate_fs is more easy to follow. Basically this error means that st.st_mode doesn't match S_IFCHR, S_IFBLK, S_IFREG and S_IFDIR checks. I assume the files in home dir are created by useradd in some way that bypasses pseudo. Then when tar / mkfs are executed, pseudo doesn't know about the file and returns bad st_mode through lstat().

Quoted 8 lines

Files shouldn't be getting created in useradd that pseudo doesn't know about. If they are, we could be missing an intercept on some glibc function call for example.

Is this in a multiple worker setup with a shared sstate? We need to track down which OS the escape is happening on. In theory it should be reproducible. Do you have anything with a bleeding edge glibc there (e.g. gentoo)?

We initially saw this on Ubuntu 20.04 inside the docker on top Ubuntu 22.04 host. Then Vishal was able to reproduce this on bare Ubuntu 22.04 host.
Bisection points to this particular patch, so I assume that static linking causes some issue here. E.g. getting one of syscalls inlined in one of these static libs, so that pseudo is no longer able to override it.

--
With best wishes
Dmitry

#10 lore raw
In reply to Alexander Kanavin

I'm seeing build failures on Ubuntu 20.04.
GCC version: 9.4.0

1. error: parameter name omitted
The problem is that the active_sessions_count function's definition lacks parameter. I did change like below:
-unsigned long active_sessions_count(const char *name, unsigned long unused)
+unsigned long active_sessions_count(const char *name, unsigned long unused unused_parameter) But then I observed another error, as shown below.

2. undefined reference to `dlsym'.

| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld: ../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_exit':
| nss.c:(.text+0x32): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld: ../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_init':
| nss.c:(.text+0x1dd): undefined reference to `dlopen'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld: nss.c:(.text+0x21c): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld: nss.c:(.text+0x237): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld: nss.c:(.text+0x253): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld: nss.c:(.text+0x365): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld: nss.c:(.text+0x3b2): undefined reference to `dlerror'
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:1130: su] Error 1

On Ubuntu22.04, there's no such issue.

Regards,
Qi

Quoted 563 lines · Alexander Kanavin

License-Update: formatting, spdx conversion

Drop:
0001-Disable-use-of-syslog-for-sysroot.patch
(issue fixed upstream)

0001-Fix-can-not-print-full-login.patch
0001-Overhaul-valid_field.patch
CVE-2023-29383.patch
(backports)

libbsd is a new native dependency, as otherwise glibc >= 2.38 is needed.

A similar fix is added to musl in order to define non-standard __BEGIN_DECLS/__END_DECLS.

---
  ...01-Disable-use-of-syslog-for-sysroot.patch |  52 -------
  .../0001-Fix-can-not-print-full-login.patch   |  41 -----
  .../files/0001-Overhaul-valid_field.patch     |  65 --------
  .../shadow/files/CVE-2023-29383.patch         |  53 -------
  .../shadow/files/CVE-2023-4641.patch          | 147 ------------------
  ...nexpected-open-failure-in-chroot-env.patch |  16 +-
  meta/recipes-extended/shadow/shadow.inc       |  20 +--
  .../{shadow_4.13.bb => shadow_4.14.2.bb}      |   0
  8 files changed, 16 insertions(+), 378 deletions(-)

delete mode 100644 meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-29383.patch
delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-4641.patch
rename meta/recipes-extended/shadow/{shadow_4.13.bb => shadow_4.14.2.bb} (100%)

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -52
deleted file mode 100644
index fa1532c8317..00000000000
@@ -1,52 +0,0 @@
-From 85d0444229ee3d14fefcf10d093f49c862826f82 Mon Sep 17 00:00:00 2001
-From: Richard Purdie <[email protected]>
-Date: Thu, 14 Apr 2022 23:11:53 +0000
-Subject: [PATCH] Disable use of syslog for shadow-native tools
-
-Disable use of syslog to prevent sysroot user and group additions from
-writing entries to the host's syslog. This patch should only be used
-with the shadow-native recipe.
-
-Upstream-Status: Inappropriate [OE specific configuration]
-Signed-off-by: Richard Purdie <[email protected]>
-Signed-off-by: Peter Kjellerstedt <[email protected]>
-
----
- configure.ac      | 2 +-
- src/login_nopam.c | 3 ++-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 924254a..603af81 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -191,7 +191,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
- 	[Path to passwd program.])
-
- dnl XXX - quick hack, should disappear before anyone notices :).
--AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
-+#AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
- if test "$ac_cv_func_ruserok" = "yes"; then
- 	AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
- 	AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
-diff --git a/src/login_nopam.c b/src/login_nopam.c
-index df6ba88..fc24e13 100644
---- a/src/login_nopam.c
-+++ b/src/login_nopam.c
-@@ -29,7 +29,6 @@
- #ifndef USE_PAM
- #ident "$Id$"
-
--#include "prototypes.h"
-     /*
-      * This module implements a simple but effective form of login access
-      * control based on login names and on host (or domain) names, internet
-@@ -57,6 +56,8 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>		/* for inet_ntoa() */
-
-+#include "prototypes.h"
-+
- #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
- #undef MAXHOSTNAMELEN
- #define MAXHOSTNAMELEN 256
meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -41
deleted file mode 100644
index 89f9c05c8d3..00000000000
@@ -1,41 +0,0 @@
-commit 670cae834827a8f794e6f7464fa57790d911b63c
-Author: SoumyaWind <[email protected]>
-Date:   Tue Dec 27 17:40:17 2022 +0530
-
-    shadow: Fix can not print full login timeout message
-
-    Login timed out message prints only first few bytes when write is immediately followed by exit.
-    Calling exit from new handler provides enough time to display full message.
-
-Upstream-Status: Backport [https://github.com/shadow-maint/shadow/commit/670cae834827a8f794e6f7464fa57790d911b63c]
-
-diff --git a/src/login.c b/src/login.c
-index 116e2cb3..c55f4de0 100644
---- a/src/login.c
-+++ b/src/login.c
-@@ -120,6 +120,7 @@ static void get_pam_user (char **ptr_pam_user);
-
- static void init_env (void);
- static void alarm_handler (int);
-+static void exit_handler (int);
-
- /*
-  * usage - print login command usage and exit
-@@ -391,11 +392,16 @@ static void init_env (void)
- #endif				/* !USE_PAM */
- }
-
-+static void exit_handler (unused int sig)
-+{
-+	_exit (0);
-+}
-
- static void alarm_handler (unused int sig)
- {
- 	write (STDERR_FILENO, tmsg, strlen (tmsg));
--	_exit (0);
-+	signal(SIGALRM, exit_handler);
-+	alarm(2);
- }
-
- #ifdef USE_PAM
meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -65
deleted file mode 100644
index ac08be515bf..00000000000
@@ -1,65 +0,0 @@
-From 2eaea70111f65b16d55998386e4ceb4273c19eb4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <[email protected]>
-Date: Fri, 31 Mar 2023 14:46:50 +0200
-Subject: [PATCH] Overhaul valid_field()
-
-e5905c4b ("Added control character check") introduced checking for
-control characters but had the logic inverted, so it rejects all
-characters that are not control ones.
-
-Cast the character to `unsigned char` before passing to the character
-checking functions to avoid UB.
-
-Use strpbrk(3) for the illegal character test and return early.
-
-Upstream-Status: Backport [https://github.com/shadow-maint/shadow/commit/2eaea70111f65b16d55998386e4ceb4273c19eb4]
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 24 ++++++++++--------------
- 1 file changed, 10 insertions(+), 14 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c
-index fb51b582..53929248 100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -37,26 +37,22 @@ int valid_field (const char *field, const char *illegal)
-
- 	/* For each character of field, search if it appears in the list
- 	 * of illegal characters. */
-+	if (illegal && NULL != strpbrk (field, illegal)) {
-+		return -1;
-+	}
-+
-+	/* Search if there are non-printable or control characters */
- 	for (cp = field; '\0' != *cp; cp++) {
--		if (strchr (illegal, *cp) != NULL) {
-+		unsigned char c = *cp;
-+		if (!isprint (c)) {
-+			err = 1;
-+		}
-+		if (iscntrl (c)) {
- 			err = -1;
- 			break;
- 		}
- 	}
-
--	if (0 == err) {
--		/* Search if there are non-printable or control characters */
--		for (cp = field; '\0' != *cp; cp++) {
--			if (!isprint (*cp)) {
--				err = 1;
--			}
--			if (!iscntrl (*cp)) {
--				err = -1;
--				break;
--			}
--		}
--	}
--
- 	return err;
- }
-
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -53
deleted file mode 100644
index f53341d3fc2..00000000000
@@ -1,53 +0,0 @@
-From e5905c4b84d4fb90aefcd96ee618411ebfac663d Mon Sep 17 00:00:00 2001
-From: tomspiderlabs <[email protected]>
-Date: Thu, 23 Mar 2023 23:39:38 +0000
-Subject: [PATCH] Added control character check
-
-Added control character check, returning -1 (to "err") if control characters are present.
-
-CVE: CVE-2023-29383
-Upstream-Status: Backport
-
-Reference to upstream:
-https://github.com/shadow-maint/shadow/commit/e5905c4b84d4fb90aefcd96ee618411ebfac663d
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c
-index 640be931..fb51b582 100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -21,9 +21,9 @@
-  *
-  * The supplied field is scanned for non-printable and other illegal
-  * characters.
-- *  + -1 is returned if an illegal character is present.
-- *  +  1 is returned if no illegal characters are present, but the field
-- *       contains a non-printable character.
-+ *  + -1 is returned if an illegal or control character is present.
-+ *  +  1 is returned if no illegal or control characters are present,
-+ *       but the field contains a non-printable character.
-  *  +  0 is returned otherwise.
-  */
- int valid_field (const char *field, const char *illegal)
-@@ -45,10 +45,13 @@ int valid_field (const char *field, const char *illegal)
- 	}
-
- 	if (0 == err) {
--		/* Search if there are some non-printable characters */
-+		/* Search if there are non-printable or control characters */
- 		for (cp = field; '\0' != *cp; cp++) {
- 			if (!isprint (*cp)) {
- 				err = 1;
-+			}
-+			if (!iscntrl (*cp)) {
-+				err = -1;
- 				break;
- 			}
- 		}
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -147
deleted file mode 100644
index 1fabfe928e4..00000000000
@@ -1,147 +0,0 @@
-From 25dbe2ce166a13322b7536ff2f738786ea2e61e7 Mon Sep 17 00:00:00 2001
-From: Alejandro Colomar <[email protected]>
-Date: Sat, 10 Jun 2023 16:20:05 +0200
-Subject: [PATCH] gpasswd(1): Fix password leak
-
-How to trigger this password leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When gpasswd(1) asks for the new password, it asks twice (as is usual
-for confirming the new password).  Each of those 2 password prompts
-uses agetpass() to get the password.  If the second agetpass() fails,
-the first password, which has been copied into the 'static' buffer
-'pass' via STRFCPY(), wasn't being zeroed.
-
-agetpass() is defined in <./libmisc/agetpass.c> (around line 91), and
-can fail for any of the following reasons:
-
--  malloc(3) or readpassphrase(3) failure.
-
-   These are going to be difficult to trigger.  Maybe getting the system
-   to the limits of memory utilization at that exact point, so that the
-   next malloc(3) gets ENOMEM, and possibly even the OOM is triggered.
-   About readpassphrase(3), ENFILE and EINTR seem the only plausible
-   ones, and EINTR probably requires privilege or being the same user;
-   but I wouldn't discard ENFILE so easily, if a process starts opening
-   files.
-
--  The password is longer than PASS_MAX.
-
-   The is plausible with physical access.  However, at that point, a
-   keylogger will be a much simpler attack.
-
-And, the attacker must be able to know when the second password is being
-introduced, which is not going to be easy.
-
-How to read the password after the leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Provoking the leak yourself at the right point by entering a very long
-password is easy, and inspecting the process stack at that point should
-be doable.  Try to find some consistent patterns.
-
-Then, search for those patterns in free memory, right after the victim
-leaks their password.
-
-Once you get the leak, a program should read all the free memory
-searching for patterns that gpasswd(1) leaves nearby the leaked
-password.
-
-On 6/10/23 03:14, Seth Arnold wrote:
-> An attacker process wouldn't be able to use malloc(3) for this task.
-> There's a handful of tools available for userspace to allocate memory:
->
-> -  brk / sbrk
-> -  mmap MAP_ANONYMOUS
-> -  mmap /dev/zero
-> -  mmap some other file
-> -  shm_open
-> -  shmget
->
-> Most of these return only pages of zeros to a process.  Using mmap of an
-> existing file, you can get some of the contents of the file demand-loaded
-> into the memory space on the first use.
->
-> The MAP_UNINITIALIZED flag only works if the kernel was compiled with
-> CONFIG_MMAP_ALLOW_UNINITIALIZED.  This is rare.
->
-> malloc(3) doesn't zero memory, to our collective frustration, but all the
-> garbage in the allocations is from previous allocations in the current
-> process.  It isn't leftover from other processes.
->
-> The avenues available for reading the memory:
-> -  /dev/mem and /dev/kmem (requires root, not available with Secure Boot)
-> -  /proc/pid/mem (requires ptrace privileges, mediated by YAMA)
-> -  ptrace (requires ptrace privileges, mediated by YAMA)
-> -  causing memory to be swapped to disk, and then inspecting the swap
->
-> These all require a certain amount of privileges.
-
-How to fix it?
-~~~~~~~~~~~~~~
-
-memzero(), which internally calls explicit_bzero(3), or whatever
-alternative the system provides with a slightly different name, will
-make sure that the buffer is zeroed in memory, and optimizations are not
-allowed to impede this zeroing.
-
-This is not really 100% effective, since compilers may place copies of
-the string somewhere hidden in the stack.  Those copies won't get zeroed
-by explicit_bzero(3).  However, that's arguably a compiler bug, since
-compilers should make everything possible to avoid optimizing strings
-that are later passed to explicit_bzero(3).  But we all know that
-sometimes it's impossible to have perfect knowledge in the compiler, so
-this is plausible.  Nevertheless, there's nothing we can do against such
-issues, except minimizing the time such passwords are stored in plain
-text.
-
-Security concerns
-~~~~~~~~~~~~~~~~~
-
-We believe this isn't easy to exploit.  Nevertheless, and since the fix
-is trivial, this fix should probably be applied soon, and backported to
-all supported distributions, to prevent someone else having more
-imagination than us to find a way.
-
-Affected versions
-~~~~~~~~~~~~~~~~~
-
-All.  Bug introduced in shadow 19990709.  That's the second commit in
-the git history.
-
-Fixes: 45c6603cc86c ("[svn-upgrade] Integrating new upstream version, shadow (19990709)")
-
-CVE: CVE-2023-4641
-Upstream-Status: Backport [https://github.com/shadow-maint/shadow/commit/65c88a43a23c2391dcc90c0abda3e839e9c57904]
-
-Reported-by: Alejandro Colomar <[email protected]>
-Cc: Serge Hallyn <[email protected]>
-Cc: Iker Pedrosa <[email protected]>
-Cc: Seth Arnold <[email protected]>
-Cc: Christian Brauner <[email protected]>
-Cc: Balint Reczey <[email protected]>
-Cc: Sam James <[email protected]>
-Cc: David Runge <[email protected]>
-Cc: Andreas Jaeger <[email protected]>
-Cc: <~hallyn/[email protected]>
-Signed-off-by: Alejandro Colomar <[email protected]>
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- src/gpasswd.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/gpasswd.c b/src/gpasswd.c
-index 5983f787..2d8869ef 100644
---- a/src/gpasswd.c
-+++ b/src/gpasswd.c
-@@ -896,6 +896,7 @@ static void change_passwd (struct group *gr)
- 		strzero (cp);
- 		cp = getpass (_("Re-enter new password: "));
- 		if (NULL == cp) {
-+			memzero (pass, sizeof pass);
- 			exit (1);
- 		}
-
---
-2.34.1
-
meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch +9 -7
index 85d91751056..4a932d2dbb1 100644
@@ -1,4 +1,4 @@
-From 21583da072aa66901d859ac00ce209bac87ddecc Mon Sep 17 00:00:00 2001
+From a773c6b240d27e23d6be41decef0edf24fcee523 Mon Sep 17 00:00:00 2001
  From: Chen Qi <[email protected]>
  Date: Thu, 17 Jul 2014 15:53:34 +0800
  Subject: [PATCH] commonio.c-fix-unexpected-open-failure-in-chroot-env
@@ -15,35 +15,37 @@ Note that this patch doesn't change the logic in the code, it just expands
  the codes.
 
  Signed-off-by: Chen Qi <[email protected]>
-
  ---
   lib/commonio.c | 16 ++++++++++++----
   1 file changed, 12 insertions(+), 4 deletions(-)
 
  diff --git a/lib/commonio.c b/lib/commonio.c
-index 9a02ce1..61384ec 100644
+index 73fdb3a..d1231e9 100644
  --- a/lib/commonio.c
  +++ b/lib/commonio.c
-@@ -616,10 +616,18 @@ int commonio_open (struct commonio_db *db, int mode)
+@@ -606,10 +606,18 @@ int commonio_open (struct commonio_db *db, int mode)
   	db->cursor = NULL;
   	db->changed = false;
 
  -	fd = open (db->filename,
  -	             (db->readonly ? O_RDONLY : O_RDWR)
--	           | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
+-	           | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);
  -	saved_errno = errno;
  +	if (db->readonly) {
  +		fd = open (db->filename,
  +			   (true ? O_RDONLY : O_RDWR)
-+			   | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++			   | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);
  +		saved_errno = errno;
  +	} else {
  +		fd = open (db->filename,
  +			   (false ? O_RDONLY : O_RDWR)
-+			   | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++			   | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW| O_CLOEXEC);
  +		saved_errno = errno;
  +	}
  +
   	db->fp = NULL;
   	if (fd >= 0) {
   #ifdef WITH_TCB
+--
+2.30.2
+
meta/recipes-extended/shadow/shadow.inc +7 -13
index ce3ce627156..c024746d4ff 100644
@@ -5,7 +5,7 @@ BUGTRACKER = "http://github.com/shadow-maint/shadow/issues"
  SECTION = "base/utils"
  LICENSE = "BSD-3-Clause"
  LIC_FILES_CHKSUM = "file://COPYING;md5=c9a450b7be84eac23e6353efecb60b5b \
-                    file://src/passwd.c;beginline=2;endline=30;md5=758c26751513b6795395275969dd3be1 \
+                    file://src/passwd.c;beginline=2;endline=7;md5=67bcf314687820b2f010d4863fce3fc5 \
                      "
 
  DEPENDS = "virtual/crypt"
@@ -14,10 +14,6 @@ GITHUB_BASE_URI = "https://github.com/shadow-maint/shadow/releases"
  SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
             ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
             file://useradd \
-	   file://0001-Fix-can-not-print-full-login.patch \
-           file://CVE-2023-29383.patch \
-           file://0001-Overhaul-valid_field.patch \
-           file://CVE-2023-4641.patch \
             "
 
  SRC_URI:append:class-target = " \
@@ -26,14 +22,9 @@ SRC_URI:append:class-target = " \
             "
 
  SRC_URI:append:class-native = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
             file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
             "
-SRC_URI:append:class-nativesdk = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
-           "
-SRC_URI[sha256sum] = "813057047499c7fe81108adcf0cffa3ad4ec75e19a80151f9cbaa458ff2e86cd"
-
+SRC_URI[sha256sum] = "a305edf5d19bddbdf5e836d2d609fa8bff2d35458819de4d9f06306a1cf24342"
 
  # Additional Policy files for PAM
  PAM_SRC_URI = "file://pam.d/chfn \
@@ -44,7 +35,7 @@ PAM_SRC_URI = "file://pam.d/chfn \
                 file://pam.d/passwd \
                 file://pam.d/su"
 
-inherit autotools gettext github-releases
+inherit autotools gettext github-releases pkgconfig
 
  export CONFIG_SHELL="/bin/sh"
 
@@ -54,6 +45,8 @@ EXTRA_OECONF += "--without-libcrack \
                   --without-sssd \
                   ${NSCDOPT}"
 
+CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
+
  NSCDOPT = ""
  NSCDOPT:class-native = "--without-nscd"
  NSCDOPT:class-nativesdk = "--without-nscd"
@@ -73,13 +66,14 @@ PAM_PLUGINS = "libpam-runtime \
 
  PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
                     ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
-PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
+PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} libbsd"
  PACKAGECONFIG:class-nativesdk = ""
  PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
  PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
  PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl"
  PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit"
  PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage"
+PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"
 
  RDEPENDS:${PN} = "shadow-securetty \
                    base-passwd \
meta/recipes-extended/shadow/shadow_4.14.2.bb renamed from meta/recipes-extended/shadow/shadow_4.13.bb +0 -1
similarity index 100%
rename from meta/recipes-extended/shadow/shadow_4.13.bb
rename to meta/recipes-extended/shadow/shadow_4.14.2.bb
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#193542): https://lists.openembedded.org/g/openembedded-core/message/193542
Mute This Topic: https://lists.openembedded.org/mt/103661547/7304865
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#11 lore raw

I just tried poky master on ubuntu 20.04, and the issues do not appear. Do you have a custom setup?

Alex

Quoted 602 lines · ChenQi

I'm seeing build failures on Ubuntu 20.04.
GCC version: 9.4.0

1. error: parameter name omitted
The problem is that the active_sessions_count function's definition lacks parameter. I did change like below:

(quoted diff) +1 -1
-unsigned long active_sessions_count(const char *name, unsigned long unused)
+unsigned long active_sessions_count(const char *name, unsigned long

unused unused_parameter)
But then I observed another error, as shown below.

2. undefined reference to `dlsym'.
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_exit':
| nss.c:(.text+0x32): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_init':
| nss.c:(.text+0x1dd): undefined reference to `dlopen'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x21c): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x237): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x253): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x365): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x3b2): undefined reference to `dlerror'
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:1130: su] Error 1

On Ubuntu22.04, there's no such issue.

Regards,
Qi

Quoted 563 lines · Alexander Kanavin

License-Update: formatting, spdx conversion

Drop:
0001-Disable-use-of-syslog-for-sysroot.patch
(issue fixed upstream)

0001-Fix-can-not-print-full-login.patch
0001-Overhaul-valid_field.patch
CVE-2023-29383.patch
(backports)

libbsd is a new native dependency, as otherwise glibc >= 2.38 is needed.

A similar fix is added to musl in order to define non-standard __BEGIN_DECLS/__END_DECLS.

---
  ...01-Disable-use-of-syslog-for-sysroot.patch |  52 -------
  .../0001-Fix-can-not-print-full-login.patch   |  41 -----
  .../files/0001-Overhaul-valid_field.patch     |  65 --------
  .../shadow/files/CVE-2023-29383.patch         |  53 -------
  .../shadow/files/CVE-2023-4641.patch          | 147 ------------------
  ...nexpected-open-failure-in-chroot-env.patch |  16 +-
  meta/recipes-extended/shadow/shadow.inc       |  20 +--
  .../{shadow_4.13.bb => shadow_4.14.2.bb}      |   0
  8 files changed, 16 insertions(+), 378 deletions(-)

delete mode 100644 meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-29383.patch
delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-4641.patch
rename meta/recipes-extended/shadow/{shadow_4.13.bb => shadow_4.14.2.bb} (100%)

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -52
deleted file mode 100644
index fa1532c8317..00000000000
@@ -1,52 +0,0 @@
-From 85d0444229ee3d14fefcf10d093f49c862826f82 Mon Sep 17 00:00:00 2001
-From: Richard Purdie <[email protected]>
-Date: Thu, 14 Apr 2022 23:11:53 +0000
-Subject: [PATCH] Disable use of syslog for shadow-native tools
-
-Disable use of syslog to prevent sysroot user and group additions from
-writing entries to the host's syslog. This patch should only be used
-with the shadow-native recipe.
-
-Upstream-Status: Inappropriate [OE specific configuration]
-Signed-off-by: Richard Purdie <[email protected]>
-Signed-off-by: Peter Kjellerstedt <[email protected]>
-
----
- configure.ac      | 2 +-
- src/login_nopam.c | 3 ++-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 924254a..603af81 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -191,7 +191,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
-     [Path to passwd program.])
-
- dnl XXX - quick hack, should disappear before anyone notices :).
--AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
-+#AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
- if test "$ac_cv_func_ruserok" = "yes"; then
-     AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
-     AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
-diff --git a/src/login_nopam.c b/src/login_nopam.c
-index df6ba88..fc24e13 100644
---- a/src/login_nopam.c
-+++ b/src/login_nopam.c
-@@ -29,7 +29,6 @@
- #ifndef USE_PAM
- #ident "$Id$"
-
--#include "prototypes.h"
-     /*
-      * This module implements a simple but effective form of login access
-      * control based on login names and on host (or domain) names, internet
-@@ -57,6 +56,8 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>              /* for inet_ntoa() */
-
-+#include "prototypes.h"
-+
- #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
- #undef MAXHOSTNAMELEN
- #define MAXHOSTNAMELEN 256
meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -41
deleted file mode 100644
index 89f9c05c8d3..00000000000
@@ -1,41 +0,0 @@
-commit 670cae834827a8f794e6f7464fa57790d911b63c
-Author: SoumyaWind <[email protected]>
-Date:   Tue Dec 27 17:40:17 2022 +0530
-
-    shadow: Fix can not print full login timeout message
-
-    Login timed out message prints only first few bytes when write is immediately followed by exit.
-    Calling exit from new handler provides enough time to display full message.
-
-Upstream-Status: Backport [https://github.com/shadow-maint/shadow/commit/670cae834827a8f794e6f7464fa57790d911b63c]
-
-diff --git a/src/login.c b/src/login.c
-index 116e2cb3..c55f4de0 100644
---- a/src/login.c
-+++ b/src/login.c
-@@ -120,6 +120,7 @@ static void get_pam_user (char **ptr_pam_user);
-
- static void init_env (void);
- static void alarm_handler (int);
-+static void exit_handler (int);
-
- /*
-  * usage - print login command usage and exit
-@@ -391,11 +392,16 @@ static void init_env (void)
- #endif                              /* !USE_PAM */
- }
-
-+static void exit_handler (unused int sig)
-+{
-+    _exit (0);
-+}
-
- static void alarm_handler (unused int sig)
- {
-     write (STDERR_FILENO, tmsg, strlen (tmsg));
--    _exit (0);
-+    signal(SIGALRM, exit_handler);
-+    alarm(2);
- }
-
- #ifdef USE_PAM
meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -65
deleted file mode 100644
index ac08be515bf..00000000000
@@ -1,65 +0,0 @@
-From 2eaea70111f65b16d55998386e4ceb4273c19eb4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <[email protected]>
-Date: Fri, 31 Mar 2023 14:46:50 +0200
-Subject: [PATCH] Overhaul valid_field()
-
-e5905c4b ("Added control character check") introduced checking for
-control characters but had the logic inverted, so it rejects all
-characters that are not control ones.
-
-Cast the character to `unsigned char` before passing to the character
-checking functions to avoid UB.
-
-Use strpbrk(3) for the illegal character test and return early.
-
-Upstream-Status: Backport [https://github.com/shadow-maint/shadow/commit/2eaea70111f65b16d55998386e4ceb4273c19eb4]
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 24 ++++++++++--------------
- 1 file changed, 10 insertions(+), 14 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c
-index fb51b582..53929248 100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -37,26 +37,22 @@ int valid_field (const char *field, const char *illegal)
-
-     /* For each character of field, search if it appears in the list
-      * of illegal characters. */
-+    if (illegal && NULL != strpbrk (field, illegal)) {
-+            return -1;
-+    }
-+
-+    /* Search if there are non-printable or control characters */
-     for (cp = field; '\0' != *cp; cp++) {
--            if (strchr (illegal, *cp) != NULL) {
-+            unsigned char c = *cp;
-+            if (!isprint (c)) {
-+                    err = 1;
-+            }
-+            if (iscntrl (c)) {
-                     err = -1;
-                     break;
-             }
-     }
-
--    if (0 == err) {
--            /* Search if there are non-printable or control characters */
--            for (cp = field; '\0' != *cp; cp++) {
--                    if (!isprint (*cp)) {
--                            err = 1;
--                    }
--                    if (!iscntrl (*cp)) {
--                            err = -1;
--                            break;
--                    }
--            }
--    }
--
-     return err;
- }
-
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -53
deleted file mode 100644
index f53341d3fc2..00000000000
@@ -1,53 +0,0 @@
-From e5905c4b84d4fb90aefcd96ee618411ebfac663d Mon Sep 17 00:00:00 2001
-From: tomspiderlabs <[email protected]>
-Date: Thu, 23 Mar 2023 23:39:38 +0000
-Subject: [PATCH] Added control character check
-
-Added control character check, returning -1 (to "err") if control characters are present.
-
-CVE: CVE-2023-29383
-Upstream-Status: Backport
-
-Reference to upstream:
-https://github.com/shadow-maint/shadow/commit/e5905c4b84d4fb90aefcd96ee618411ebfac663d
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c
-index 640be931..fb51b582 100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -21,9 +21,9 @@
-  *
-  * The supplied field is scanned for non-printable and other illegal
-  * characters.
-- *  + -1 is returned if an illegal character is present.
-- *  +  1 is returned if no illegal characters are present, but the field
-- *       contains a non-printable character.
-+ *  + -1 is returned if an illegal or control character is present.
-+ *  +  1 is returned if no illegal or control characters are present,
-+ *       but the field contains a non-printable character.
-  *  +  0 is returned otherwise.
-  */
- int valid_field (const char *field, const char *illegal)
-@@ -45,10 +45,13 @@ int valid_field (const char *field, const char *illegal)
-     }
-
-     if (0 == err) {
--            /* Search if there are some non-printable characters */
-+            /* Search if there are non-printable or control characters */
-             for (cp = field; '\0' != *cp; cp++) {
-                     if (!isprint (*cp)) {
-                             err = 1;
-+                    }
-+                    if (!iscntrl (*cp)) {
-+                            err = -1;
-                             break;
-                     }
-             }
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -147
deleted file mode 100644
index 1fabfe928e4..00000000000
@@ -1,147 +0,0 @@
-From 25dbe2ce166a13322b7536ff2f738786ea2e61e7 Mon Sep 17 00:00:00 2001
-From: Alejandro Colomar <[email protected]>
-Date: Sat, 10 Jun 2023 16:20:05 +0200
-Subject: [PATCH] gpasswd(1): Fix password leak
-
-How to trigger this password leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When gpasswd(1) asks for the new password, it asks twice (as is usual
-for confirming the new password).  Each of those 2 password prompts
-uses agetpass() to get the password.  If the second agetpass() fails,
-the first password, which has been copied into the 'static' buffer
-'pass' via STRFCPY(), wasn't being zeroed.
-
-agetpass() is defined in <./libmisc/agetpass.c> (around line 91), and
-can fail for any of the following reasons:
-
--  malloc(3) or readpassphrase(3) failure.
-
-   These are going to be difficult to trigger.  Maybe getting the system
-   to the limits of memory utilization at that exact point, so that the
-   next malloc(3) gets ENOMEM, and possibly even the OOM is triggered.
-   About readpassphrase(3), ENFILE and EINTR seem the only plausible
-   ones, and EINTR probably requires privilege or being the same user;
-   but I wouldn't discard ENFILE so easily, if a process starts opening
-   files.
-
--  The password is longer than PASS_MAX.
-
-   The is plausible with physical access.  However, at that point, a
-   keylogger will be a much simpler attack.
-
-And, the attacker must be able to know when the second password is being
-introduced, which is not going to be easy.
-
-How to read the password after the leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Provoking the leak yourself at the right point by entering a very long
-password is easy, and inspecting the process stack at that point should
-be doable.  Try to find some consistent patterns.
-
-Then, search for those patterns in free memory, right after the victim
-leaks their password.
-
-Once you get the leak, a program should read all the free memory
-searching for patterns that gpasswd(1) leaves nearby the leaked
-password.
-
-On 6/10/23 03:14, Seth Arnold wrote:
-> An attacker process wouldn't be able to use malloc(3) for this task.
-> There's a handful of tools available for userspace to allocate memory:
->
-> -  brk / sbrk
-> -  mmap MAP_ANONYMOUS
-> -  mmap /dev/zero
-> -  mmap some other file
-> -  shm_open
-> -  shmget
->
-> Most of these return only pages of zeros to a process.  Using mmap of an
-> existing file, you can get some of the contents of the file demand-loaded
-> into the memory space on the first use.
->
-> The MAP_UNINITIALIZED flag only works if the kernel was compiled with
-> CONFIG_MMAP_ALLOW_UNINITIALIZED.  This is rare.
->
-> malloc(3) doesn't zero memory, to our collective frustration, but all the
-> garbage in the allocations is from previous allocations in the current
-> process.  It isn't leftover from other processes.
->
-> The avenues available for reading the memory:
-> -  /dev/mem and /dev/kmem (requires root, not available with Secure Boot)
-> -  /proc/pid/mem (requires ptrace privileges, mediated by YAMA)
-> -  ptrace (requires ptrace privileges, mediated by YAMA)
-> -  causing memory to be swapped to disk, and then inspecting the swap
->
-> These all require a certain amount of privileges.
-
-How to fix it?
-~~~~~~~~~~~~~~
-
-memzero(), which internally calls explicit_bzero(3), or whatever
-alternative the system provides with a slightly different name, will
-make sure that the buffer is zeroed in memory, and optimizations are not
-allowed to impede this zeroing.
-
-This is not really 100% effective, since compilers may place copies of
-the string somewhere hidden in the stack.  Those copies won't get zeroed
-by explicit_bzero(3).  However, that's arguably a compiler bug, since
-compilers should make everything possible to avoid optimizing strings
-that are later passed to explicit_bzero(3).  But we all know that
-sometimes it's impossible to have perfect knowledge in the compiler, so
-this is plausible.  Nevertheless, there's nothing we can do against such
-issues, except minimizing the time such passwords are stored in plain
-text.
-
-Security concerns
-~~~~~~~~~~~~~~~~~
-
-We believe this isn't easy to exploit.  Nevertheless, and since the fix
-is trivial, this fix should probably be applied soon, and backported to
-all supported distributions, to prevent someone else having more
-imagination than us to find a way.
-
-Affected versions
-~~~~~~~~~~~~~~~~~
-
-All.  Bug introduced in shadow 19990709.  That's the second commit in
-the git history.
-
-Fixes: 45c6603cc86c ("[svn-upgrade] Integrating new upstream version, shadow (19990709)")
-
-CVE: CVE-2023-4641
-Upstream-Status: Backport [https://github.com/shadow-maint/shadow/commit/65c88a43a23c2391dcc90c0abda3e839e9c57904]
-
-Reported-by: Alejandro Colomar <[email protected]>
-Cc: Serge Hallyn <[email protected]>
-Cc: Iker Pedrosa <[email protected]>
-Cc: Seth Arnold <[email protected]>
-Cc: Christian Brauner <[email protected]>
-Cc: Balint Reczey <[email protected]>
-Cc: Sam James <[email protected]>
-Cc: David Runge <[email protected]>
-Cc: Andreas Jaeger <[email protected]>
-Cc: <~hallyn/[email protected]>
-Signed-off-by: Alejandro Colomar <[email protected]>
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- src/gpasswd.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/gpasswd.c b/src/gpasswd.c
-index 5983f787..2d8869ef 100644
---- a/src/gpasswd.c
-+++ b/src/gpasswd.c
-@@ -896,6 +896,7 @@ static void change_passwd (struct group *gr)
-             strzero (cp);
-             cp = getpass (_("Re-enter new password: "));
-             if (NULL == cp) {
-+                    memzero (pass, sizeof pass);
-                     exit (1);
-             }
-
---
-2.34.1
-
meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch +9 -7
index 85d91751056..4a932d2dbb1 100644
@@ -1,4 +1,4 @@
-From 21583da072aa66901d859ac00ce209bac87ddecc Mon Sep 17 00:00:00 2001
+From a773c6b240d27e23d6be41decef0edf24fcee523 Mon Sep 17 00:00:00 2001
  From: Chen Qi <[email protected]>
  Date: Thu, 17 Jul 2014 15:53:34 +0800
  Subject: [PATCH] commonio.c-fix-unexpected-open-failure-in-chroot-env
@@ -15,35 +15,37 @@ Note that this patch doesn't change the logic in the code, it just expands
  the codes.
 
  Signed-off-by: Chen Qi <[email protected]>
-
  ---
   lib/commonio.c | 16 ++++++++++++----
   1 file changed, 12 insertions(+), 4 deletions(-)
 
  diff --git a/lib/commonio.c b/lib/commonio.c
-index 9a02ce1..61384ec 100644
+index 73fdb3a..d1231e9 100644
  --- a/lib/commonio.c
  +++ b/lib/commonio.c
-@@ -616,10 +616,18 @@ int commonio_open (struct commonio_db *db, int mode)
+@@ -606,10 +606,18 @@ int commonio_open (struct commonio_db *db, int mode)
      db->cursor = NULL;
      db->changed = false;
 
  -   fd = open (db->filename,
  -                (db->readonly ? O_RDONLY : O_RDWR)
--               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
+-               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);
  -   saved_errno = errno;
  +   if (db->readonly) {
  +           fd = open (db->filename,
  +                      (true ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);
  +           saved_errno = errno;
  +   } else {
  +           fd = open (db->filename,
  +                      (false ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW| O_CLOEXEC);
  +           saved_errno = errno;
  +   }
  +
      db->fp = NULL;
      if (fd >= 0) {
   #ifdef WITH_TCB
+--
+2.30.2
+
meta/recipes-extended/shadow/shadow.inc +7 -13
index ce3ce627156..c024746d4ff 100644
@@ -5,7 +5,7 @@ BUGTRACKER = "http://github.com/shadow-maint/shadow/issues"
  SECTION = "base/utils"
  LICENSE = "BSD-3-Clause"
  LIC_FILES_CHKSUM = "file://COPYING;md5=c9a450b7be84eac23e6353efecb60b5b \
-                    file://src/passwd.c;beginline=2;endline=30;md5=758c26751513b6795395275969dd3be1 \
+                    file://src/passwd.c;beginline=2;endline=7;md5=67bcf314687820b2f010d4863fce3fc5 \
                      "
 
  DEPENDS = "virtual/crypt"
@@ -14,10 +14,6 @@ GITHUB_BASE_URI = "https://github.com/shadow-maint/shadow/releases"
  SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
             ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
             file://useradd \
-        file://0001-Fix-can-not-print-full-login.patch \
-           file://CVE-2023-29383.patch \
-           file://0001-Overhaul-valid_field.patch \
-           file://CVE-2023-4641.patch \
             "
 
  SRC_URI:append:class-target = " \
@@ -26,14 +22,9 @@ SRC_URI:append:class-target = " \
             "
 
  SRC_URI:append:class-native = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
             file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
             "
-SRC_URI:append:class-nativesdk = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
-           "
-SRC_URI[sha256sum] = "813057047499c7fe81108adcf0cffa3ad4ec75e19a80151f9cbaa458ff2e86cd"
-
+SRC_URI[sha256sum] = "a305edf5d19bddbdf5e836d2d609fa8bff2d35458819de4d9f06306a1cf24342"
 
  # Additional Policy files for PAM
  PAM_SRC_URI = "file://pam.d/chfn \
@@ -44,7 +35,7 @@ PAM_SRC_URI = "file://pam.d/chfn \
                 file://pam.d/passwd \
                 file://pam.d/su"
 
-inherit autotools gettext github-releases
+inherit autotools gettext github-releases pkgconfig
 
  export CONFIG_SHELL="/bin/sh"
 
@@ -54,6 +45,8 @@ EXTRA_OECONF += "--without-libcrack \
                   --without-sssd \
                   ${NSCDOPT}"
 
+CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
+
  NSCDOPT = ""
  NSCDOPT:class-native = "--without-nscd"
  NSCDOPT:class-nativesdk = "--without-nscd"
@@ -73,13 +66,14 @@ PAM_PLUGINS = "libpam-runtime \
 
  PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
                     ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
-PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
+PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} libbsd"
  PACKAGECONFIG:class-nativesdk = ""
  PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
  PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
  PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl"
  PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit"
  PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage"
+PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"
 
  RDEPENDS:${PN} = "shadow-securetty \
                    base-passwd \
meta/recipes-extended/shadow/shadow_4.14.2.bb renamed from meta/recipes-extended/shadow/shadow_4.13.bb +0 -1
similarity index 100%
rename from meta/recipes-extended/shadow/shadow_4.13.bb
rename to meta/recipes-extended/shadow/shadow_4.14.2.bb
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#193542): https://lists.openembedded.org/g/openembedded-core/message/193542
Mute This Topic: https://lists.openembedded.org/mt/103661547/7304865
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#12 lore raw
Quoted 2 lines · Alexander Kanavin

I just tried poky master on ubuntu 20.04, and the issues do not appear. Do you have a custom setup?

There is another report about issues from the shadow static linking change.

I'm worried that there are now accesses to files with are out of sight of pseudo so that some combinations of builds are breaking. I'd forgotten about pseudo in the push to fix the various sstate issues. It is worrying we don't have good test cases for these.

I've also been thinking about how we could solve it. My proposal is that we go back to dyanmic linking, however we add copies of the libs we need into the shadow-native populate_sysroot sstate/sysroot output in a special directory and we add that directory to the shadow binaries as a RUNPATH/RPATH.

Cheers,

Richard

#13 lore raw
Quoted 8 lines · Richard Purdie

There is another report about issues from the shadow static linking change.

I'm worried that there are now accesses to files with are out of sight of pseudo so that some combinations of builds are breaking. I'd forgotten about pseudo in the push to fix the various sstate issues. It is worrying we don't have good test cases for these.

Quoted 5 lines

I've also been thinking about how we could solve it. My proposal is that we go back to dyanmic linking, however we add copies of the libs we need into the shadow-native populate_sysroot sstate/sysroot output in a special directory and we add that directory to the shadow binaries as a RUNPATH/RPATH.

Sounds good. I'll make a patch for this.

Static linking in C world is something of an 'obsolete technology', it isn't tested or supported by anyone really.

Alex

#14 lore raw
In reply to Alexander Kanavin

I didn't do anything particular, but as several people are sharing the server, it's possible that its environment is somewhat messed up. I'll check more and fix the environment. Thanks for your double check.

Regards,
Qi

-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Friday, January 19, 2024 6:12 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]; Alexander Kanavin <[email protected]>
Subject: Re: [OE-core] [PATCH v3 1/2] shadow: update 4.13 -> 4.14.2

I just tried poky master on ubuntu 20.04, and the issues do not appear. Do you have a custom setup?

Alex

Quoted 659 lines · ChenQi

I'm seeing build failures on Ubuntu 20.04.
GCC version: 9.4.0

1. error: parameter name omitted
The problem is that the active_sessions_count function's definition lacks parameter. I did change like below:
-unsigned long active_sessions_count(const char *name, unsigned long unused)
+unsigned long active_sessions_count(const char *name, unsigned long unused unused_parameter)
But then I observed another error, as shown below.

2. undefined reference to `dlsym'.
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_exit':
| nss.c:(.text+0x32): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_init':
| nss.c:(.text+0x1dd): undefined reference to `dlopen'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x21c): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x237): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x253): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x365): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x3b2): undefined reference to `dlerror'
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:1130: su] Error 1

On Ubuntu22.04, there's no such issue.

Regards,
Qi

Quoted 619 lines · Alexander Kanavin

License-Update: formatting, spdx conversion

Drop:
0001-Disable-use-of-syslog-for-sysroot.patch
(issue fixed upstream)

0001-Fix-can-not-print-full-login.patch
0001-Overhaul-valid_field.patch
CVE-2023-29383.patch
(backports)

libbsd is a new native dependency, as otherwise glibc >= 2.38 is needed.

A similar fix is added to musl in order to define non-standard __BEGIN_DECLS/__END_DECLS.

---
  ...01-Disable-use-of-syslog-for-sysroot.patch |  52 -------
  .../0001-Fix-can-not-print-full-login.patch   |  41 -----
  .../files/0001-Overhaul-valid_field.patch     |  65 --------
  .../shadow/files/CVE-2023-29383.patch         |  53 -------
  .../shadow/files/CVE-2023-4641.patch          | 147 ------------------
  ...nexpected-open-failure-in-chroot-env.patch |  16 +-
  meta/recipes-extended/shadow/shadow.inc       |  20 +--
  .../{shadow_4.13.bb => shadow_4.14.2.bb}      |   0
  8 files changed, 16 insertions(+), 378 deletions(-)

delete mode 100644 meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-29383.patch
delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-4641.patch
rename meta/recipes-extended/shadow/{shadow_4.13.bb =>
shadow_4.14.2.bb} (100%)

(quoted diff) +0 -0

a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch b/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch
deleted file mode 100644
index fa1532c8317..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch
+++ /dev/null

(quoted diff) +0 -1
@@ -1,52 +0,0 @@
-From 85d0444229ee3d14fefcf10d093f49c862826f82 Mon Sep 17 00:00:00 

2001

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -5
-From: Richard Purdie <[email protected]>
-Date: Thu, 14 Apr 2022 23:11:53 +0000
-Subject: [PATCH] Disable use of syslog for shadow-native tools
-
-Disable use of syslog to prevent sysroot user and group additions 

from -writing entries to the host's syslog. This patch should only be used -with the shadow-native recipe.

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -11
-
-Upstream-Status: Inappropriate [OE specific configuration]
-Signed-off-by: Richard Purdie <[email protected]>
-Signed-off-by: Peter Kjellerstedt <[email protected]>
-
----
- configure.ac      | 2 +-
- src/login_nopam.c | 3 ++-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac -index 924254a..603af81 

100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -191,7 +191,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -9
-     [Path to passwd program.])
-
- dnl XXX - quick hack, should disappear before anyone notices :).
--AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
-+#AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
- if test "$ac_cv_func_ruserok" = "yes"; then
-     AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
-     AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
-diff --git a/src/login_nopam.c b/src/login_nopam.c -index 

df6ba88..fc24e13 100644
---- a/src/login_nopam.c
-+++ b/src/login_nopam.c
-@@ -29,7 +29,6 @@
- #ifndef USE_PAM
- #ident "$Id$"

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -14
-
--#include "prototypes.h"
-     /*
-      * This module implements a simple but effective form of login access
-      * control based on login names and on host (or domain) names, internet
-@@ -57,6 +56,8 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>              /* for inet_ntoa() */
-
-+#include "prototypes.h"
-+
- #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
- #undef MAXHOSTNAMELEN
- #define MAXHOSTNAMELEN 256
(quoted diff) +0 -0

a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch b/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch
deleted file mode 100644
index 89f9c05c8d3..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch
+++ /dev/null

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -10
@@ -1,41 +0,0 @@
-commit 670cae834827a8f794e6f7464fa57790d911b63c
-Author: SoumyaWind <[email protected]>
-Date:   Tue Dec 27 17:40:17 2022 +0530
-
-    shadow: Fix can not print full login timeout message
-
-    Login timed out message prints only first few bytes when write is immediately followed by exit.
-    Calling exit from new handler provides enough time to display full message.
-
-Upstream-Status: Backport 

[https://github.com/shadow-maint/shadow/commit/670cae834827a8f794e6f
7464fa57790d911b63c]

(quoted diff) +0 -2
-
-diff --git a/src/login.c b/src/login.c -index 116e2cb3..c55f4de0 

100644
---- a/src/login.c
-+++ b/src/login.c
-@@ -120,6 +120,7 @@ static void get_pam_user (char **ptr_pam_user);

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -7
-
- static void init_env (void);
- static void alarm_handler (int);
-+static void exit_handler (int);
-
- /*
-  * usage - print login command usage and exit -@@ -391,11 +392,16 

@@ static void init_env (void)
- #endif /* !USE_PAM */
- }

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -14
-
-+static void exit_handler (unused int sig) {
-+    _exit (0);
-+}
-
- static void alarm_handler (unused int sig)
- {
-     write (STDERR_FILENO, tmsg, strlen (tmsg));
--    _exit (0);
-+    signal(SIGALRM, exit_handler);
-+    alarm(2);
- }
-
- #ifdef USE_PAM
(quoted diff) +0 -0

a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch b/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted file mode 100644
index ac08be515bf..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch +++ /dev/null

(quoted diff) +0 -1
@@ -1,65 +0,0 @@
-From 2eaea70111f65b16d55998386e4ceb4273c19eb4 Mon Sep 17 00:00:00 

2001
-From: =?UTF-8?q?Christian=20G=C3=B6ttsche?=
<[email protected]>

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -8
-Date: Fri, 31 Mar 2023 14:46:50 +0200
-Subject: [PATCH] Overhaul valid_field()
-
-e5905c4b ("Added control character check") introduced checking for 
-control characters but had the logic inverted, so it rejects all 
-characters that are not control ones.
-
-Cast the character to `unsigned char` before passing to the 

character -checking functions to avoid UB.

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -4
-
-Use strpbrk(3) for the illegal character test and return early.
-
-Upstream-Status: Backport 

[https://github.com/shadow-maint/shadow/commit/2eaea70111f65b16d5599
8386e4ceb4273c19eb4]

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 24 ++++++++++--------------
- 1 file changed, 10 insertions(+), 14 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index fb51b582..53929248 

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -37,26 +37,22 @@ int valid_field (const char *field, const char *illegal)

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -39
-
-     /* For each character of field, search if it appears in the list
-      * of illegal characters. */
-+    if (illegal && NULL != strpbrk (field, illegal)) {
-+            return -1;
-+    }
-+
-+    /* Search if there are non-printable or control characters */
-     for (cp = field; '\0' != *cp; cp++) {
--            if (strchr (illegal, *cp) != NULL) {
-+            unsigned char c = *cp;
-+            if (!isprint (c)) {
-+                    err = 1;
-+            }
-+            if (iscntrl (c)) {
-                     err = -1;
-                     break;
-             }
-     }
-
--    if (0 == err) {
--            /* Search if there are non-printable or control characters */
--            for (cp = field; '\0' != *cp; cp++) {
--                    if (!isprint (*cp)) {
--                            err = 1;
--                    }
--                    if (!iscntrl (*cp)) {
--                            err = -1;
--                            break;
--                    }
--            }
--    }
--
-     return err;
- }
-
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -1
deleted file mode 100644
index f53341d3fc2..00000000000
@@ -1,53 +0,0 @@
-From e5905c4b84d4fb90aefcd96ee618411ebfac663d Mon Sep 17 00:00:00 

2001
-From: tomspiderlabs <[email protected]>

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -10
-Date: Thu, 23 Mar 2023 23:39:38 +0000
-Subject: [PATCH] Added control character check
-
-Added control character check, returning -1 (to "err") if control characters are present.
-
-CVE: CVE-2023-29383
-Upstream-Status: Backport
-
-Reference to upstream:
-https://github.com/shadow-maint/shadow/commit/e5905c4b84d4fb90aefcd

96ee618411ebfac663d

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index 640be931..fb51b582 

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -21,9 +21,9 @@

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -2
-  *
-  * The supplied field is scanned for non-printable and other 

illegal

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -29
-  * characters.
-- *  + -1 is returned if an illegal character is present.
-- *  +  1 is returned if no illegal characters are present, but the field
-- *       contains a non-printable character.
-+ *  + -1 is returned if an illegal or control character is present.
-+ *  +  1 is returned if no illegal or control characters are present,
-+ *       but the field contains a non-printable character.
-  *  +  0 is returned otherwise.
-  */
- int valid_field (const char *field, const char *illegal) -@@ 
-45,10 +45,13 @@ int valid_field (const char *field, const char *illegal)
-     }
-
-     if (0 == err) {
--            /* Search if there are some non-printable characters */
-+            /* Search if there are non-printable or control 
-+ characters */
-             for (cp = field; '\0' != *cp; cp++) {
-                     if (!isprint (*cp)) {
-                             err = 1;
-+                    }
-+                    if (!iscntrl (*cp)) {
-+                            err = -1;
-                             break;
-                     }
-             }
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
deleted file mode 100644
index 1fabfe928e4..00000000000
@@ -1,147 +0,0 @@
-From 25dbe2ce166a13322b7536ff2f738786ea2e61e7 Mon Sep 17 00:00:00 

2001

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -8
-From: Alejandro Colomar <[email protected]>
-Date: Sat, 10 Jun 2023 16:20:05 +0200
-Subject: [PATCH] gpasswd(1): Fix password leak
-
-How to trigger this password leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When gpasswd(1) asks for the new password, it asks twice (as is 

usual -for confirming the new password). Each of those 2 password prompts -uses agetpass() to get the password. If the second agetpass() fails, -the first password, which has been copied into the 'static' buffer -'pass' via STRFCPY(), wasn't being zeroed.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-agetpass() is defined in <./libmisc/agetpass.c> (around line 91), 

and -can fail for any of the following reasons:

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -17
-
--  malloc(3) or readpassphrase(3) failure.
-
-   These are going to be difficult to trigger.  Maybe getting the system
-   to the limits of memory utilization at that exact point, so that the
-   next malloc(3) gets ENOMEM, and possibly even the OOM is triggered.
-   About readpassphrase(3), ENFILE and EINTR seem the only plausible
-   ones, and EINTR probably requires privilege or being the same user;
-   but I wouldn't discard ENFILE so easily, if a process starts opening
-   files.
-
--  The password is longer than PASS_MAX.
-
-   The is plausible with physical access.  However, at that point, a
-   keylogger will be a much simpler attack.
-
-And, the attacker must be able to know when the second password is 

being -introduced, which is not going to be easy.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-How to read the password after the leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Provoking the leak yourself at the right point by entering a very 

long -password is easy, and inspecting the process stack at that point should -be doable. Try to find some consistent patterns.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Then, search for those patterns in free memory, right after the 

victim -leaks their password.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -42
-
-Once you get the leak, a program should read all the free memory 
-searching for patterns that gpasswd(1) leaves nearby the leaked 
-password.
-
-On 6/10/23 03:14, Seth Arnold wrote:
-> An attacker process wouldn't be able to use malloc(3) for this task.
-> There's a handful of tools available for userspace to allocate memory:
->
-> -  brk / sbrk
-> -  mmap MAP_ANONYMOUS
-> -  mmap /dev/zero
-> -  mmap some other file
-> -  shm_open
-> -  shmget
->
-> Most of these return only pages of zeros to a process.  Using 
-> mmap of an existing file, you can get some of the contents of the 
-> file demand-loaded into the memory space on the first use.
->
-> The MAP_UNINITIALIZED flag only works if the kernel was compiled 
-> with CONFIG_MMAP_ALLOW_UNINITIALIZED.  This is rare.
->
-> malloc(3) doesn't zero memory, to our collective frustration, but 
-> all the garbage in the allocations is from previous allocations 
-> in the current process.  It isn't leftover from other processes.
->
-> The avenues available for reading the memory:
-> -  /dev/mem and /dev/kmem (requires root, not available with 
-> Secure Boot)
-> -  /proc/pid/mem (requires ptrace privileges, mediated by YAMA)
-> -  ptrace (requires ptrace privileges, mediated by YAMA)
-> -  causing memory to be swapped to disk, and then inspecting the 
-> swap
->
-> These all require a certain amount of privileges.
-
-How to fix it?
-~~~~~~~~~~~~~~
-
-memzero(), which internally calls explicit_bzero(3), or whatever 
-alternative the system provides with a slightly different name, 

will -make sure that the buffer is zeroed in memory, and optimizations are not -allowed to impede this zeroing.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-This is not really 100% effective, since compilers may place copies 

of -the string somewhere hidden in the stack. Those copies won't get zeroed -by explicit_bzero(3). However, that's arguably a compiler bug, since -compilers should make everything possible to avoid optimizing strings -that are later passed to explicit_bzero(3). But we all know that -sometimes it's impossible to have perfect knowledge in the compiler, so -this is plausible. Nevertheless, there's nothing we can do against such -issues, except minimizing the time such passwords are stored in plain -text.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Security concerns
-~~~~~~~~~~~~~~~~~
-
-We believe this isn't easy to exploit.  Nevertheless, and since the 

fix -is trivial, this fix should probably be applied soon, and backported to -all supported distributions, to prevent someone else having more -imagination than us to find a way.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Affected versions
-~~~~~~~~~~~~~~~~~
-
-All.  Bug introduced in shadow 19990709.  That's the second commit 

in -the git history.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Fixes: 45c6603cc86c ("[svn-upgrade] Integrating new upstream 

version, shadow (19990709)")

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -3
-
-CVE: CVE-2023-4641
-Upstream-Status: Backport 

[https://github.com/shadow-maint/shadow/commit/65c88a43a23c2391dcc90
c0abda3e839e9c57904]

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -18
-
-Reported-by: Alejandro Colomar <[email protected]>
-Cc: Serge Hallyn <[email protected]>
-Cc: Iker Pedrosa <[email protected]>
-Cc: Seth Arnold <[email protected]>
-Cc: Christian Brauner <[email protected]>
-Cc: Balint Reczey <[email protected]>
-Cc: Sam James <[email protected]>
-Cc: David Runge <[email protected]>
-Cc: Andreas Jaeger <[email protected]>
-Cc: <~hallyn/[email protected]>
-Signed-off-by: Alejandro Colomar <[email protected]>
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- src/gpasswd.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/gpasswd.c b/src/gpasswd.c -index 

5983f787..2d8869ef 100644
---- a/src/gpasswd.c
-+++ b/src/gpasswd.c
-@@ -896,6 +896,7 @@ static void change_passwd (struct group *gr)

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -10
-             strzero (cp);
-             cp = getpass (_("Re-enter new password: "));
-             if (NULL == cp) {
-+                    memzero (pass, sizeof pass);
-                     exit (1);
-             }
-
---
-2.34.1
-
(quoted diff) +0 -0

a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch index 85d91751056..4a932d2dbb1 100644
---
a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch
+++ b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-o +++ pen-failure-in-chroot-env.patch

(quoted diff) +0 -1
@@ -1,4 +1,4 @@
-From 21583da072aa66901d859ac00ce209bac87ddecc Mon Sep 17 00:00:00 

2001
+From a773c6b240d27e23d6be41decef0edf24fcee523 Mon Sep 17 00:00:00 +2001
From: Chen Qi <[email protected]>
Date: Thu, 17 Jul 2014 15:53:34 +0800
Subject: [PATCH]
commonio.c-fix-unexpected-open-failure-in-chroot-env

meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch +0 -1
@@ -15,35 +15,37 @@ Note that this patch doesn't change the logic in the code, it just expands
  the codes.
 
  Signed-off-by: Chen Qi <[email protected]>
-
  ---
   lib/commonio.c | 16 ++++++++++++----
   1 file changed, 12 insertions(+), 4 deletions(-)
 
  diff --git a/lib/commonio.c b/lib/commonio.c -index 

9a02ce1..61384ec 100644
+index 73fdb3a..d1231e9 100644
--- a/lib/commonio.c
+++ b/lib/commonio.c
-@@ -616,10 +616,18 @@ int commonio_open (struct commonio_db *db, int mode)
+@@ -606,10 +606,18 @@ int commonio_open (struct commonio_db *db,

meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch +9 -3
+int mode)
      db->cursor = NULL;
      db->changed = false;
 
  -   fd = open (db->filename,
  -                (db->readonly ? O_RDONLY : O_RDWR)
--               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
+-               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);
  -   saved_errno = errno;
  +   if (db->readonly) {
  +           fd = open (db->filename,
  +                      (true ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | 
++ O_CLOEXEC);
  +           saved_errno = errno;
  +   } else {
  +           fd = open (db->filename,
  +                      (false ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW| 
++ O_CLOEXEC);
  +           saved_errno = errno;
  +   }
  +
      db->fp = NULL;
      if (fd >= 0) {
   #ifdef WITH_TCB
+--
+2.30.2
+
meta/recipes-extended/shadow/shadow.inc +4 -11
index ce3ce627156..c024746d4ff 100644
@@ -5,7 +5,7 @@ BUGTRACKER = "http://github.com/shadow-maint/shadow/issues"
  SECTION = "base/utils"
  LICENSE = "BSD-3-Clause"
  LIC_FILES_CHKSUM = "file://COPYING;md5=c9a450b7be84eac23e6353efecb60b5b \
-                    file://src/passwd.c;beginline=2;endline=30;md5=758c26751513b6795395275969dd3be1 \
+                    
+ file://src/passwd.c;beginline=2;endline=7;md5=67bcf314687820b2f010
+ d4863fce3fc5 \
                      "
 
  DEPENDS = "virtual/crypt"
@@ -14,10 +14,6 @@ GITHUB_BASE_URI = "https://github.com/shadow-maint/shadow/releases"
  SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
             ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
             file://useradd \
-        file://0001-Fix-can-not-print-full-login.patch \
-           file://CVE-2023-29383.patch \
-           file://0001-Overhaul-valid_field.patch \
-           file://CVE-2023-4641.patch \
             "
 
  SRC_URI:append:class-target = " \
@@ -26,14 +22,9 @@ SRC_URI:append:class-target = " \
             "
 
  SRC_URI:append:class-native = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
             file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
             "
-SRC_URI:append:class-nativesdk = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
-           "
-SRC_URI[sha256sum] = "813057047499c7fe81108adcf0cffa3ad4ec75e19a80151f9cbaa458ff2e86cd"
-
+SRC_URI[sha256sum] = "a305edf5d19bddbdf5e836d2d609fa8bff2d35458819de4d9f06306a1cf24342"
 
  # Additional Policy files for PAM
  PAM_SRC_URI = "file://pam.d/chfn \ @@ -44,7 +35,7 @@ PAM_SRC_URI = 
"file://pam.d/chfn \
                 file://pam.d/passwd \
                 file://pam.d/su"
meta/recipes-extended/shadow/shadow.inc +5 -2
-inherit autotools gettext github-releases
+inherit autotools gettext github-releases pkgconfig
 
  export CONFIG_SHELL="/bin/sh"
@@ -54,6 +45,8 @@ EXTRA_OECONF += "--without-libcrack \
                   --without-sssd \
                   ${NSCDOPT}"
 
+CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
+
  NSCDOPT = ""
  NSCDOPT:class-native = "--without-nscd"
  NSCDOPT:class-nativesdk = "--without-nscd"
@@ -73,13 +66,14 @@ PAM_PLUGINS = "libpam-runtime \
 
  PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
                     ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
-PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
+PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} libbsd"
  PACKAGECONFIG:class-nativesdk = ""
  PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
  PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
  PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl"
  PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit"
  PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage"
+PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"
 
  RDEPENDS:${PN} = "shadow-securetty \
                    base-passwd \
meta/recipes-extended/shadow/shadow_4.14.2.bb renamed from meta/recipes-extended/shadow/shadow_4.13.bb +0 -1
similarity index 100%
rename from meta/recipes-extended/shadow/shadow_4.13.bb
rename to meta/recipes-extended/shadow/shadow_4.14.2.bb
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group. View/Reply Online (#193542):
https://lists.openembedded.org/g/openembedded-core/message/193542
Mute This Topic: https://lists.openembedded.org/mt/103661547/7304865
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#15 lore raw

I've seen issues where static libraries built on one host were not usable on a different host with default compiler options. This may be another one of these.

We're reverting to dynamic linking with libraries in a custom directory in sysroot that would be bundled together with shadow-native proper. Patch is coming.

Alex

Quoted 677 lines · Qi

I didn't do anything particular, but as several people are sharing the server, it's possible that its environment is somewhat messed up. I'll check more and fix the environment. Thanks for your double check.

Regards,
Qi

-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Friday, January 19, 2024 6:12 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]; Alexander Kanavin <[email protected]>
Subject: Re: [OE-core] [PATCH v3 1/2] shadow: update 4.13 -> 4.14.2

I just tried poky master on ubuntu 20.04, and the issues do not appear. Do you have a custom setup?

Alex

Quoted 659 lines · ChenQi

I'm seeing build failures on Ubuntu 20.04.
GCC version: 9.4.0

1. error: parameter name omitted
The problem is that the active_sessions_count function's definition lacks parameter. I did change like below:
-unsigned long active_sessions_count(const char *name, unsigned long unused)
+unsigned long active_sessions_count(const char *name, unsigned long unused unused_parameter)
But then I observed another error, as shown below.

2. undefined reference to `dlsym'.
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_exit':
| nss.c:(.text+0x32): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_init':
| nss.c:(.text+0x1dd): undefined reference to `dlopen'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x21c): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x237): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x253): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x365): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x3b2): undefined reference to `dlerror'
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:1130: su] Error 1

On Ubuntu22.04, there's no such issue.

Regards,
Qi

Quoted 619 lines · Alexander Kanavin

License-Update: formatting, spdx conversion

Drop:
0001-Disable-use-of-syslog-for-sysroot.patch
(issue fixed upstream)

0001-Fix-can-not-print-full-login.patch
0001-Overhaul-valid_field.patch
CVE-2023-29383.patch
(backports)

libbsd is a new native dependency, as otherwise glibc >= 2.38 is needed.

A similar fix is added to musl in order to define non-standard __BEGIN_DECLS/__END_DECLS.

---
  ...01-Disable-use-of-syslog-for-sysroot.patch |  52 -------
  .../0001-Fix-can-not-print-full-login.patch   |  41 -----
  .../files/0001-Overhaul-valid_field.patch     |  65 --------
  .../shadow/files/CVE-2023-29383.patch         |  53 -------
  .../shadow/files/CVE-2023-4641.patch          | 147 ------------------
  ...nexpected-open-failure-in-chroot-env.patch |  16 +-
  meta/recipes-extended/shadow/shadow.inc       |  20 +--
  .../{shadow_4.13.bb => shadow_4.14.2.bb}      |   0
  8 files changed, 16 insertions(+), 378 deletions(-)

delete mode 100644 meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-29383.patch
delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-4641.patch
rename meta/recipes-extended/shadow/{shadow_4.13.bb =>
shadow_4.14.2.bb} (100%)

diff --git a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch b/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch
deleted file mode 100644
index fa1532c8317..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch
+++ /dev/null

(quoted diff) +0 -1
@@ -1,52 +0,0 @@
-From 85d0444229ee3d14fefcf10d093f49c862826f82 Mon Sep 17 00:00:00

2001

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -5
-From: Richard Purdie <[email protected]>
-Date: Thu, 14 Apr 2022 23:11:53 +0000
-Subject: [PATCH] Disable use of syslog for shadow-native tools
-
-Disable use of syslog to prevent sysroot user and group additions

from -writing entries to the host's syslog. This patch should only be used -with the shadow-native recipe.

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -11
-
-Upstream-Status: Inappropriate [OE specific configuration]
-Signed-off-by: Richard Purdie <[email protected]>
-Signed-off-by: Peter Kjellerstedt <[email protected]>
-
----
- configure.ac      | 2 +-
- src/login_nopam.c | 3 ++-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac -index 924254a..603af81

100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -191,7 +191,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -9
-     [Path to passwd program.])
-
- dnl XXX - quick hack, should disappear before anyone notices :).
--AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
-+#AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
- if test "$ac_cv_func_ruserok" = "yes"; then
-     AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
-     AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
-diff --git a/src/login_nopam.c b/src/login_nopam.c -index

df6ba88..fc24e13 100644
---- a/src/login_nopam.c
-+++ b/src/login_nopam.c
-@@ -29,7 +29,6 @@
- #ifndef USE_PAM
- #ident "$Id$"

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -14
-
--#include "prototypes.h"
-     /*
-      * This module implements a simple but effective form of login access
-      * control based on login names and on host (or domain) names, internet
-@@ -57,6 +56,8 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>              /* for inet_ntoa() */
-
-+#include "prototypes.h"
-+
- #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
- #undef MAXHOSTNAMELEN
- #define MAXHOSTNAMELEN 256

diff --git a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch b/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch
deleted file mode 100644
index 89f9c05c8d3..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch
+++ /dev/null

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -10
@@ -1,41 +0,0 @@
-commit 670cae834827a8f794e6f7464fa57790d911b63c
-Author: SoumyaWind <[email protected]>
-Date:   Tue Dec 27 17:40:17 2022 +0530
-
-    shadow: Fix can not print full login timeout message
-
-    Login timed out message prints only first few bytes when write is immediately followed by exit.
-    Calling exit from new handler provides enough time to display full message.
-
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/670cae834827a8f794e6f
7464fa57790d911b63c]

(quoted diff) +0 -2
-
-diff --git a/src/login.c b/src/login.c -index 116e2cb3..c55f4de0

100644
---- a/src/login.c
-+++ b/src/login.c
-@@ -120,6 +120,7 @@ static void get_pam_user (char **ptr_pam_user);

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -7
-
- static void init_env (void);
- static void alarm_handler (int);
-+static void exit_handler (int);
-
- /*
-  * usage - print login command usage and exit -@@ -391,11 +392,16

@@ static void init_env (void)
- #endif /* !USE_PAM */
- }

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -14
-
-+static void exit_handler (unused int sig) {
-+    _exit (0);
-+}
-
- static void alarm_handler (unused int sig)
- {
-     write (STDERR_FILENO, tmsg, strlen (tmsg));
--    _exit (0);
-+    signal(SIGALRM, exit_handler);
-+    alarm(2);
- }
-
- #ifdef USE_PAM

diff --git a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch b/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted file mode 100644
index ac08be515bf..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch +++ /dev/null

(quoted diff) +0 -1
@@ -1,65 +0,0 @@
-From 2eaea70111f65b16d55998386e4ceb4273c19eb4 Mon Sep 17 00:00:00

2001
-From: =?UTF-8?q?Christian=20G=C3=B6ttsche?=
<[email protected]>

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -8
-Date: Fri, 31 Mar 2023 14:46:50 +0200
-Subject: [PATCH] Overhaul valid_field()
-
-e5905c4b ("Added control character check") introduced checking for
-control characters but had the logic inverted, so it rejects all
-characters that are not control ones.
-
-Cast the character to `unsigned char` before passing to the

character -checking functions to avoid UB.

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -4
-
-Use strpbrk(3) for the illegal character test and return early.
-
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/2eaea70111f65b16d5599
8386e4ceb4273c19eb4]

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 24 ++++++++++--------------
- 1 file changed, 10 insertions(+), 14 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index fb51b582..53929248

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -37,26 +37,22 @@ int valid_field (const char *field, const char *illegal)

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -39
-
-     /* For each character of field, search if it appears in the list
-      * of illegal characters. */
-+    if (illegal && NULL != strpbrk (field, illegal)) {
-+            return -1;
-+    }
-+
-+    /* Search if there are non-printable or control characters */
-     for (cp = field; '\0' != *cp; cp++) {
--            if (strchr (illegal, *cp) != NULL) {
-+            unsigned char c = *cp;
-+            if (!isprint (c)) {
-+                    err = 1;
-+            }
-+            if (iscntrl (c)) {
-                     err = -1;
-                     break;
-             }
-     }
-
--    if (0 == err) {
--            /* Search if there are non-printable or control characters */
--            for (cp = field; '\0' != *cp; cp++) {
--                    if (!isprint (*cp)) {
--                            err = 1;
--                    }
--                    if (!iscntrl (*cp)) {
--                            err = -1;
--                            break;
--                    }
--            }
--    }
--
-     return err;
- }
-
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -1
deleted file mode 100644
index f53341d3fc2..00000000000
@@ -1,53 +0,0 @@
-From e5905c4b84d4fb90aefcd96ee618411ebfac663d Mon Sep 17 00:00:00

2001
-From: tomspiderlabs <[email protected]>

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -10
-Date: Thu, 23 Mar 2023 23:39:38 +0000
-Subject: [PATCH] Added control character check
-
-Added control character check, returning -1 (to "err") if control characters are present.
-
-CVE: CVE-2023-29383
-Upstream-Status: Backport
-
-Reference to upstream:
-https://github.com/shadow-maint/shadow/commit/e5905c4b84d4fb90aefcd

96ee618411ebfac663d

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index 640be931..fb51b582

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -21,9 +21,9 @@

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -2
-  *
-  * The supplied field is scanned for non-printable and other

illegal

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -29
-  * characters.
-- *  + -1 is returned if an illegal character is present.
-- *  +  1 is returned if no illegal characters are present, but the field
-- *       contains a non-printable character.
-+ *  + -1 is returned if an illegal or control character is present.
-+ *  +  1 is returned if no illegal or control characters are present,
-+ *       but the field contains a non-printable character.
-  *  +  0 is returned otherwise.
-  */
- int valid_field (const char *field, const char *illegal) -@@
-45,10 +45,13 @@ int valid_field (const char *field, const char *illegal)
-     }
-
-     if (0 == err) {
--            /* Search if there are some non-printable characters */
-+            /* Search if there are non-printable or control
-+ characters */
-             for (cp = field; '\0' != *cp; cp++) {
-                     if (!isprint (*cp)) {
-                             err = 1;
-+                    }
-+                    if (!iscntrl (*cp)) {
-+                            err = -1;
-                             break;
-                     }
-             }
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
deleted file mode 100644
index 1fabfe928e4..00000000000
@@ -1,147 +0,0 @@
-From 25dbe2ce166a13322b7536ff2f738786ea2e61e7 Mon Sep 17 00:00:00

2001

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -8
-From: Alejandro Colomar <[email protected]>
-Date: Sat, 10 Jun 2023 16:20:05 +0200
-Subject: [PATCH] gpasswd(1): Fix password leak
-
-How to trigger this password leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When gpasswd(1) asks for the new password, it asks twice (as is

usual -for confirming the new password). Each of those 2 password prompts -uses agetpass() to get the password. If the second agetpass() fails, -the first password, which has been copied into the 'static' buffer -'pass' via STRFCPY(), wasn't being zeroed.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-agetpass() is defined in <./libmisc/agetpass.c> (around line 91),

and -can fail for any of the following reasons:

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -17
-
--  malloc(3) or readpassphrase(3) failure.
-
-   These are going to be difficult to trigger.  Maybe getting the system
-   to the limits of memory utilization at that exact point, so that the
-   next malloc(3) gets ENOMEM, and possibly even the OOM is triggered.
-   About readpassphrase(3), ENFILE and EINTR seem the only plausible
-   ones, and EINTR probably requires privilege or being the same user;
-   but I wouldn't discard ENFILE so easily, if a process starts opening
-   files.
-
--  The password is longer than PASS_MAX.
-
-   The is plausible with physical access.  However, at that point, a
-   keylogger will be a much simpler attack.
-
-And, the attacker must be able to know when the second password is

being -introduced, which is not going to be easy.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-How to read the password after the leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Provoking the leak yourself at the right point by entering a very

long -password is easy, and inspecting the process stack at that point should -be doable. Try to find some consistent patterns.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Then, search for those patterns in free memory, right after the

victim -leaks their password.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -42
-
-Once you get the leak, a program should read all the free memory
-searching for patterns that gpasswd(1) leaves nearby the leaked
-password.
-
-On 6/10/23 03:14, Seth Arnold wrote:
-> An attacker process wouldn't be able to use malloc(3) for this task.
-> There's a handful of tools available for userspace to allocate memory:
->
-> -  brk / sbrk
-> -  mmap MAP_ANONYMOUS
-> -  mmap /dev/zero
-> -  mmap some other file
-> -  shm_open
-> -  shmget
->
-> Most of these return only pages of zeros to a process.  Using
-> mmap of an existing file, you can get some of the contents of the
-> file demand-loaded into the memory space on the first use.
->
-> The MAP_UNINITIALIZED flag only works if the kernel was compiled
-> with CONFIG_MMAP_ALLOW_UNINITIALIZED.  This is rare.
->
-> malloc(3) doesn't zero memory, to our collective frustration, but
-> all the garbage in the allocations is from previous allocations
-> in the current process.  It isn't leftover from other processes.
->
-> The avenues available for reading the memory:
-> -  /dev/mem and /dev/kmem (requires root, not available with
-> Secure Boot)
-> -  /proc/pid/mem (requires ptrace privileges, mediated by YAMA)
-> -  ptrace (requires ptrace privileges, mediated by YAMA)
-> -  causing memory to be swapped to disk, and then inspecting the
-> swap
->
-> These all require a certain amount of privileges.
-
-How to fix it?
-~~~~~~~~~~~~~~
-
-memzero(), which internally calls explicit_bzero(3), or whatever
-alternative the system provides with a slightly different name,

will -make sure that the buffer is zeroed in memory, and optimizations are not -allowed to impede this zeroing.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-This is not really 100% effective, since compilers may place copies

of -the string somewhere hidden in the stack. Those copies won't get zeroed -by explicit_bzero(3). However, that's arguably a compiler bug, since -compilers should make everything possible to avoid optimizing strings -that are later passed to explicit_bzero(3). But we all know that -sometimes it's impossible to have perfect knowledge in the compiler, so -this is plausible. Nevertheless, there's nothing we can do against such -issues, except minimizing the time such passwords are stored in plain -text.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Security concerns
-~~~~~~~~~~~~~~~~~
-
-We believe this isn't easy to exploit.  Nevertheless, and since the

fix -is trivial, this fix should probably be applied soon, and backported to -all supported distributions, to prevent someone else having more -imagination than us to find a way.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Affected versions
-~~~~~~~~~~~~~~~~~
-
-All.  Bug introduced in shadow 19990709.  That's the second commit

in -the git history.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Fixes: 45c6603cc86c ("[svn-upgrade] Integrating new upstream

version, shadow (19990709)")

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -3
-
-CVE: CVE-2023-4641
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/65c88a43a23c2391dcc90
c0abda3e839e9c57904]

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -18
-
-Reported-by: Alejandro Colomar <[email protected]>
-Cc: Serge Hallyn <[email protected]>
-Cc: Iker Pedrosa <[email protected]>
-Cc: Seth Arnold <[email protected]>
-Cc: Christian Brauner <[email protected]>
-Cc: Balint Reczey <[email protected]>
-Cc: Sam James <[email protected]>
-Cc: David Runge <[email protected]>
-Cc: Andreas Jaeger <[email protected]>
-Cc: <~hallyn/[email protected]>
-Signed-off-by: Alejandro Colomar <[email protected]>
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- src/gpasswd.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/gpasswd.c b/src/gpasswd.c -index

5983f787..2d8869ef 100644
---- a/src/gpasswd.c
-+++ b/src/gpasswd.c
-@@ -896,6 +896,7 @@ static void change_passwd (struct group *gr)

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -10
-             strzero (cp);
-             cp = getpass (_("Re-enter new password: "));
-             if (NULL == cp) {
-+                    memzero (pass, sizeof pass);
-                     exit (1);
-             }
-
---
-2.34.1
-

diff --git a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch index 85d91751056..4a932d2dbb1 100644
---
a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch
+++ b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-o +++ pen-failure-in-chroot-env.patch

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
@@ -1,4 +1,4 @@
-From 21583da072aa66901d859ac00ce209bac87ddecc Mon Sep 17 00:00:00

2001
+From a773c6b240d27e23d6be41decef0edf24fcee523 Mon Sep 17 00:00:00 +2001
From: Chen Qi <[email protected]>
Date: Thu, 17 Jul 2014 15:53:34 +0800
Subject: [PATCH]
commonio.c-fix-unexpected-open-failure-in-chroot-env

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
@@ -15,35 +15,37 @@ Note that this patch doesn't change the logic in the code, it just expands
  the codes.
 
  Signed-off-by: Chen Qi <[email protected]>
-
  ---
   lib/commonio.c | 16 ++++++++++++----
   1 file changed, 12 insertions(+), 4 deletions(-)
 
  diff --git a/lib/commonio.c b/lib/commonio.c -index

9a02ce1..61384ec 100644
+index 73fdb3a..d1231e9 100644
--- a/lib/commonio.c
+++ b/lib/commonio.c
-@@ -616,10 +616,18 @@ int commonio_open (struct commonio_db *db, int mode)
+@@ -606,10 +606,18 @@ int commonio_open (struct commonio_db *db,

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +9 -3
+int mode)
      db->cursor = NULL;
      db->changed = false;
 
  -   fd = open (db->filename,
  -                (db->readonly ? O_RDONLY : O_RDWR)
--               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
+-               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);
  -   saved_errno = errno;
  +   if (db->readonly) {
  +           fd = open (db->filename,
  +                      (true ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW |
++ O_CLOEXEC);
  +           saved_errno = errno;
  +   } else {
  +           fd = open (db->filename,
  +                      (false ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW|
++ O_CLOEXEC);
  +           saved_errno = errno;
  +   }
  +
      db->fp = NULL;
      if (fd >= 0) {
   #ifdef WITH_TCB
+--
+2.30.2
+
meta/recipes-extended/shadow/shadow.inc +4 -11
index ce3ce627156..c024746d4ff 100644
@@ -5,7 +5,7 @@ BUGTRACKER = "http://github.com/shadow-maint/shadow/issues"
  SECTION = "base/utils"
  LICENSE = "BSD-3-Clause"
  LIC_FILES_CHKSUM = "file://COPYING;md5=c9a450b7be84eac23e6353efecb60b5b \
-                    file://src/passwd.c;beginline=2;endline=30;md5=758c26751513b6795395275969dd3be1 \
+
+ file://src/passwd.c;beginline=2;endline=7;md5=67bcf314687820b2f010
+ d4863fce3fc5 \
                      "
 
  DEPENDS = "virtual/crypt"
@@ -14,10 +14,6 @@ GITHUB_BASE_URI = "https://github.com/shadow-maint/shadow/releases"
  SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
             ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
             file://useradd \
-        file://0001-Fix-can-not-print-full-login.patch \
-           file://CVE-2023-29383.patch \
-           file://0001-Overhaul-valid_field.patch \
-           file://CVE-2023-4641.patch \
             "
 
  SRC_URI:append:class-target = " \
@@ -26,14 +22,9 @@ SRC_URI:append:class-target = " \
             "
 
  SRC_URI:append:class-native = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
             file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
             "
-SRC_URI:append:class-nativesdk = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
-           "
-SRC_URI[sha256sum] = "813057047499c7fe81108adcf0cffa3ad4ec75e19a80151f9cbaa458ff2e86cd"
-
+SRC_URI[sha256sum] = "a305edf5d19bddbdf5e836d2d609fa8bff2d35458819de4d9f06306a1cf24342"
 
  # Additional Policy files for PAM
  PAM_SRC_URI = "file://pam.d/chfn \ @@ -44,7 +35,7 @@ PAM_SRC_URI =
"file://pam.d/chfn \
                 file://pam.d/passwd \
                 file://pam.d/su"
meta/recipes-extended/shadow/shadow.inc +5 -2
-inherit autotools gettext github-releases
+inherit autotools gettext github-releases pkgconfig
 
  export CONFIG_SHELL="/bin/sh"
@@ -54,6 +45,8 @@ EXTRA_OECONF += "--without-libcrack \
                   --without-sssd \
                   ${NSCDOPT}"
 
+CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
+
  NSCDOPT = ""
  NSCDOPT:class-native = "--without-nscd"
  NSCDOPT:class-nativesdk = "--without-nscd"
@@ -73,13 +66,14 @@ PAM_PLUGINS = "libpam-runtime \
 
  PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
                     ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
-PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
+PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} libbsd"
  PACKAGECONFIG:class-nativesdk = ""
  PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
  PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
  PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl"
  PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit"
  PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage"
+PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"
 
  RDEPENDS:${PN} = "shadow-securetty \
                    base-passwd \
meta/recipes-extended/shadow/shadow_4.14.2.bb renamed from meta/recipes-extended/shadow/shadow_4.13.bb +0 -1
similarity index 100%
rename from meta/recipes-extended/shadow/shadow_4.13.bb
rename to meta/recipes-extended/shadow/shadow_4.14.2.bb
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group. View/Reply Online (#193542):
https://lists.openembedded.org/g/openembedded-core/message/193542
Mute This Topic: https://lists.openembedded.org/mt/103661547/7304865
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#16 lore raw

I'm getting the same "parameter name omitted" error with today's master of poky on Ubuntu-20.04 machine. Is there a fix for that?

Slava

Quoted 676 lines · Alexander Kanavin

I've seen issues where static libraries built on one host were not usable on a different host with default compiler options. This may be another one of these.

We're reverting to dynamic linking with libraries in a custom directory in sysroot that would be bundled together with shadow-native proper. Patch is coming.

Alex

Quoted 665 lines · Qi

I didn't do anything particular, but as several people are sharing the server, it's possible that its environment is somewhat messed up. I'll check more and fix the environment. Thanks for your double check.

Regards,
Qi

-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Friday, January 19, 2024 6:12 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]; Alexander Kanavin <[email protected]>
Subject: Re: [OE-core] [PATCH v3 1/2] shadow: update 4.13 -> 4.14.2

I just tried poky master on ubuntu 20.04, and the issues do not appear. Do you have a custom setup?

Alex

Quoted 648 lines · ChenQi

I'm seeing build failures on Ubuntu 20.04.
GCC version: 9.4.0

1. error: parameter name omitted
The problem is that the active_sessions_count function's definition lacks parameter. I did change like below:
-unsigned long active_sessions_count(const char *name, unsigned long unused)
+unsigned long active_sessions_count(const char *name, unsigned long unused unused_parameter)
But then I observed another error, as shown below.

2. undefined reference to `dlsym'.
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_exit':
| nss.c:(.text+0x32): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_init':
| nss.c:(.text+0x1dd): undefined reference to `dlopen'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x21c): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x237): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x253): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x365): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x3b2): undefined reference to `dlerror'
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:1130: su] Error 1

On Ubuntu22.04, there's no such issue.

Regards,
Qi

Quoted 610 lines · Alexander Kanavin

License-Update: formatting, spdx conversion

Drop:
0001-Disable-use-of-syslog-for-sysroot.patch
(issue fixed upstream)

0001-Fix-can-not-print-full-login.patch
0001-Overhaul-valid_field.patch
CVE-2023-29383.patch
(backports)

libbsd is a new native dependency, as otherwise glibc >= 2.38 is needed.

A similar fix is added to musl in order to define non-standard __BEGIN_DECLS/__END_DECLS.

---
   ...01-Disable-use-of-syslog-for-sysroot.patch |  52 -------
   .../0001-Fix-can-not-print-full-login.patch   |  41 -----
   .../files/0001-Overhaul-valid_field.patch     |  65 --------
   .../shadow/files/CVE-2023-29383.patch         |  53 -------
   .../shadow/files/CVE-2023-4641.patch          | 147 ------------------
   ...nexpected-open-failure-in-chroot-env.patch |  16 +-
   meta/recipes-extended/shadow/shadow.inc       |  20 +--
   .../{shadow_4.13.bb => shadow_4.14.2.bb}      |   0
   8 files changed, 16 insertions(+), 378 deletions(-)

delete mode 100644 meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-29383.patch
delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-4641.patch
rename meta/recipes-extended/shadow/{shadow_4.13.bb =>
shadow_4.14.2.bb} (100%)

diff --git a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch b/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch
deleted file mode 100644
index fa1532c8317..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch
+++ /dev/null

(quoted diff) +0 -1
@@ -1,52 +0,0 @@
-From 85d0444229ee3d14fefcf10d093f49c862826f82 Mon Sep 17 00:00:00

2001

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -5
-From: Richard Purdie <[email protected]>
-Date: Thu, 14 Apr 2022 23:11:53 +0000
-Subject: [PATCH] Disable use of syslog for shadow-native tools
-
-Disable use of syslog to prevent sysroot user and group additions

from -writing entries to the host's syslog. This patch should only be used -with the shadow-native recipe.

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -11
-
-Upstream-Status: Inappropriate [OE specific configuration]
-Signed-off-by: Richard Purdie <[email protected]>
-Signed-off-by: Peter Kjellerstedt <[email protected]>
-
----
- configure.ac      | 2 +-
- src/login_nopam.c | 3 ++-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac -index 924254a..603af81

100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -191,7 +191,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -9
-     [Path to passwd program.])
-
- dnl XXX - quick hack, should disappear before anyone notices :).
--AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
-+#AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
- if test "$ac_cv_func_ruserok" = "yes"; then
-     AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
-     AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
-diff --git a/src/login_nopam.c b/src/login_nopam.c -index

df6ba88..fc24e13 100644
---- a/src/login_nopam.c
-+++ b/src/login_nopam.c
-@@ -29,7 +29,6 @@
- #ifndef USE_PAM
- #ident "$Id$"

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -14
-
--#include "prototypes.h"
-     /*
-      * This module implements a simple but effective form of login access
-      * control based on login names and on host (or domain) names, internet
-@@ -57,6 +56,8 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>              /* for inet_ntoa() */
-
-+#include "prototypes.h"
-+
- #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
- #undef MAXHOSTNAMELEN
- #define MAXHOSTNAMELEN 256

diff --git a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch b/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch
deleted file mode 100644
index 89f9c05c8d3..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch
+++ /dev/null

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -10
@@ -1,41 +0,0 @@
-commit 670cae834827a8f794e6f7464fa57790d911b63c
-Author: SoumyaWind <[email protected]>
-Date:   Tue Dec 27 17:40:17 2022 +0530
-
-    shadow: Fix can not print full login timeout message
-
-    Login timed out message prints only first few bytes when write is immediately followed by exit.
-    Calling exit from new handler provides enough time to display full message.
-
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/670cae834827a8f794e6f
7464fa57790d911b63c]

(quoted diff) +0 -2
-
-diff --git a/src/login.c b/src/login.c -index 116e2cb3..c55f4de0

100644
---- a/src/login.c
-+++ b/src/login.c
-@@ -120,6 +120,7 @@ static void get_pam_user (char **ptr_pam_user);

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -7
-
- static void init_env (void);
- static void alarm_handler (int);
-+static void exit_handler (int);
-
- /*
-  * usage - print login command usage and exit -@@ -391,11 +392,16

@@ static void init_env (void)
- #endif /* !USE_PAM */
- }

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -14
-
-+static void exit_handler (unused int sig) {
-+    _exit (0);
-+}
-
- static void alarm_handler (unused int sig)
- {
-     write (STDERR_FILENO, tmsg, strlen (tmsg));
--    _exit (0);
-+    signal(SIGALRM, exit_handler);
-+    alarm(2);
- }
-
- #ifdef USE_PAM

diff --git a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch b/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted file mode 100644
index ac08be515bf..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch +++ /dev/null

(quoted diff) +0 -1
@@ -1,65 +0,0 @@
-From 2eaea70111f65b16d55998386e4ceb4273c19eb4 Mon Sep 17 00:00:00

2001
-From: =?UTF-8?q?Christian=20G=C3=B6ttsche?=
<[email protected]>

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -8
-Date: Fri, 31 Mar 2023 14:46:50 +0200
-Subject: [PATCH] Overhaul valid_field()
-
-e5905c4b ("Added control character check") introduced checking for
-control characters but had the logic inverted, so it rejects all
-characters that are not control ones.
-
-Cast the character to `unsigned char` before passing to the

character -checking functions to avoid UB.

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -4
-
-Use strpbrk(3) for the illegal character test and return early.
-
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/2eaea70111f65b16d5599
8386e4ceb4273c19eb4]

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 24 ++++++++++--------------
- 1 file changed, 10 insertions(+), 14 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index fb51b582..53929248

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -37,26 +37,22 @@ int valid_field (const char *field, const char *illegal)

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -39
-
-     /* For each character of field, search if it appears in the list
-      * of illegal characters. */
-+    if (illegal && NULL != strpbrk (field, illegal)) {
-+            return -1;
-+    }
-+
-+    /* Search if there are non-printable or control characters */
-     for (cp = field; '\0' != *cp; cp++) {
--            if (strchr (illegal, *cp) != NULL) {
-+            unsigned char c = *cp;
-+            if (!isprint (c)) {
-+                    err = 1;
-+            }
-+            if (iscntrl (c)) {
-                     err = -1;
-                     break;
-             }
-     }
-
--    if (0 == err) {
--            /* Search if there are non-printable or control characters */
--            for (cp = field; '\0' != *cp; cp++) {
--                    if (!isprint (*cp)) {
--                            err = 1;
--                    }
--                    if (!iscntrl (*cp)) {
--                            err = -1;
--                            break;
--                    }
--            }
--    }
--
-     return err;
- }
-
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -1
deleted file mode 100644
index f53341d3fc2..00000000000
@@ -1,53 +0,0 @@
-From e5905c4b84d4fb90aefcd96ee618411ebfac663d Mon Sep 17 00:00:00

2001
-From: tomspiderlabs <[email protected]>

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -10
-Date: Thu, 23 Mar 2023 23:39:38 +0000
-Subject: [PATCH] Added control character check
-
-Added control character check, returning -1 (to "err") if control characters are present.
-
-CVE: CVE-2023-29383
-Upstream-Status: Backport
-
-Reference to upstream:
-https://github.com/shadow-maint/shadow/commit/e5905c4b84d4fb90aefcd

96ee618411ebfac663d

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index 640be931..fb51b582

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -21,9 +21,9 @@

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -2
-  *
-  * The supplied field is scanned for non-printable and other

illegal

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -29
-  * characters.
-- *  + -1 is returned if an illegal character is present.
-- *  +  1 is returned if no illegal characters are present, but the field
-- *       contains a non-printable character.
-+ *  + -1 is returned if an illegal or control character is present.
-+ *  +  1 is returned if no illegal or control characters are present,
-+ *       but the field contains a non-printable character.
-  *  +  0 is returned otherwise.
-  */
- int valid_field (const char *field, const char *illegal) -@@
-45,10 +45,13 @@ int valid_field (const char *field, const char *illegal)
-     }
-
-     if (0 == err) {
--            /* Search if there are some non-printable characters */
-+            /* Search if there are non-printable or control
-+ characters */
-             for (cp = field; '\0' != *cp; cp++) {
-                     if (!isprint (*cp)) {
-                             err = 1;
-+                    }
-+                    if (!iscntrl (*cp)) {
-+                            err = -1;
-                             break;
-                     }
-             }
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
deleted file mode 100644
index 1fabfe928e4..00000000000
@@ -1,147 +0,0 @@
-From 25dbe2ce166a13322b7536ff2f738786ea2e61e7 Mon Sep 17 00:00:00

2001

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -8
-From: Alejandro Colomar <[email protected]>
-Date: Sat, 10 Jun 2023 16:20:05 +0200
-Subject: [PATCH] gpasswd(1): Fix password leak
-
-How to trigger this password leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When gpasswd(1) asks for the new password, it asks twice (as is

usual -for confirming the new password). Each of those 2 password prompts -uses agetpass() to get the password. If the second agetpass() fails, -the first password, which has been copied into the 'static' buffer -'pass' via STRFCPY(), wasn't being zeroed.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-agetpass() is defined in <./libmisc/agetpass.c> (around line 91),

and -can fail for any of the following reasons:

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -17
-
--  malloc(3) or readpassphrase(3) failure.
-
-   These are going to be difficult to trigger.  Maybe getting the system
-   to the limits of memory utilization at that exact point, so that the
-   next malloc(3) gets ENOMEM, and possibly even the OOM is triggered.
-   About readpassphrase(3), ENFILE and EINTR seem the only plausible
-   ones, and EINTR probably requires privilege or being the same user;
-   but I wouldn't discard ENFILE so easily, if a process starts opening
-   files.
-
--  The password is longer than PASS_MAX.
-
-   The is plausible with physical access.  However, at that point, a
-   keylogger will be a much simpler attack.
-
-And, the attacker must be able to know when the second password is

being -introduced, which is not going to be easy.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-How to read the password after the leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Provoking the leak yourself at the right point by entering a very

long -password is easy, and inspecting the process stack at that point should -be doable. Try to find some consistent patterns.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Then, search for those patterns in free memory, right after the

victim -leaks their password.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -42
-
-Once you get the leak, a program should read all the free memory
-searching for patterns that gpasswd(1) leaves nearby the leaked
-password.
-
-On 6/10/23 03:14, Seth Arnold wrote:
-> An attacker process wouldn't be able to use malloc(3) for this task.
-> There's a handful of tools available for userspace to allocate memory:
->
-> -  brk / sbrk
-> -  mmap MAP_ANONYMOUS
-> -  mmap /dev/zero
-> -  mmap some other file
-> -  shm_open
-> -  shmget
->
-> Most of these return only pages of zeros to a process.  Using
-> mmap of an existing file, you can get some of the contents of the
-> file demand-loaded into the memory space on the first use.
->
-> The MAP_UNINITIALIZED flag only works if the kernel was compiled
-> with CONFIG_MMAP_ALLOW_UNINITIALIZED.  This is rare.
->
-> malloc(3) doesn't zero memory, to our collective frustration, but
-> all the garbage in the allocations is from previous allocations
-> in the current process.  It isn't leftover from other processes.
->
-> The avenues available for reading the memory:
-> -  /dev/mem and /dev/kmem (requires root, not available with
-> Secure Boot)
-> -  /proc/pid/mem (requires ptrace privileges, mediated by YAMA)
-> -  ptrace (requires ptrace privileges, mediated by YAMA)
-> -  causing memory to be swapped to disk, and then inspecting the
-> swap
->
-> These all require a certain amount of privileges.
-
-How to fix it?
-~~~~~~~~~~~~~~
-
-memzero(), which internally calls explicit_bzero(3), or whatever
-alternative the system provides with a slightly different name,

will -make sure that the buffer is zeroed in memory, and optimizations are not -allowed to impede this zeroing.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-This is not really 100% effective, since compilers may place copies

of -the string somewhere hidden in the stack. Those copies won't get zeroed -by explicit_bzero(3). However, that's arguably a compiler bug, since -compilers should make everything possible to avoid optimizing strings -that are later passed to explicit_bzero(3). But we all know that -sometimes it's impossible to have perfect knowledge in the compiler, so -this is plausible. Nevertheless, there's nothing we can do against such -issues, except minimizing the time such passwords are stored in plain -text.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Security concerns
-~~~~~~~~~~~~~~~~~
-
-We believe this isn't easy to exploit.  Nevertheless, and since the

fix -is trivial, this fix should probably be applied soon, and backported to -all supported distributions, to prevent someone else having more -imagination than us to find a way.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Affected versions
-~~~~~~~~~~~~~~~~~
-
-All.  Bug introduced in shadow 19990709.  That's the second commit

in -the git history.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Fixes: 45c6603cc86c ("[svn-upgrade] Integrating new upstream

version, shadow (19990709)")

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -3
-
-CVE: CVE-2023-4641
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/65c88a43a23c2391dcc90
c0abda3e839e9c57904]

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -18
-
-Reported-by: Alejandro Colomar <[email protected]>
-Cc: Serge Hallyn <[email protected]>
-Cc: Iker Pedrosa <[email protected]>
-Cc: Seth Arnold <[email protected]>
-Cc: Christian Brauner <[email protected]>
-Cc: Balint Reczey <[email protected]>
-Cc: Sam James <[email protected]>
-Cc: David Runge <[email protected]>
-Cc: Andreas Jaeger <[email protected]>
-Cc: <~hallyn/[email protected]>
-Signed-off-by: Alejandro Colomar <[email protected]>
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- src/gpasswd.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/gpasswd.c b/src/gpasswd.c -index

5983f787..2d8869ef 100644
---- a/src/gpasswd.c
-+++ b/src/gpasswd.c
-@@ -896,6 +896,7 @@ static void change_passwd (struct group *gr)

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -10
-             strzero (cp);
-             cp = getpass (_("Re-enter new password: "));
-             if (NULL == cp) {
-+                    memzero (pass, sizeof pass);
-                     exit (1);
-             }
-
---
-2.34.1
-

diff --git a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch index 85d91751056..4a932d2dbb1 100644
---
a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch
+++ b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-o +++ pen-failure-in-chroot-env.patch

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
@@ -1,4 +1,4 @@
-From 21583da072aa66901d859ac00ce209bac87ddecc Mon Sep 17 00:00:00

2001
+From a773c6b240d27e23d6be41decef0edf24fcee523 Mon Sep 17 00:00:00 +2001
From: Chen Qi <[email protected]>
Date: Thu, 17 Jul 2014 15:53:34 +0800
Subject: [PATCH]
commonio.c-fix-unexpected-open-failure-in-chroot-env

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
@@ -15,35 +15,37 @@ Note that this patch doesn't change the logic in the code, it just expands
   the codes.
 
   Signed-off-by: Chen Qi <[email protected]>
-
   ---
    lib/commonio.c | 16 ++++++++++++----
    1 file changed, 12 insertions(+), 4 deletions(-)
 
   diff --git a/lib/commonio.c b/lib/commonio.c -index

9a02ce1..61384ec 100644
+index 73fdb3a..d1231e9 100644
--- a/lib/commonio.c
+++ b/lib/commonio.c
-@@ -616,10 +616,18 @@ int commonio_open (struct commonio_db *db, int mode)
+@@ -606,10 +606,18 @@ int commonio_open (struct commonio_db *db,

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +9 -3
+int mode)
       db->cursor = NULL;
       db->changed = false;
 
   -   fd = open (db->filename,
   -                (db->readonly ? O_RDONLY : O_RDWR)
--               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
+-               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);
   -   saved_errno = errno;
   +   if (db->readonly) {
   +           fd = open (db->filename,
   +                      (true ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW |
++ O_CLOEXEC);
   +           saved_errno = errno;
   +   } else {
   +           fd = open (db->filename,
   +                      (false ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW|
++ O_CLOEXEC);
   +           saved_errno = errno;
   +   }
   +
       db->fp = NULL;
       if (fd >= 0) {
    #ifdef WITH_TCB
+--
+2.30.2
+
meta/recipes-extended/shadow/shadow.inc +4 -11
index ce3ce627156..c024746d4ff 100644
@@ -5,7 +5,7 @@ BUGTRACKER = "http://github.com/shadow-maint/shadow/issues"
   SECTION = "base/utils"
   LICENSE = "BSD-3-Clause"
   LIC_FILES_CHKSUM = "file://COPYING;md5=c9a450b7be84eac23e6353efecb60b5b \
-                    file://src/passwd.c;beginline=2;endline=30;md5=758c26751513b6795395275969dd3be1 \
+
+ file://src/passwd.c;beginline=2;endline=7;md5=67bcf314687820b2f010
+ d4863fce3fc5 \
                       "
 
   DEPENDS = "virtual/crypt"
@@ -14,10 +14,6 @@ GITHUB_BASE_URI = "https://github.com/shadow-maint/shadow/releases"
   SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
              ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
              file://useradd \
-        file://0001-Fix-can-not-print-full-login.patch \
-           file://CVE-2023-29383.patch \
-           file://0001-Overhaul-valid_field.patch \
-           file://CVE-2023-4641.patch \
              "
 
   SRC_URI:append:class-target = " \
@@ -26,14 +22,9 @@ SRC_URI:append:class-target = " \
              "
 
   SRC_URI:append:class-native = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
              file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
              "
-SRC_URI:append:class-nativesdk = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
-           "
-SRC_URI[sha256sum] = "813057047499c7fe81108adcf0cffa3ad4ec75e19a80151f9cbaa458ff2e86cd"
-
+SRC_URI[sha256sum] = "a305edf5d19bddbdf5e836d2d609fa8bff2d35458819de4d9f06306a1cf24342"
 
   # Additional Policy files for PAM
   PAM_SRC_URI = "file://pam.d/chfn \ @@ -44,7 +35,7 @@ PAM_SRC_URI =
"file://pam.d/chfn \
                  file://pam.d/passwd \
                  file://pam.d/su"
meta/recipes-extended/shadow/shadow.inc +5 -2
-inherit autotools gettext github-releases
+inherit autotools gettext github-releases pkgconfig
 
   export CONFIG_SHELL="/bin/sh"
@@ -54,6 +45,8 @@ EXTRA_OECONF += "--without-libcrack \
                    --without-sssd \
                    ${NSCDOPT}"
 
+CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
+
   NSCDOPT = ""
   NSCDOPT:class-native = "--without-nscd"
   NSCDOPT:class-nativesdk = "--without-nscd"
@@ -73,13 +66,14 @@ PAM_PLUGINS = "libpam-runtime \
 
   PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
                      ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
-PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
+PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} libbsd"
   PACKAGECONFIG:class-nativesdk = ""
   PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
   PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
   PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl"
   PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit"
   PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage"
+PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"
 
   RDEPENDS:${PN} = "shadow-securetty \
                     base-passwd \
meta/recipes-extended/shadow/shadow_4.14.2.bb renamed from meta/recipes-extended/shadow/shadow_4.13.bb +0 -0
similarity index 100%
rename from meta/recipes-extended/shadow/shadow_4.13.bb
rename to meta/recipes-extended/shadow/shadow_4.14.2.bb
#17 lore raw

First you need to show how to reproduce it with plain poky.

Alex

Quoted 684 lines · Vyacheslav Yurkov

I'm getting the same "parameter name omitted" error with today's master of poky on Ubuntu-20.04 machine. Is there a fix for that?

Slava

Quoted 676 lines · Alexander Kanavin

I've seen issues where static libraries built on one host were not usable on a different host with default compiler options. This may be another one of these.

We're reverting to dynamic linking with libraries in a custom directory in sysroot that would be bundled together with shadow-native proper. Patch is coming.

Alex

Quoted 665 lines · Qi

I didn't do anything particular, but as several people are sharing the server, it's possible that its environment is somewhat messed up. I'll check more and fix the environment. Thanks for your double check.

Regards,
Qi

-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Friday, January 19, 2024 6:12 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]; Alexander Kanavin <[email protected]>
Subject: Re: [OE-core] [PATCH v3 1/2] shadow: update 4.13 -> 4.14.2

I just tried poky master on ubuntu 20.04, and the issues do not appear. Do you have a custom setup?

Alex

Quoted 648 lines · ChenQi

I'm seeing build failures on Ubuntu 20.04.
GCC version: 9.4.0

1. error: parameter name omitted
The problem is that the active_sessions_count function's definition lacks parameter. I did change like below:
-unsigned long active_sessions_count(const char *name, unsigned long unused)
+unsigned long active_sessions_count(const char *name, unsigned long unused unused_parameter)
But then I observed another error, as shown below.

2. undefined reference to `dlsym'.
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_exit':
| nss.c:(.text+0x32): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_init':
| nss.c:(.text+0x1dd): undefined reference to `dlopen'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x21c): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x237): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x253): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x365): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x3b2): undefined reference to `dlerror'
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:1130: su] Error 1

On Ubuntu22.04, there's no such issue.

Regards,
Qi

Quoted 610 lines · Alexander Kanavin

License-Update: formatting, spdx conversion

Drop:
0001-Disable-use-of-syslog-for-sysroot.patch
(issue fixed upstream)

0001-Fix-can-not-print-full-login.patch
0001-Overhaul-valid_field.patch
CVE-2023-29383.patch
(backports)

libbsd is a new native dependency, as otherwise glibc >= 2.38 is needed.

A similar fix is added to musl in order to define non-standard __BEGIN_DECLS/__END_DECLS.

---
   ...01-Disable-use-of-syslog-for-sysroot.patch |  52 -------
   .../0001-Fix-can-not-print-full-login.patch   |  41 -----
   .../files/0001-Overhaul-valid_field.patch     |  65 --------
   .../shadow/files/CVE-2023-29383.patch         |  53 -------
   .../shadow/files/CVE-2023-4641.patch          | 147 ------------------
   ...nexpected-open-failure-in-chroot-env.patch |  16 +-
   meta/recipes-extended/shadow/shadow.inc       |  20 +--
   .../{shadow_4.13.bb => shadow_4.14.2.bb}      |   0
   8 files changed, 16 insertions(+), 378 deletions(-)

delete mode 100644 meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-29383.patch
delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-4641.patch
rename meta/recipes-extended/shadow/{shadow_4.13.bb =>
shadow_4.14.2.bb} (100%)

diff --git a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch b/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch
deleted file mode 100644
index fa1532c8317..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch
+++ /dev/null

(quoted diff) +0 -1
@@ -1,52 +0,0 @@
-From 85d0444229ee3d14fefcf10d093f49c862826f82 Mon Sep 17 00:00:00

2001

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -5
-From: Richard Purdie <[email protected]>
-Date: Thu, 14 Apr 2022 23:11:53 +0000
-Subject: [PATCH] Disable use of syslog for shadow-native tools
-
-Disable use of syslog to prevent sysroot user and group additions

from -writing entries to the host's syslog. This patch should only be used -with the shadow-native recipe.

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -11
-
-Upstream-Status: Inappropriate [OE specific configuration]
-Signed-off-by: Richard Purdie <[email protected]>
-Signed-off-by: Peter Kjellerstedt <[email protected]>
-
----
- configure.ac      | 2 +-
- src/login_nopam.c | 3 ++-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac -index 924254a..603af81

100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -191,7 +191,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -9
-     [Path to passwd program.])
-
- dnl XXX - quick hack, should disappear before anyone notices :).
--AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
-+#AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
- if test "$ac_cv_func_ruserok" = "yes"; then
-     AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
-     AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
-diff --git a/src/login_nopam.c b/src/login_nopam.c -index

df6ba88..fc24e13 100644
---- a/src/login_nopam.c
-+++ b/src/login_nopam.c
-@@ -29,7 +29,6 @@
- #ifndef USE_PAM
- #ident "$Id$"

meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch deleted +0 -14
-
--#include "prototypes.h"
-     /*
-      * This module implements a simple but effective form of login access
-      * control based on login names and on host (or domain) names, internet
-@@ -57,6 +56,8 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>              /* for inet_ntoa() */
-
-+#include "prototypes.h"
-+
- #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
- #undef MAXHOSTNAMELEN
- #define MAXHOSTNAMELEN 256

diff --git a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch b/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch
deleted file mode 100644
index 89f9c05c8d3..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch
+++ /dev/null

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -10
@@ -1,41 +0,0 @@
-commit 670cae834827a8f794e6f7464fa57790d911b63c
-Author: SoumyaWind <[email protected]>
-Date:   Tue Dec 27 17:40:17 2022 +0530
-
-    shadow: Fix can not print full login timeout message
-
-    Login timed out message prints only first few bytes when write is immediately followed by exit.
-    Calling exit from new handler provides enough time to display full message.
-
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/670cae834827a8f794e6f
7464fa57790d911b63c]

(quoted diff) +0 -2
-
-diff --git a/src/login.c b/src/login.c -index 116e2cb3..c55f4de0

100644
---- a/src/login.c
-+++ b/src/login.c
-@@ -120,6 +120,7 @@ static void get_pam_user (char **ptr_pam_user);

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -7
-
- static void init_env (void);
- static void alarm_handler (int);
-+static void exit_handler (int);
-
- /*
-  * usage - print login command usage and exit -@@ -391,11 +392,16

@@ static void init_env (void)
- #endif /* !USE_PAM */
- }

meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch deleted +0 -14
-
-+static void exit_handler (unused int sig) {
-+    _exit (0);
-+}
-
- static void alarm_handler (unused int sig)
- {
-     write (STDERR_FILENO, tmsg, strlen (tmsg));
--    _exit (0);
-+    signal(SIGALRM, exit_handler);
-+    alarm(2);
- }
-
- #ifdef USE_PAM

diff --git a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch b/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted file mode 100644
index ac08be515bf..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch +++ /dev/null

(quoted diff) +0 -1
@@ -1,65 +0,0 @@
-From 2eaea70111f65b16d55998386e4ceb4273c19eb4 Mon Sep 17 00:00:00

2001
-From: =?UTF-8?q?Christian=20G=C3=B6ttsche?=
<[email protected]>

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -8
-Date: Fri, 31 Mar 2023 14:46:50 +0200
-Subject: [PATCH] Overhaul valid_field()
-
-e5905c4b ("Added control character check") introduced checking for
-control characters but had the logic inverted, so it rejects all
-characters that are not control ones.
-
-Cast the character to `unsigned char` before passing to the

character -checking functions to avoid UB.

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -4
-
-Use strpbrk(3) for the illegal character test and return early.
-
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/2eaea70111f65b16d5599
8386e4ceb4273c19eb4]

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 24 ++++++++++--------------
- 1 file changed, 10 insertions(+), 14 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index fb51b582..53929248

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -37,26 +37,22 @@ int valid_field (const char *field, const char *illegal)

meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted +0 -39
-
-     /* For each character of field, search if it appears in the list
-      * of illegal characters. */
-+    if (illegal && NULL != strpbrk (field, illegal)) {
-+            return -1;
-+    }
-+
-+    /* Search if there are non-printable or control characters */
-     for (cp = field; '\0' != *cp; cp++) {
--            if (strchr (illegal, *cp) != NULL) {
-+            unsigned char c = *cp;
-+            if (!isprint (c)) {
-+                    err = 1;
-+            }
-+            if (iscntrl (c)) {
-                     err = -1;
-                     break;
-             }
-     }
-
--    if (0 == err) {
--            /* Search if there are non-printable or control characters */
--            for (cp = field; '\0' != *cp; cp++) {
--                    if (!isprint (*cp)) {
--                            err = 1;
--                    }
--                    if (!iscntrl (*cp)) {
--                            err = -1;
--                            break;
--                    }
--            }
--    }
--
-     return err;
- }
-
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -1
deleted file mode 100644
index f53341d3fc2..00000000000
@@ -1,53 +0,0 @@
-From e5905c4b84d4fb90aefcd96ee618411ebfac663d Mon Sep 17 00:00:00

2001
-From: tomspiderlabs <[email protected]>

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -10
-Date: Thu, 23 Mar 2023 23:39:38 +0000
-Subject: [PATCH] Added control character check
-
-Added control character check, returning -1 (to "err") if control characters are present.
-
-CVE: CVE-2023-29383
-Upstream-Status: Backport
-
-Reference to upstream:
-https://github.com/shadow-maint/shadow/commit/e5905c4b84d4fb90aefcd

96ee618411ebfac663d

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index 640be931..fb51b582

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -21,9 +21,9 @@

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -2
-  *
-  * The supplied field is scanned for non-printable and other

illegal

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -29
-  * characters.
-- *  + -1 is returned if an illegal character is present.
-- *  +  1 is returned if no illegal characters are present, but the field
-- *       contains a non-printable character.
-+ *  + -1 is returned if an illegal or control character is present.
-+ *  +  1 is returned if no illegal or control characters are present,
-+ *       but the field contains a non-printable character.
-  *  +  0 is returned otherwise.
-  */
- int valid_field (const char *field, const char *illegal) -@@
-45,10 +45,13 @@ int valid_field (const char *field, const char *illegal)
-     }
-
-     if (0 == err) {
--            /* Search if there are some non-printable characters */
-+            /* Search if there are non-printable or control
-+ characters */
-             for (cp = field; '\0' != *cp; cp++) {
-                     if (!isprint (*cp)) {
-                             err = 1;
-+                    }
-+                    if (!iscntrl (*cp)) {
-+                            err = -1;
-                             break;
-                     }
-             }
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
deleted file mode 100644
index 1fabfe928e4..00000000000
@@ -1,147 +0,0 @@
-From 25dbe2ce166a13322b7536ff2f738786ea2e61e7 Mon Sep 17 00:00:00

2001

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -8
-From: Alejandro Colomar <[email protected]>
-Date: Sat, 10 Jun 2023 16:20:05 +0200
-Subject: [PATCH] gpasswd(1): Fix password leak
-
-How to trigger this password leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When gpasswd(1) asks for the new password, it asks twice (as is

usual -for confirming the new password). Each of those 2 password prompts -uses agetpass() to get the password. If the second agetpass() fails, -the first password, which has been copied into the 'static' buffer -'pass' via STRFCPY(), wasn't being zeroed.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-agetpass() is defined in <./libmisc/agetpass.c> (around line 91),

and -can fail for any of the following reasons:

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -17
-
--  malloc(3) or readpassphrase(3) failure.
-
-   These are going to be difficult to trigger.  Maybe getting the system
-   to the limits of memory utilization at that exact point, so that the
-   next malloc(3) gets ENOMEM, and possibly even the OOM is triggered.
-   About readpassphrase(3), ENFILE and EINTR seem the only plausible
-   ones, and EINTR probably requires privilege or being the same user;
-   but I wouldn't discard ENFILE so easily, if a process starts opening
-   files.
-
--  The password is longer than PASS_MAX.
-
-   The is plausible with physical access.  However, at that point, a
-   keylogger will be a much simpler attack.
-
-And, the attacker must be able to know when the second password is

being -introduced, which is not going to be easy.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-How to read the password after the leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Provoking the leak yourself at the right point by entering a very

long -password is easy, and inspecting the process stack at that point should -be doable. Try to find some consistent patterns.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Then, search for those patterns in free memory, right after the

victim -leaks their password.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -42
-
-Once you get the leak, a program should read all the free memory
-searching for patterns that gpasswd(1) leaves nearby the leaked
-password.
-
-On 6/10/23 03:14, Seth Arnold wrote:
-> An attacker process wouldn't be able to use malloc(3) for this task.
-> There's a handful of tools available for userspace to allocate memory:
->
-> -  brk / sbrk
-> -  mmap MAP_ANONYMOUS
-> -  mmap /dev/zero
-> -  mmap some other file
-> -  shm_open
-> -  shmget
->
-> Most of these return only pages of zeros to a process.  Using
-> mmap of an existing file, you can get some of the contents of the
-> file demand-loaded into the memory space on the first use.
->
-> The MAP_UNINITIALIZED flag only works if the kernel was compiled
-> with CONFIG_MMAP_ALLOW_UNINITIALIZED.  This is rare.
->
-> malloc(3) doesn't zero memory, to our collective frustration, but
-> all the garbage in the allocations is from previous allocations
-> in the current process.  It isn't leftover from other processes.
->
-> The avenues available for reading the memory:
-> -  /dev/mem and /dev/kmem (requires root, not available with
-> Secure Boot)
-> -  /proc/pid/mem (requires ptrace privileges, mediated by YAMA)
-> -  ptrace (requires ptrace privileges, mediated by YAMA)
-> -  causing memory to be swapped to disk, and then inspecting the
-> swap
->
-> These all require a certain amount of privileges.
-
-How to fix it?
-~~~~~~~~~~~~~~
-
-memzero(), which internally calls explicit_bzero(3), or whatever
-alternative the system provides with a slightly different name,

will -make sure that the buffer is zeroed in memory, and optimizations are not -allowed to impede this zeroing.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-This is not really 100% effective, since compilers may place copies

of -the string somewhere hidden in the stack. Those copies won't get zeroed -by explicit_bzero(3). However, that's arguably a compiler bug, since -compilers should make everything possible to avoid optimizing strings -that are later passed to explicit_bzero(3). But we all know that -sometimes it's impossible to have perfect knowledge in the compiler, so -this is plausible. Nevertheless, there's nothing we can do against such -issues, except minimizing the time such passwords are stored in plain -text.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Security concerns
-~~~~~~~~~~~~~~~~~
-
-We believe this isn't easy to exploit.  Nevertheless, and since the

fix -is trivial, this fix should probably be applied soon, and backported to -all supported distributions, to prevent someone else having more -imagination than us to find a way.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Affected versions
-~~~~~~~~~~~~~~~~~
-
-All.  Bug introduced in shadow 19990709.  That's the second commit

in -the git history.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Fixes: 45c6603cc86c ("[svn-upgrade] Integrating new upstream

version, shadow (19990709)")

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -3
-
-CVE: CVE-2023-4641
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/65c88a43a23c2391dcc90
c0abda3e839e9c57904]

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -18
-
-Reported-by: Alejandro Colomar <[email protected]>
-Cc: Serge Hallyn <[email protected]>
-Cc: Iker Pedrosa <[email protected]>
-Cc: Seth Arnold <[email protected]>
-Cc: Christian Brauner <[email protected]>
-Cc: Balint Reczey <[email protected]>
-Cc: Sam James <[email protected]>
-Cc: David Runge <[email protected]>
-Cc: Andreas Jaeger <[email protected]>
-Cc: <~hallyn/[email protected]>
-Signed-off-by: Alejandro Colomar <[email protected]>
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- src/gpasswd.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/gpasswd.c b/src/gpasswd.c -index

5983f787..2d8869ef 100644
---- a/src/gpasswd.c
-+++ b/src/gpasswd.c
-@@ -896,6 +896,7 @@ static void change_passwd (struct group *gr)

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -10
-             strzero (cp);
-             cp = getpass (_("Re-enter new password: "));
-             if (NULL == cp) {
-+                    memzero (pass, sizeof pass);
-                     exit (1);
-             }
-
---
-2.34.1
-

diff --git a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch index 85d91751056..4a932d2dbb1 100644
---
a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch
+++ b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-o +++ pen-failure-in-chroot-env.patch

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
@@ -1,4 +1,4 @@
-From 21583da072aa66901d859ac00ce209bac87ddecc Mon Sep 17 00:00:00

2001
+From a773c6b240d27e23d6be41decef0edf24fcee523 Mon Sep 17 00:00:00 +2001
From: Chen Qi <[email protected]>
Date: Thu, 17 Jul 2014 15:53:34 +0800
Subject: [PATCH]
commonio.c-fix-unexpected-open-failure-in-chroot-env

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
@@ -15,35 +15,37 @@ Note that this patch doesn't change the logic in the code, it just expands
   the codes.
 
   Signed-off-by: Chen Qi <[email protected]>
-
   ---
    lib/commonio.c | 16 ++++++++++++----
    1 file changed, 12 insertions(+), 4 deletions(-)
 
   diff --git a/lib/commonio.c b/lib/commonio.c -index

9a02ce1..61384ec 100644
+index 73fdb3a..d1231e9 100644
--- a/lib/commonio.c
+++ b/lib/commonio.c
-@@ -616,10 +616,18 @@ int commonio_open (struct commonio_db *db, int mode)
+@@ -606,10 +606,18 @@ int commonio_open (struct commonio_db *db,

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +9 -3
+int mode)
       db->cursor = NULL;
       db->changed = false;
 
   -   fd = open (db->filename,
   -                (db->readonly ? O_RDONLY : O_RDWR)
--               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
+-               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);
   -   saved_errno = errno;
   +   if (db->readonly) {
   +           fd = open (db->filename,
   +                      (true ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW |
++ O_CLOEXEC);
   +           saved_errno = errno;
   +   } else {
   +           fd = open (db->filename,
   +                      (false ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW|
++ O_CLOEXEC);
   +           saved_errno = errno;
   +   }
   +
       db->fp = NULL;
       if (fd >= 0) {
    #ifdef WITH_TCB
+--
+2.30.2
+
meta/recipes-extended/shadow/shadow.inc +4 -11
index ce3ce627156..c024746d4ff 100644
@@ -5,7 +5,7 @@ BUGTRACKER = "http://github.com/shadow-maint/shadow/issues"
   SECTION = "base/utils"
   LICENSE = "BSD-3-Clause"
   LIC_FILES_CHKSUM = "file://COPYING;md5=c9a450b7be84eac23e6353efecb60b5b \
-                    file://src/passwd.c;beginline=2;endline=30;md5=758c26751513b6795395275969dd3be1 \
+
+ file://src/passwd.c;beginline=2;endline=7;md5=67bcf314687820b2f010
+ d4863fce3fc5 \
                       "
 
   DEPENDS = "virtual/crypt"
@@ -14,10 +14,6 @@ GITHUB_BASE_URI = "https://github.com/shadow-maint/shadow/releases"
   SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
              ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
              file://useradd \
-        file://0001-Fix-can-not-print-full-login.patch \
-           file://CVE-2023-29383.patch \
-           file://0001-Overhaul-valid_field.patch \
-           file://CVE-2023-4641.patch \
              "
 
   SRC_URI:append:class-target = " \
@@ -26,14 +22,9 @@ SRC_URI:append:class-target = " \
              "
 
   SRC_URI:append:class-native = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
              file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
              "
-SRC_URI:append:class-nativesdk = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
-           "
-SRC_URI[sha256sum] = "813057047499c7fe81108adcf0cffa3ad4ec75e19a80151f9cbaa458ff2e86cd"
-
+SRC_URI[sha256sum] = "a305edf5d19bddbdf5e836d2d609fa8bff2d35458819de4d9f06306a1cf24342"
 
   # Additional Policy files for PAM
   PAM_SRC_URI = "file://pam.d/chfn \ @@ -44,7 +35,7 @@ PAM_SRC_URI =
"file://pam.d/chfn \
                  file://pam.d/passwd \
                  file://pam.d/su"
meta/recipes-extended/shadow/shadow.inc +5 -2
-inherit autotools gettext github-releases
+inherit autotools gettext github-releases pkgconfig
 
   export CONFIG_SHELL="/bin/sh"
@@ -54,6 +45,8 @@ EXTRA_OECONF += "--without-libcrack \
                    --without-sssd \
                    ${NSCDOPT}"
 
+CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
+
   NSCDOPT = ""
   NSCDOPT:class-native = "--without-nscd"
   NSCDOPT:class-nativesdk = "--without-nscd"
@@ -73,13 +66,14 @@ PAM_PLUGINS = "libpam-runtime \
 
   PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
                      ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
-PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
+PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} libbsd"
   PACKAGECONFIG:class-nativesdk = ""
   PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
   PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
   PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl"
   PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit"
   PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage"
+PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"
 
   RDEPENDS:${PN} = "shadow-securetty \
                     base-passwd \
meta/recipes-extended/shadow/shadow_4.14.2.bb renamed from meta/recipes-extended/shadow/shadow_4.13.bb +0 -0
similarity index 100%
rename from meta/recipes-extended/shadow/shadow_4.13.bb
rename to meta/recipes-extended/shadow/shadow_4.14.2.bb
#18 lore raw

I only ran 'oe-selftest -r overlayfs.OverlayFSEtcRunTimeTest' on a fresh poky clone with SANITY_TESTED_DISTROS = "" set in local.conf.

I'm trying now the build with this commit reverted.

Slava

Quoted 687 lines · Alexander Kanavin

First you need to show how to reproduce it with plain poky.

Alex

Quoted 682 lines · Vyacheslav Yurkov

I'm getting the same "parameter name omitted" error with today's master of poky on Ubuntu-20.04 machine. Is there a fix for that?

Slava

Quoted 676 lines · Alexander Kanavin

I've seen issues where static libraries built on one host were not usable on a different host with default compiler options. This may be another one of these.

We're reverting to dynamic linking with libraries in a custom directory in sysroot that would be bundled together with shadow-native proper. Patch is coming.

Alex

Quoted 665 lines · Qi

I didn't do anything particular, but as several people are sharing the server, it's possible that its environment is somewhat messed up. I'll check more and fix the environment. Thanks for your double check.

Regards,
Qi

-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Friday, January 19, 2024 6:12 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]; Alexander Kanavin <[email protected]>
Subject: Re: [OE-core] [PATCH v3 1/2] shadow: update 4.13 -> 4.14.2

I just tried poky master on ubuntu 20.04, and the issues do not appear. Do you have a custom setup?

Alex

Quoted 648 lines · ChenQi

I'm seeing build failures on Ubuntu 20.04.
GCC version: 9.4.0

1. error: parameter name omitted
The problem is that the active_sessions_count function's definition lacks parameter. I did change like below:
-unsigned long active_sessions_count(const char *name, unsigned long unused)
+unsigned long active_sessions_count(const char *name, unsigned long unused unused_parameter)
But then I observed another error, as shown below.

2. undefined reference to `dlsym'.
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_exit':
| nss.c:(.text+0x32): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_init':
| nss.c:(.text+0x1dd): undefined reference to `dlopen'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x21c): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x237): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x253): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x365): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x3b2): undefined reference to `dlerror'
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:1130: su] Error 1

On Ubuntu22.04, there's no such issue.

Regards,
Qi

Quoted 610 lines · Alexander Kanavin

License-Update: formatting, spdx conversion

Drop:
0001-Disable-use-of-syslog-for-sysroot.patch
(issue fixed upstream)

0001-Fix-can-not-print-full-login.patch
0001-Overhaul-valid_field.patch
CVE-2023-29383.patch
(backports)

libbsd is a new native dependency, as otherwise glibc >= 2.38 is needed.

A similar fix is added to musl in order to define non-standard __BEGIN_DECLS/__END_DECLS.

---
    ...01-Disable-use-of-syslog-for-sysroot.patch |  52 -------
    .../0001-Fix-can-not-print-full-login.patch   |  41 -----
    .../files/0001-Overhaul-valid_field.patch     |  65 --------
    .../shadow/files/CVE-2023-29383.patch         |  53 -------
    .../shadow/files/CVE-2023-4641.patch          | 147 ------------------
    ...nexpected-open-failure-in-chroot-env.patch |  16 +-
    meta/recipes-extended/shadow/shadow.inc       |  20 +--
    .../{shadow_4.13.bb => shadow_4.14.2.bb}      |   0
    8 files changed, 16 insertions(+), 378 deletions(-)

delete mode 100644 meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-29383.patch
delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-4641.patch
rename meta/recipes-extended/shadow/{shadow_4.13.bb =>
shadow_4.14.2.bb} (100%)

diff --git a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch b/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch
deleted file mode 100644
index fa1532c8317..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for- sysroot.patch
+++ /dev/null

(quoted diff) +0 -1
@@ -1,52 +0,0 @@
-From 85d0444229ee3d14fefcf10d093f49c862826f82 Mon Sep 17 00:00:00

2001

(quoted diff) +0 -5
-From: Richard Purdie <[email protected]>
-Date: Thu, 14 Apr 2022 23:11:53 +0000
-Subject: [PATCH] Disable use of syslog for shadow-native tools
-
-Disable use of syslog to prevent sysroot user and group additions

from -writing entries to the host's syslog. This patch should only be used -with the shadow-native recipe.

(quoted diff) +0 -11
-
-Upstream-Status: Inappropriate [OE specific configuration]
-Signed-off-by: Richard Purdie <[email protected]>
-Signed-off-by: Peter Kjellerstedt <[email protected]>
-
----
- configure.ac      | 2 +-
- src/login_nopam.c | 3 ++-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac -index 924254a..603af81

100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -191,7 +191,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",

(quoted diff) +0 -9
-     [Path to passwd program.])
-
- dnl XXX - quick hack, should disappear before anyone notices :).
--AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
-+#AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
- if test "$ac_cv_func_ruserok" = "yes"; then
-     AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
-     AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
-diff --git a/src/login_nopam.c b/src/login_nopam.c -index

df6ba88..fc24e13 100644
---- a/src/login_nopam.c
-+++ b/src/login_nopam.c
-@@ -29,7 +29,6 @@
- #ifndef USE_PAM
- #ident "$Id$"

(quoted diff) +0 -14
-
--#include "prototypes.h"
-     /*
-      * This module implements a simple but effective form of login access
-      * control based on login names and on host (or domain) names, internet
-@@ -57,6 +56,8 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>              /* for inet_ntoa() */
-
-+#include "prototypes.h"
-+
- #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
- #undef MAXHOSTNAMELEN
- #define MAXHOSTNAMELEN 256

diff --git a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch b/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch
deleted file mode 100644
index 89f9c05c8d3..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log in.patch
+++ /dev/null

(quoted diff) +0 -10
@@ -1,41 +0,0 @@
-commit 670cae834827a8f794e6f7464fa57790d911b63c
-Author: SoumyaWind <[email protected]>
-Date:   Tue Dec 27 17:40:17 2022 +0530
-
-    shadow: Fix can not print full login timeout message
-
-    Login timed out message prints only first few bytes when write is immediately followed by exit.
-    Calling exit from new handler provides enough time to display full message.
-
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/670cae834827a8f794e6f
7464fa57790d911b63c]

(quoted diff) +0 -2
-
-diff --git a/src/login.c b/src/login.c -index 116e2cb3..c55f4de0

100644
---- a/src/login.c
-+++ b/src/login.c
-@@ -120,6 +120,7 @@ static void get_pam_user (char **ptr_pam_user);

(quoted diff) +0 -7
-
- static void init_env (void);
- static void alarm_handler (int);
-+static void exit_handler (int);
-
- /*
-  * usage - print login command usage and exit -@@ -391,11 +392,16

@@ static void init_env (void)
- #endif /* !USE_PAM */
- }

(quoted diff) +0 -14
-
-+static void exit_handler (unused int sig) {
-+    _exit (0);
-+}
-
- static void alarm_handler (unused int sig)
- {
-     write (STDERR_FILENO, tmsg, strlen (tmsg));
--    _exit (0);
-+    signal(SIGALRM, exit_handler);
-+    alarm(2);
- }
-
- #ifdef USE_PAM

diff --git a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch b/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch deleted file mode 100644
index ac08be515bf..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch +++ /dev/null

(quoted diff) +0 -1
@@ -1,65 +0,0 @@
-From 2eaea70111f65b16d55998386e4ceb4273c19eb4 Mon Sep 17 00:00:00

2001
-From: =?UTF-8?q?Christian=20G=C3=B6ttsche?=
<[email protected]>

(quoted diff) +0 -8
-Date: Fri, 31 Mar 2023 14:46:50 +0200
-Subject: [PATCH] Overhaul valid_field()
-
-e5905c4b ("Added control character check") introduced checking for
-control characters but had the logic inverted, so it rejects all
-characters that are not control ones.
-
-Cast the character to `unsigned char` before passing to the

character -checking functions to avoid UB.

(quoted diff) +0 -4
-
-Use strpbrk(3) for the illegal character test and return early.
-
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/2eaea70111f65b16d5599
8386e4ceb4273c19eb4]

(quoted diff) +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 24 ++++++++++--------------
- 1 file changed, 10 insertions(+), 14 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index fb51b582..53929248

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -37,26 +37,22 @@ int valid_field (const char *field, const char *illegal)

(quoted diff) +0 -39
-
-     /* For each character of field, search if it appears in the list
-      * of illegal characters. */
-+    if (illegal && NULL != strpbrk (field, illegal)) {
-+            return -1;
-+    }
-+
-+    /* Search if there are non-printable or control characters */
-     for (cp = field; '\0' != *cp; cp++) {
--            if (strchr (illegal, *cp) != NULL) {
-+            unsigned char c = *cp;
-+            if (!isprint (c)) {
-+                    err = 1;
-+            }
-+            if (iscntrl (c)) {
-                     err = -1;
-                     break;
-             }
-     }
-
--    if (0 == err) {
--            /* Search if there are non-printable or control characters */
--            for (cp = field; '\0' != *cp; cp++) {
--                    if (!isprint (*cp)) {
--                            err = 1;
--                    }
--                    if (!iscntrl (*cp)) {
--                            err = -1;
--                            break;
--                    }
--            }
--    }
--
-     return err;
- }
-
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -1
deleted file mode 100644
index f53341d3fc2..00000000000
@@ -1,53 +0,0 @@
-From e5905c4b84d4fb90aefcd96ee618411ebfac663d Mon Sep 17 00:00:00

2001
-From: tomspiderlabs <[email protected]>

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -10
-Date: Thu, 23 Mar 2023 23:39:38 +0000
-Subject: [PATCH] Added control character check
-
-Added control character check, returning -1 (to "err") if control characters are present.
-
-CVE: CVE-2023-29383
-Upstream-Status: Backport
-
-Reference to upstream:
-https://github.com/shadow-maint/shadow/commit/e5905c4b84d4fb90aefcd

96ee618411ebfac663d

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index 640be931..fb51b582

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -21,9 +21,9 @@

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -2
-  *
-  * The supplied field is scanned for non-printable and other

illegal

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -29
-  * characters.
-- *  + -1 is returned if an illegal character is present.
-- *  +  1 is returned if no illegal characters are present, but the field
-- *       contains a non-printable character.
-+ *  + -1 is returned if an illegal or control character is present.
-+ *  +  1 is returned if no illegal or control characters are present,
-+ *       but the field contains a non-printable character.
-  *  +  0 is returned otherwise.
-  */
- int valid_field (const char *field, const char *illegal) -@@
-45,10 +45,13 @@ int valid_field (const char *field, const char *illegal)
-     }
-
-     if (0 == err) {
--            /* Search if there are some non-printable characters */
-+            /* Search if there are non-printable or control
-+ characters */
-             for (cp = field; '\0' != *cp; cp++) {
-                     if (!isprint (*cp)) {
-                             err = 1;
-+                    }
-+                    if (!iscntrl (*cp)) {
-+                            err = -1;
-                             break;
-                     }
-             }
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
deleted file mode 100644
index 1fabfe928e4..00000000000
@@ -1,147 +0,0 @@
-From 25dbe2ce166a13322b7536ff2f738786ea2e61e7 Mon Sep 17 00:00:00

2001

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -8
-From: Alejandro Colomar <[email protected]>
-Date: Sat, 10 Jun 2023 16:20:05 +0200
-Subject: [PATCH] gpasswd(1): Fix password leak
-
-How to trigger this password leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When gpasswd(1) asks for the new password, it asks twice (as is

usual -for confirming the new password). Each of those 2 password prompts -uses agetpass() to get the password. If the second agetpass() fails, -the first password, which has been copied into the 'static' buffer -'pass' via STRFCPY(), wasn't being zeroed.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-agetpass() is defined in <./libmisc/agetpass.c> (around line 91),

and -can fail for any of the following reasons:

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -17
-
--  malloc(3) or readpassphrase(3) failure.
-
-   These are going to be difficult to trigger.  Maybe getting the system
-   to the limits of memory utilization at that exact point, so that the
-   next malloc(3) gets ENOMEM, and possibly even the OOM is triggered.
-   About readpassphrase(3), ENFILE and EINTR seem the only plausible
-   ones, and EINTR probably requires privilege or being the same user;
-   but I wouldn't discard ENFILE so easily, if a process starts opening
-   files.
-
--  The password is longer than PASS_MAX.
-
-   The is plausible with physical access.  However, at that point, a
-   keylogger will be a much simpler attack.
-
-And, the attacker must be able to know when the second password is

being -introduced, which is not going to be easy.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-How to read the password after the leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Provoking the leak yourself at the right point by entering a very

long -password is easy, and inspecting the process stack at that point should -be doable. Try to find some consistent patterns.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Then, search for those patterns in free memory, right after the

victim -leaks their password.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -42
-
-Once you get the leak, a program should read all the free memory
-searching for patterns that gpasswd(1) leaves nearby the leaked
-password.
-
-On 6/10/23 03:14, Seth Arnold wrote:
-> An attacker process wouldn't be able to use malloc(3) for this task.
-> There's a handful of tools available for userspace to allocate memory:
->
-> -  brk / sbrk
-> -  mmap MAP_ANONYMOUS
-> -  mmap /dev/zero
-> -  mmap some other file
-> -  shm_open
-> -  shmget
->
-> Most of these return only pages of zeros to a process.  Using
-> mmap of an existing file, you can get some of the contents of the
-> file demand-loaded into the memory space on the first use.
->
-> The MAP_UNINITIALIZED flag only works if the kernel was compiled
-> with CONFIG_MMAP_ALLOW_UNINITIALIZED.  This is rare.
->
-> malloc(3) doesn't zero memory, to our collective frustration, but
-> all the garbage in the allocations is from previous allocations
-> in the current process.  It isn't leftover from other processes.
->
-> The avenues available for reading the memory:
-> -  /dev/mem and /dev/kmem (requires root, not available with
-> Secure Boot)
-> -  /proc/pid/mem (requires ptrace privileges, mediated by YAMA)
-> -  ptrace (requires ptrace privileges, mediated by YAMA)
-> -  causing memory to be swapped to disk, and then inspecting the
-> swap
->
-> These all require a certain amount of privileges.
-
-How to fix it?
-~~~~~~~~~~~~~~
-
-memzero(), which internally calls explicit_bzero(3), or whatever
-alternative the system provides with a slightly different name,

will -make sure that the buffer is zeroed in memory, and optimizations are not -allowed to impede this zeroing.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-This is not really 100% effective, since compilers may place copies

of -the string somewhere hidden in the stack. Those copies won't get zeroed -by explicit_bzero(3). However, that's arguably a compiler bug, since -compilers should make everything possible to avoid optimizing strings -that are later passed to explicit_bzero(3). But we all know that -sometimes it's impossible to have perfect knowledge in the compiler, so -this is plausible. Nevertheless, there's nothing we can do against such -issues, except minimizing the time such passwords are stored in plain -text.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Security concerns
-~~~~~~~~~~~~~~~~~
-
-We believe this isn't easy to exploit.  Nevertheless, and since the

fix -is trivial, this fix should probably be applied soon, and backported to -all supported distributions, to prevent someone else having more -imagination than us to find a way.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Affected versions
-~~~~~~~~~~~~~~~~~
-
-All.  Bug introduced in shadow 19990709.  That's the second commit

in -the git history.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Fixes: 45c6603cc86c ("[svn-upgrade] Integrating new upstream

version, shadow (19990709)")

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -3
-
-CVE: CVE-2023-4641
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/65c88a43a23c2391dcc90
c0abda3e839e9c57904]

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -18
-
-Reported-by: Alejandro Colomar <[email protected]>
-Cc: Serge Hallyn <[email protected]>
-Cc: Iker Pedrosa <[email protected]>
-Cc: Seth Arnold <[email protected]>
-Cc: Christian Brauner <[email protected]>
-Cc: Balint Reczey <[email protected]>
-Cc: Sam James <[email protected]>
-Cc: David Runge <[email protected]>
-Cc: Andreas Jaeger <[email protected]>
-Cc: <~hallyn/[email protected]>
-Signed-off-by: Alejandro Colomar <[email protected]>
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- src/gpasswd.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/gpasswd.c b/src/gpasswd.c -index

5983f787..2d8869ef 100644
---- a/src/gpasswd.c
-+++ b/src/gpasswd.c
-@@ -896,6 +896,7 @@ static void change_passwd (struct group *gr)

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -10
-             strzero (cp);
-             cp = getpass (_("Re-enter new password: "));
-             if (NULL == cp) {
-+                    memzero (pass, sizeof pass);
-                     exit (1);
-             }
-
---
-2.34.1
-

diff --git a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch index 85d91751056..4a932d2dbb1 100644
---
a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open- failure-in-chroot-env.patch
+++ b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-o +++ pen-failure-in-chroot-env.patch

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
@@ -1,4 +1,4 @@
-From 21583da072aa66901d859ac00ce209bac87ddecc Mon Sep 17 00:00:00

2001
+From a773c6b240d27e23d6be41decef0edf24fcee523 Mon Sep 17 00:00:00 +2001
From: Chen Qi <[email protected]>
Date: Thu, 17 Jul 2014 15:53:34 +0800
Subject: [PATCH]
commonio.c-fix-unexpected-open-failure-in-chroot-env

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
@@ -15,35 +15,37 @@ Note that this patch doesn't change the logic in the code, it just expands
    the codes.
 
    Signed-off-by: Chen Qi <[email protected]>
-
    ---
     lib/commonio.c | 16 ++++++++++++----
     1 file changed, 12 insertions(+), 4 deletions(-)
 
    diff --git a/lib/commonio.c b/lib/commonio.c -index

9a02ce1..61384ec 100644
+index 73fdb3a..d1231e9 100644

    --- a/lib/commonio.c
    +++ b/lib/commonio.c

-@@ -616,10 +616,18 @@ int commonio_open (struct commonio_db *db, int mode)
+@@ -606,10 +606,18 @@ int commonio_open (struct commonio_db *db,

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +9 -3
+int mode)
        db->cursor = NULL;
        db->changed = false;
 
    -   fd = open (db->filename,
    -                (db->readonly ? O_RDONLY : O_RDWR)
--               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
+-               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);
    -   saved_errno = errno;
    +   if (db->readonly) {
    +           fd = open (db->filename,
    +                      (true ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW |
++ O_CLOEXEC);
    +           saved_errno = errno;
    +   } else {
    +           fd = open (db->filename,
    +                      (false ? O_RDONLY : O_RDWR)
-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW|
++ O_CLOEXEC);
    +           saved_errno = errno;
    +   }
    +
        db->fp = NULL;
        if (fd >= 0) {
     #ifdef WITH_TCB
+--
+2.30.2
+
meta/recipes-extended/shadow/shadow.inc +4 -11
index ce3ce627156..c024746d4ff 100644
@@ -5,7 +5,7 @@ BUGTRACKER = "http://github.com/shadow-maint/shadow/issues"
    SECTION = "base/utils"
    LICENSE = "BSD-3-Clause"
    LIC_FILES_CHKSUM = "file://COPYING;md5=c9a450b7be84eac23e6353efecb60b5b \
-                    file://src/passwd.c;beginline=2;endline=30;md5=758c26751513b6795395275969dd3be1 \
+
+ file://src/passwd.c;beginline=2;endline=7;md5=67bcf314687820b2f010
+ d4863fce3fc5 \
                        "
 
    DEPENDS = "virtual/crypt"
@@ -14,10 +14,6 @@ GITHUB_BASE_URI = "https://github.com/shadow-maint/shadow/releases"
    SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
               ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
               file://useradd \
-        file://0001-Fix-can-not-print-full-login.patch \
-           file://CVE-2023-29383.patch \
-           file://0001-Overhaul-valid_field.patch \
-           file://CVE-2023-4641.patch \
               "
 
    SRC_URI:append:class-target = " \
@@ -26,14 +22,9 @@ SRC_URI:append:class-target = " \
               "
 
    SRC_URI:append:class-native = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
               file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
               "
-SRC_URI:append:class-nativesdk = " \
-           file://0001-Disable-use-of-syslog-for-sysroot.patch \
-           "
-SRC_URI[sha256sum] = "813057047499c7fe81108adcf0cffa3ad4ec75e19a80151f9cbaa458ff2e86cd"
-
+SRC_URI[sha256sum] = "a305edf5d19bddbdf5e836d2d609fa8bff2d35458819de4d9f06306a1cf24342"
 
    # Additional Policy files for PAM
    PAM_SRC_URI = "file://pam.d/chfn \ @@ -44,7 +35,7 @@ PAM_SRC_URI =
"file://pam.d/chfn \
                   file://pam.d/passwd \
                   file://pam.d/su"
meta/recipes-extended/shadow/shadow.inc +5 -2
-inherit autotools gettext github-releases
+inherit autotools gettext github-releases pkgconfig
 
    export CONFIG_SHELL="/bin/sh"
@@ -54,6 +45,8 @@ EXTRA_OECONF += "--without-libcrack \
                     --without-sssd \
                     ${NSCDOPT}"
 
+CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
+
    NSCDOPT = ""
    NSCDOPT:class-native = "--without-nscd"
    NSCDOPT:class-nativesdk = "--without-nscd"
@@ -73,13 +66,14 @@ PAM_PLUGINS = "libpam-runtime \
 
    PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
                       ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
-PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
+PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} libbsd"
    PACKAGECONFIG:class-nativesdk = ""
    PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
    PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
    PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl"
    PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit"
    PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage"
+PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"
 
    RDEPENDS:${PN} = "shadow-securetty \
                      base-passwd \
meta/recipes-extended/shadow/shadow_4.14.2.bb renamed from meta/recipes-extended/shadow/shadow_4.13.bb +0 -0
similarity index 100%
rename from meta/recipes-extended/shadow/shadow_4.13.bb
rename to meta/recipes-extended/shadow/shadow_4.14.2.bb

A message that is not in the archive (sent off-list or not yet received): [email protected]

#20 lore raw

FTR, reverting the last 3 patches to shadow fixed the build of shadow-native for me. We still consider 20.04 to be a "supported" distribution, right?

Slava

Quoted 750 lines · Vyacheslav Yurkov via lists.openembedded.org

I only ran 'oe-selftest -r overlayfs.OverlayFSEtcRunTimeTest' on a fresh poky clone with SANITY_TESTED_DISTROS = "" set in local.conf.

I'm trying now the build with this commit reverted.

Slava

Quoted 743 lines · Alexander Kanavin

First you need to show how to reproduce it with plain poky.

Alex

Quoted 738 lines · Vyacheslav Yurkov

I'm getting the same "parameter name omitted" error with today's master of poky on Ubuntu-20.04 machine. Is there a fix for that?

Slava

Quoted 732 lines · Alexander Kanavin

I've seen issues where static libraries built on one host were not usable on a different host with default compiler options. This may be another one of these.

We're reverting to dynamic linking with libraries in a custom directory in sysroot that would be bundled together with shadow-native proper. Patch is coming.

Alex

Quoted 721 lines · Qi

I didn't do anything particular, but as several people are sharing the server, it's possible that its environment is somewhat messed up. I'll check more and fix the environment. Thanks for your double check.

Regards,
Qi

-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Friday, January 19, 2024 6:12 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]; Alexander Kanavin <[email protected]>
Subject: Re: [OE-core] [PATCH v3 1/2] shadow: update 4.13 -> 4.14.2

I just tried poky master on ubuntu 20.04, and the issues do not appear. Do you have a custom setup?

Alex

Quoted 704 lines · ChenQi

I'm seeing build failures on Ubuntu 20.04.
GCC version: 9.4.0

1. error: parameter name omitted
The problem is that the active_sessions_count function's definition lacks parameter. I did change like below:
-unsigned long active_sessions_count(const char *name, unsigned long unused)
+unsigned long active_sessions_count(const char *name, unsigned long unused unused_parameter)
But then I observed another error, as shown below.

2. undefined reference to `dlsym'.
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_exit':
| nss.c:(.text+0x32): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
../lib/.libs/libshadow.a(libshadow_la-nss.o): in function `nss_init':
| nss.c:(.text+0x1dd): undefined reference to `dlopen'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x21c): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x237): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x253): undefined reference to `dlsym'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x365): undefined reference to `dlclose'
| /ala-lpggp72/qichen/Yocto/builds/build-master/tmp/hosttools/ld:
nss.c:(.text+0x3b2): undefined reference to `dlerror'
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:1130: su] Error 1

On Ubuntu22.04, there's no such issue.

Regards,
Qi

Quoted 666 lines · Alexander Kanavin

License-Update: formatting, spdx conversion

Drop:
0001-Disable-use-of-syslog-for-sysroot.patch
(issue fixed upstream)

0001-Fix-can-not-print-full-login.patch
0001-Overhaul-valid_field.patch
CVE-2023-29383.patch
(backports)

libbsd is a new native dependency, as otherwise glibc >= 2.38 is needed.

A similar fix is added to musl in order to define non-standard __BEGIN_DECLS/__END_DECLS.

---
    ...01-Disable-use-of-syslog-for-sysroot.patch | 52 ------- .../0001-Fix-can-not-print-full-login.patch   | 41 ----- .../files/0001-Overhaul-valid_field.patch     | 65 -------- .../shadow/files/CVE-2023-29383.patch         | 53 ------- .../shadow/files/CVE-2023-4641.patch          | 147
------------------
    ...nexpected-open-failure-in-chroot-env.patch | 16 +- meta/recipes-extended/shadow/shadow.inc       | 20 +-- .../{shadow_4.13.bb => shadow_4.14.2.bb} |   0

    8 files changed, 16 insertions(+), 378 deletions(-)

    delete mode 100644 meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-login.patch delete mode 100644 meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-29383.patch
    delete mode 100644 meta/recipes-extended/shadow/files/CVE-2023-4641.patch
    rename meta/recipes-extended/shadow/{shadow_4.13.bb =>
shadow_4.14.2.bb} (100%)

diff --git a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-

sysroot.patch b/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-

sysroot.patch
deleted file mode 100644
index fa1532c8317..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-

sysroot.patch
+++ /dev/null

(quoted diff) +0 -1
@@ -1,52 +0,0 @@
-From 85d0444229ee3d14fefcf10d093f49c862826f82 Mon Sep 17 00:00:00

2001

(quoted diff) +0 -5
-From: Richard Purdie <[email protected]>
-Date: Thu, 14 Apr 2022 23:11:53 +0000
-Subject: [PATCH] Disable use of syslog for shadow-native tools
-
-Disable use of syslog to prevent sysroot user and group additions

from -writing entries to the host's syslog. This patch should only be used -with the shadow-native recipe.

(quoted diff) +0 -11
-
-Upstream-Status: Inappropriate [OE specific configuration]
-Signed-off-by: Richard Purdie <[email protected]>
-Signed-off-by: Peter Kjellerstedt <[email protected]>
-
----
- configure.ac      | 2 +-
- src/login_nopam.c | 3 ++-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac -index 924254a..603af81

100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -191,7 +191,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
-     [Path to passwd program.])

(quoted diff) +0 -8
-
- dnl XXX - quick hack, should disappear before anyone notices :).
--AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
-+#AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
- if test "$ac_cv_func_ruserok" = "yes"; then
-     AC_DEFINE(RLOGIN, 1, [Define if login should support the 
-r flag for rlogind.])
-     AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" 

return value (0 or 1).])
-diff --git a/src/login_nopam.c b/src/login_nopam.c -index df6ba88..fc24e13 100644
---- a/src/login_nopam.c
-+++ b/src/login_nopam.c
-@@ -29,7 +29,6 @@
- #ifndef USE_PAM
- #ident "$Id$"
-
--#include "prototypes.h"
-     /*
-      * This module implements a simple but effective form of login access
-      * control based on login names and on host (or domain) names, internet
-@@ -57,6 +56,8 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>              /* for inet_ntoa() */ -
-+#include "prototypes.h"
-+
- #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
- #undef MAXHOSTNAMELEN
- #define MAXHOSTNAMELEN 256
diff --git a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log

in.patch b/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log

in.patch
deleted file mode 100644
index 89f9c05c8d3..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Fix-can-not-print-full-log

in.patch
+++ /dev/null

(quoted diff) +0 -7
@@ -1,41 +0,0 @@
-commit 670cae834827a8f794e6f7464fa57790d911b63c
-Author: SoumyaWind <[email protected]>
-Date:   Tue Dec 27 17:40:17 2022 +0530
-
-    shadow: Fix can not print full login timeout message
-
-    Login timed out message prints only first few bytes when 

write is immediately followed by exit.
-    Calling exit from new handler provides enough time to display full message.

(quoted diff) +0 -2
-
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/670cae834827a8f794e6f

7464fa57790d911b63c]

(quoted diff) +0 -2
-
-diff --git a/src/login.c b/src/login.c -index 116e2cb3..c55f4de0

100644
---- a/src/login.c
-+++ b/src/login.c
-@@ -120,6 +120,7 @@ static void get_pam_user (char **ptr_pam_user);

(quoted diff) +0 -7
-
- static void init_env (void);
- static void alarm_handler (int);
-+static void exit_handler (int);
-
- /*
-  * usage - print login command usage and exit -@@ -391,11 +392,16

@@ static void init_env (void)
- #endif                              /* !USE_PAM */
- }

(quoted diff) +0 -14
-
-+static void exit_handler (unused int sig) {
-+    _exit (0);
-+}
-
- static void alarm_handler (unused int sig)
- {
-     write (STDERR_FILENO, tmsg, strlen (tmsg));
--    _exit (0);
-+    signal(SIGALRM, exit_handler);
-+    alarm(2);
- }
-
- #ifdef USE_PAM

diff --git a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch

b/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch

deleted file mode 100644
index ac08be515bf..00000000000
---
a/meta/recipes-extended/shadow/files/0001-Overhaul-valid_field.patch

+++ /dev/null

(quoted diff) +0 -1
@@ -1,65 +0,0 @@
-From 2eaea70111f65b16d55998386e4ceb4273c19eb4 Mon Sep 17 00:00:00

2001
-From: =?UTF-8?q?Christian=20G=C3=B6ttsche?=
<[email protected]>

(quoted diff) +0 -8
-Date: Fri, 31 Mar 2023 14:46:50 +0200
-Subject: [PATCH] Overhaul valid_field()
-
-e5905c4b ("Added control character check") introduced checking for
-control characters but had the logic inverted, so it rejects all
-characters that are not control ones.
-
-Cast the character to `unsigned char` before passing to the

character -checking functions to avoid UB.

(quoted diff) +0 -4
-
-Use strpbrk(3) for the illegal character test and return early.
-
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/2eaea70111f65b16d5599

8386e4ceb4273c19eb4]

(quoted diff) +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 24 ++++++++++--------------
- 1 file changed, 10 insertions(+), 14 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index fb51b582..53929248

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -37,26 +37,22 @@ int valid_field (const char *field, const char *illegal)
-
-     /* For each character of field, search if it appears in the list
-      * of illegal characters. */
-+    if (illegal && NULL != strpbrk (field, illegal)) { -+            return -1;
-+    }
-+
-+    /* Search if there are non-printable or control characters */ -     for (cp = field; '\0' != *cp; cp++) {
--            if (strchr (illegal, *cp) != NULL) {
-+            unsigned char c = *cp;
-+            if (!isprint (c)) {
-+                    err = 1;
-+            }
-+            if (iscntrl (c)) {
-                     err = -1;
-                     break;
-             }
-     }
-
--    if (0 == err) {
--            /* Search if there are non-printable or control characters */
--            for (cp = field; '\0' != *cp; cp++) {
--                    if (!isprint (*cp)) {
--                            err = 1;
--                    }
--                    if (!iscntrl (*cp)) {
--                            err = -1;
--                            break;
--                    }
--            }
--    }

Signature · 2 lines
-     return err;
- }
(quoted diff) +0 -4
-
---
-2.34.1
-
meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -1
deleted file mode 100644
index f53341d3fc2..00000000000
@@ -1,53 +0,0 @@
-From e5905c4b84d4fb90aefcd96ee618411ebfac663d Mon Sep 17 00:00:00

2001
-From: tomspiderlabs <[email protected]>

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -4
-Date: Thu, 23 Mar 2023 23:39:38 +0000
-Subject: [PATCH] Added control character check
-
-Added control character check, returning -1 (to "err") if 

control characters are present.

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -6
-
-CVE: CVE-2023-29383
-Upstream-Status: Backport
-
-Reference to upstream:
-https://github.com/shadow-maint/shadow/commit/e5905c4b84d4fb90aefcd 

96ee618411ebfac663d

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -7
-
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- lib/fields.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/lib/fields.c b/lib/fields.c -index 640be931..fb51b582

100644
---- a/lib/fields.c
-+++ b/lib/fields.c
-@@ -21,9 +21,9 @@
-  *
-  * The supplied field is scanned for non-printable and other illegal
-  * characters.
-- *  + -1 is returned if an illegal character is present. -- *  +  1 is returned if no illegal characters are present, but the field
-- *       contains a non-printable character.
-+ *  + -1 is returned if an illegal or control character is present.
-+ *  +  1 is returned if no illegal or control characters are present,
-+ *       but the field contains a non-printable character. -  *  +  0 is returned otherwise.
-  */
- int valid_field (const char *field, const char *illegal) -@@ -45,10 +45,13 @@ int valid_field (const char *field, const char *illegal)
-     }
-
-     if (0 == err) {
--            /* Search if there are some non-printable characters */
-+            /* Search if there are non-printable or control -+ characters */
-             for (cp = field; '\0' != *cp; cp++) {
-                     if (!isprint (*cp)) {
-                             err = 1;
-+                    }
-+                    if (!iscntrl (*cp)) {
-+                            err = -1;
-                             break;
-                     }
-             }
---
-2.34.1

meta/recipes-extended/shadow/files/CVE-2023-29383.patch deleted +0 -1
-
meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
deleted file mode 100644
index 1fabfe928e4..00000000000
@@ -1,147 +0,0 @@
-From 25dbe2ce166a13322b7536ff2f738786ea2e61e7 Mon Sep 17 00:00:00

2001

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -8
-From: Alejandro Colomar <[email protected]>
-Date: Sat, 10 Jun 2023 16:20:05 +0200
-Subject: [PATCH] gpasswd(1): Fix password leak
-
-How to trigger this password leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When gpasswd(1) asks for the new password, it asks twice (as is

usual -for confirming the new password).  Each of those 2 password prompts -uses agetpass() to get the password.  If the second agetpass() fails, -the first password, which has been copied into the 'static' buffer -'pass' via STRFCPY(), wasn't being zeroed.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-agetpass() is defined in <./libmisc/agetpass.c> (around line 91),

and -can fail for any of the following reasons:

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -4
-
--  malloc(3) or readpassphrase(3) failure.
-
-   These are going to be difficult to trigger.  Maybe getting 

the system
-   to the limits of memory utilization at that exact point, so that the
-   next malloc(3) gets ENOMEM, and possibly even the OOM is triggered.
-   About readpassphrase(3), ENFILE and EINTR seem the only plausible
-   ones, and EINTR probably requires privilege or being the same user;
-   but I wouldn't discard ENFILE so easily, if a process starts opening
-   files.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -4
-
--  The password is longer than PASS_MAX.
-
-   The is plausible with physical access.  However, at that 

point, a
-   keylogger will be a much simpler attack.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-And, the attacker must be able to know when the second password is

being -introduced, which is not going to be easy.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-How to read the password after the leak?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Provoking the leak yourself at the right point by entering a very

long -password is easy, and inspecting the process stack at that point should -be doable.  Try to find some consistent patterns.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Then, search for those patterns in free memory, right after the

victim -leaks their password.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -7
-
-Once you get the leak, a program should read all the free memory
-searching for patterns that gpasswd(1) leaves nearby the leaked
-password.
-
-On 6/10/23 03:14, Seth Arnold wrote:
-> An attacker process wouldn't be able to use malloc(3) for 

this task.
-> There's a handful of tools available for userspace to allocate memory:
->
-> -  brk / sbrk
-> -  mmap MAP_ANONYMOUS
-> -  mmap /dev/zero
-> -  mmap some other file
-> -  shm_open
-> -  shmget
->
-> Most of these return only pages of zeros to a process.  Using -> mmap of an existing file, you can get some of the contents of the
-> file demand-loaded into the memory space on the first use. ->
-> The MAP_UNINITIALIZED flag only works if the kernel was compiled -> with CONFIG_MMAP_ALLOW_UNINITIALIZED.  This is rare. ->
-> malloc(3) doesn't zero memory, to our collective frustration, but
-> all the garbage in the allocations is from previous allocations -> in the current process.  It isn't leftover from other processes. ->
-> The avenues available for reading the memory:
-> -  /dev/mem and /dev/kmem (requires root, not available with -> Secure Boot)
-> -  /proc/pid/mem (requires ptrace privileges, mediated by YAMA) -> -  ptrace (requires ptrace privileges, mediated by YAMA) -> -  causing memory to be swapped to disk, and then inspecting the -> swap
->
-> These all require a certain amount of privileges.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -6
-
-How to fix it?
-~~~~~~~~~~~~~~
-
-memzero(), which internally calls explicit_bzero(3), or whatever
-alternative the system provides with a slightly different name,

will -make sure that the buffer is zeroed in memory, and optimizations are not -allowed to impede this zeroing.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-This is not really 100% effective, since compilers may place 

copies
of -the string somewhere hidden in the stack.  Those copies won't get zeroed -by explicit_bzero(3).  However, that's arguably a compiler bug, since -compilers should make everything possible to avoid optimizing strings -that are later passed to explicit_bzero(3).  But we all know that -sometimes it's impossible to have perfect knowledge in the compiler, so -this is plausible. Nevertheless, there's nothing we can do against such -issues, except minimizing the time such passwords are stored in plain -text.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Security concerns
-~~~~~~~~~~~~~~~~~
-
-We believe this isn't easy to exploit.  Nevertheless, and since 

the
fix -is trivial, this fix should probably be applied soon, and backported to -all supported distributions, to prevent someone else having more -imagination than us to find a way.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -5
-
-Affected versions
-~~~~~~~~~~~~~~~~~
-
-All.  Bug introduced in shadow 19990709.  That's the second commit

in -the git history.

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -2
-
-Fixes: 45c6603cc86c ("[svn-upgrade] Integrating new upstream

version, shadow (19990709)")

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -3
-
-CVE: CVE-2023-4641
-Upstream-Status: Backport

[https://github.com/shadow-maint/shadow/commit/65c88a43a23c2391dcc90

c0abda3e839e9c57904]

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -18
-
-Reported-by: Alejandro Colomar <[email protected]>
-Cc: Serge Hallyn <[email protected]>
-Cc: Iker Pedrosa <[email protected]>
-Cc: Seth Arnold <[email protected]>
-Cc: Christian Brauner <[email protected]>
-Cc: Balint Reczey <[email protected]>
-Cc: Sam James <[email protected]>
-Cc: David Runge <[email protected]>
-Cc: Andreas Jaeger <[email protected]>
-Cc: <~hallyn/[email protected]>
-Signed-off-by: Alejandro Colomar <[email protected]>
-Signed-off-by: Xiangyu Chen <[email protected]>
----
- src/gpasswd.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/gpasswd.c b/src/gpasswd.c -index

5983f787..2d8869ef 100644
---- a/src/gpasswd.c
-+++ b/src/gpasswd.c
-@@ -896,6 +896,7 @@ static void change_passwd (struct group *gr) -             strzero (cp);
-             cp = getpass (_("Re-enter new password: ")); -             if (NULL == cp) {
-+                    memzero (pass, sizeof pass);
-                     exit (1);
-             }

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -4
-
---
-2.34.1
-

diff --git a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-

failure-in-chroot-env.patch b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-

failure-in-chroot-env.patch index 85d91751056..4a932d2dbb1 100644
---
a/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-

failure-in-chroot-env.patch
+++
b/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-o +++ pen-failure-in-chroot-env.patch

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -1
@@ -1,4 +1,4 @@
-From 21583da072aa66901d859ac00ce209bac87ddecc Mon Sep 17 00:00:00

2001
+From a773c6b240d27e23d6be41decef0edf24fcee523 Mon Sep 17 00:00:00 +2001
    From: Chen Qi <[email protected]>
    Date: Thu, 17 Jul 2014 15:53:34 +0800
    Subject: [PATCH] commonio.c-fix-unexpected-open-failure-in-chroot-env

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +0 -0
@@ -15,35 +15,37 @@ Note that this patch doesn't change the 

logic in the code, it just expands
    the codes.

-
    ---
     lib/commonio.c | 16 ++++++++++++----

     1 file changed, 12 insertions(+), 4 deletions(-)

    diff --git a/lib/commonio.c b/lib/commonio.c -index 9a02ce1..61384ec 100644
+index 73fdb3a..d1231e9 100644
    --- a/lib/commonio.c
    +++ b/lib/commonio.c
-@@ -616,10 +616,18 @@ int commonio_open (struct commonio_db *db, int mode)
+@@ -606,10 +606,18 @@ int commonio_open (struct commonio_db *db, +int mode)
        db->cursor = NULL;
        db->changed = false;

    -   fd = open (db->filename,
    -                (db->readonly ? O_RDONLY : O_RDWR)

--               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
+-               | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC);

    -   saved_errno = errno;
    +   if (db->readonly) {
    +           fd = open (db->filename,
    +                      (true ? O_RDONLY : O_RDWR)

-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW |

++ O_CLOEXEC);
    +           saved_errno = errno;
    +   } else {
    +           fd = open (db->filename,
    +                      (false ? O_RDONLY : O_RDWR)

-+                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW);
++                       | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW|

++ O_CLOEXEC);
    +           saved_errno = errno;
    +   }
    +
        db->fp = NULL;
        if (fd >= 0) {
     #ifdef WITH_TCB
+--
+2.30.2

meta/recipes-extended/shadow/files/CVE-2023-4641.patch deleted +1 -0
+
meta/recipes-extended/shadow/shadow.inc +0 -0
index ce3ce627156..c024746d4ff 100644
@@ -5,7 +5,7 @@ BUGTRACKER = 

"http://github.com/shadow-maint/shadow/issues"
    SECTION = "base/utils"
    LICENSE = "BSD-3-Clause"
    LIC_FILES_CHKSUM = "file://COPYING;md5=c9a450b7be84eac23e6353efecb60b5b \
- file://src/passwd.c;beginline=2;endline=30;md5=758c26751513b6795395275969dd3be1 \
+
+
file://src/passwd.c;beginline=2;endline=7;md5=67bcf314687820b2f010
+ d4863fce3fc5 \
                        "

    DEPENDS = "virtual/crypt"

meta/recipes-extended/shadow/shadow.inc +0 -0
@@ -14,10 +14,6 @@ GITHUB_BASE_URI = 

"https://github.com/shadow-maint/shadow/releases"
    SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
               ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
               file://useradd \
- file://0001-Fix-can-not-print-full-login.patch \
-           file://CVE-2023-29383.patch \
-           file://0001-Overhaul-valid_field.patch \
-           file://CVE-2023-4641.patch \
               "

    SRC_URI:append:class-target = " \

meta/recipes-extended/shadow/shadow.inc +0 -0
@@ -26,14 +22,9 @@ SRC_URI:append:class-target = " \

               "

    SRC_URI:append:class-native = " \
- file://0001-Disable-use-of-syslog-for-sysroot.patch \
file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
               "

meta/recipes-extended/shadow/shadow.inc +0 -4
-SRC_URI:append:class-nativesdk = " \
- file://0001-Disable-use-of-syslog-for-sysroot.patch \
-           "
-SRC_URI[sha256sum] = 

"813057047499c7fe81108adcf0cffa3ad4ec75e19a80151f9cbaa458ff2e86cd"

meta/recipes-extended/shadow/shadow.inc +1 -1
-
+SRC_URI[sha256sum] = 

"a305edf5d19bddbdf5e836d2d609fa8bff2d35458819de4d9f06306a1cf24342"

    # Additional Policy files for PAM
    PAM_SRC_URI = "file://pam.d/chfn \ @@ -44,7 +35,7 @@ PAM_SRC_URI = "file://pam.d/chfn \
                   file://pam.d/passwd \
                   file://pam.d/su"

meta/recipes-extended/shadow/shadow.inc +1 -1
-inherit autotools gettext github-releases
+inherit autotools gettext github-releases pkgconfig

    export CONFIG_SHELL="/bin/sh"

meta/recipes-extended/shadow/shadow.inc +0 -0
@@ -54,6 +45,8 @@ EXTRA_OECONF += "--without-libcrack \
                      --without-sssd \

                     ${NSCDOPT}"

meta/recipes-extended/shadow/shadow.inc +2 -0
+CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
+

    NSCDOPT = ""
    NSCDOPT:class-native = "--without-nscd"
    NSCDOPT:class-nativesdk = "--without-nscd"

meta/recipes-extended/shadow/shadow.inc +0 -0
@@ -73,13 +66,14 @@ PAM_PLUGINS = "libpam-runtime \
 
     PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \

${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}" -PACKAGECONFIG:class-native ??=
"${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}" +PACKAGECONFIG:class-native ??=
"${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} libbsd" PACKAGECONFIG:class-nativesdk = ""
    PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}" PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr" PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl" PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit" PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage" +PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"

    RDEPENDS:${PN} = "shadow-securetty \
                      base-passwd \

meta/recipes-extended/shadow/shadow_4.14.2.bb renamed from meta/recipes-extended/shadow/shadow_4.13.bb +0 -0
similarity index 100%
rename from meta/recipes-extended/shadow/shadow_4.13.bb
rename to meta/recipes-extended/shadow/shadow_4.14.2.bb
#21 lore raw
Quoted 3 lines · Vyacheslav Yurkov

FTR, reverting the last 3 patches to shadow fixed the build of shadow-native for me.
We still consider 20.04 to be a "supported" distribution, right?

I suspect some kind of host contamination and you have something installed on your distro which the rest of us don't.

Can you share the do_configure logs?

Cheers,

Richard

#22 lore raw

shadow-native configure log is below.

DEBUG: Executing python function extend_recipe_sysroot
NOTE: Direct dependencies are ['/home/uvv/projects/upstream/poky-shadow/meta/recipes-core/gettext/gettext-minimal-native_0.22.4.bb:do_populate_sysroot', '/home/uvv/projects/upstream/poky-shadow/meta/recipes-devtools/libtool/libtool-native_2.4.7.bb:do_populate_sysroot', '/home/uvv/projects/upstream/poky-shadow/meta/recipes-devtools/quilt/quilt-native_0.67.bb:do_populate_sysroot', 'virtual:native:/home/uvv/projects/upstream/poky-shadow/meta/recipes-devtools/autoconf/autoconf_2.72e.bb:do_populate_sysroot', 'virtual:native:/home/uvv/projects/upstream/poky-shadow/meta/recipes-devtools/automake/automake_1.16.5.bb:do_populate_sysroot', 'virtual:native:/home/uvv/projects/upstream/poky-shadow/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb:do_populate_sysroot', 'virtual:native:/home/uvv/projects/upstream/poky-shadow/meta/recipes-support/attr/attr_2.5.1.bb:do_populate_sysroot', 'virtual:native:/home/uvv/projects/upstream/poky-shadow/meta/recipes-support/libbsd/libbsd_0.11.8.bb:do_populate_sysroot']
NOTE: Installed into sysroot: []
NOTE: Skipping as already exists in sysroot: ['gettext-minimal-native', 'libtool-native', 'm4-native', 'quilt-native', 'texinfo-dummy-native', 'autoconf-native', 'automake-native', 'gnu-config-native', 'pkgconfig-native', 'xz-native', 'attr-native', 'libbsd-native', 'libmd-native']
DEBUG: Python function extend_recipe_sysroot finished
DEBUG: Executing shell function autotools_preconfigure
DEBUG: Shell function autotools_preconfigure finished
DEBUG: Executing python function autotools_aclocals
DEBUG: SITE files ['endian-little', 'common-linux', 'common-glibc', 'bit-64', 'x86_64-linux', 'common']
DEBUG: Python function autotools_aclocals finished
DEBUG: Executing shell function do_configure
automake (GNU automake) 1.16.5
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey <[email protected]>
       and Alexandre Duret-Lutz <[email protected]>.
AUTOV is 1.16
NOTE: Executing ACLOCAL="aclocal --system-acdir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/share/aclocal/ --automake-acdir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/share/aclocal-1.16" autoreconf -Wcross --verbose --install --force --exclude=autopoint -I /home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/shadow-4.14.2/m4/
autoreconf: export WARNINGS=cross,no-obsolete
autoreconf: Entering directory '.'
autoreconf: running: aclocal --system-acdir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/share/aclocal/ --automake-acdir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/share/aclocal-1.16 -I /home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/shadow-4.14.2/m4/ --force
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: aclocal --system-acdir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/share/aclocal/ --automake-acdir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/share/aclocal-1.16 -I /home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/shadow-4.14.2/m4/ --force
autoreconf: running: /home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/bin/autoconf --include=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/shadow-4.14.2/m4/ --force
autoreconf: running: /home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/bin/autoheader --include=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/shadow-4.14.2/m4/ --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:23: installing './compile'
configure.ac:9: installing './missing'
lib/Makefile.am: installing './depcomp'
autoreconf: './install-sh' is updated
autoreconf: './config.sub' is updated
autoreconf: './config.guess' is updated
autoreconf: Leaving directory '.'
NOTE: Running ../shadow-4.14.2/configure  --build=x86_64-linux       --host=x86_64-linux           --target=x86_64-linux --prefix=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr --exec_prefix=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr --bindir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/bin --sbindir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/sbin --libexecdir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/libexec --datadir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/share --sysconfdir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/etc --sharedstatedir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/com --localstatedir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/var --libdir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/lib --includedir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/include --oldincludedir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/include --infodir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/share/info --mandir=/home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/share/man           --disable-silent-rules --disable-dependency-tracking --without-libcrack --with-group-name-max-length=24 --enable-subordinate-ids=yes --without-sssd                  --without-nscd --disable-static --without-acl --with-attr --without-audit --with-libbsd --without-libpam --without-selinux --disable-nls
configure: loading site script /home/uvv/projects/upstream/poky-shadow/meta/site/endian-little
configure: loading site script /home/uvv/projects/upstream/poky-shadow/meta/site/common-linux
configure: loading site script /home/uvv/projects/upstream/poky-shadow/meta/site/common-glibc
configure: loading site script /home/uvv/projects/upstream/poky-shadow/meta/site/x86_64-linux
configure: loading site script /home/uvv/projects/upstream/poky-shadow/meta/site/common
checking for a BSD-compatible install... /home/uvv/projects/upstream/poky-shadow/build/tmp/hosttools/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /home/uvv/projects/upstream/poky-shadow/build/tmp/hosttools/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether make supports the include directive... yes (GNU style)
checking for x86_64-linux-gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc  accepts -g... yes
checking for gcc  option to enable C11 features... none needed
checking whether gcc  understands -c and -o together... yes
checking dependency style of gcc ... none
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking for utime.h... yes
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking for x86_64-linux-gcc... (cached) gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc  accepts -g... (cached) yes
checking for gcc  option to enable C11 features... (cached) none needed
checking whether gcc  understands -c and -o together... (cached) yes
checking dependency style of gcc ... (cached) none
checking whether ln -s works... yes
checking for bison... no
checking for byacc... no
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) sed
checking for grep that handles long lines and -e... /home/uvv/projects/upstream/poky-shadow/build/tmp/hosttools/grep
checking for egrep... /home/uvv/projects/upstream/poky-shadow/build/tmp/hosttools/grep -E
checking for fgrep... /home/uvv/projects/upstream/poky-shadow/build/tmp/hosttools/grep -F
checking for ld used by gcc ... ld
checking if the linker (ld ) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... nm
checking the name lister (nm) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for ld  option to reload object files... -r
checking for x86_64-linux-file... no
checking for file... file
checking for x86_64-linux-objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for x86_64-linux-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for x86_64-linux-ar... ar
checking for archiver @FILE support... @
checking for x86_64-linux-strip... strip
checking for x86_64-linux-ranlib... ranlib -D
checking command to parse nm output from gcc  object... ok
checking for sysroot... no
checking for a working dd... /home/uvv/projects/upstream/poky-shadow/build/tmp/hosttools/dd
checking how to truncate binary pipes... /home/uvv/projects/upstream/poky-shadow/build/tmp/hosttools/dd bs=4096 count=1
checking for x86_64-linux-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc  supports -fno-rtti -fno-exceptions... no
checking for gcc  option to produce PIC... -fPIC -DPIC
checking if gcc  PIC flag -fPIC -DPIC works... yes
checking if gcc  static flag -static works... yes
checking if gcc  supports -c -o file.o... yes
checking if gcc  supports -c -o file.o... (cached) yes
checking whether the gcc  linker (ld  -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for crypt.h... yes
checking for utmp.h... yes
checking for termio.h... yes
checking for sgtty.h... yes
checking for sys/ioctl.h... yes
checking for paths.h... yes
checking for sys/capability.h... no
checking for sys/random.h... yes
checking for gshadow.h... yes
checking for lastlog.h... yes
checking for rpc/key_prot.h... yes
checking for acl/libacl.h... no
checking for attr/libattr.h... yes
checking for attr/error_context.h... yes
checking for shadow.h... yes
checking for arc4random_buf... no
checking for futimes... yes
checking for getentropy... yes
checking for getrandom... yes
checking for getspnam... yes
checking for getusershell... yes
checking for initgroups... yes
checking for lckpwdf... yes
checking for lutimes... yes
checking for mempcpy... yes
checking for setgroups... yes
checking for updwtmp... yes
checking for updwtmpx... yes
checking for innetgr... yes
checking for getspnam_r... yes
checking for rpmatch... yes
checking for memset_explicit... no
checking for explicit_bzero... yes
checking for stpecpy... no
checking for stpeprintf... no
checking for gcc  option to enable large file support... none needed
checking for struct utmp.ut_type... yes
checking for struct utmp.ut_id... yes
checking for struct utmp.ut_name... yes
checking for struct utmp.ut_user... yes
checking for struct utmp.ut_host... yes
checking for struct utmp.ut_syslen... no
checking for struct utmp.ut_addr... yes
checking for struct utmp.ut_addr_v6... yes
checking for struct utmp.ut_time... yes
checking for struct utmp.ut_xtime... yes
checking for struct utmp.ut_tv... yes
checking for uid_t... yes
checking for gid_t... yes
checking type of array argument to getgroups... gid_t
checking whether utime accepts a null argument... (cached) yes
checking for putgrent... yes
checking for putpwent... yes
checking for putspent... yes
checking for sgetgrent... no
checking for sgetpwent... no
checking for sgetspent... yes
checking for setpgrp... yes
checking for secure_getenv... yes
checking for working shadow group support... yes
checking location of shared mail directory... (cached) /home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/var/spool/mail
checking location of user mail file... (cached) Mailbox
checking location of utmp... (cached) /home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/var/run
checking location of faillog/lastlog/wtmp... (cached) /home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/var/log
checking location of the passwd program... (cached) /home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/bin
checking for library containing gethostbyname... none required
checking for econf_readDirs in -leconf... no
checking size of uid_t... (cached) 4
checking size of gid_t... (cached) 4
checking for sd_session_get_remote_host in -lsystemd... yes
checking for crypt in -lcrypt... yes
checking for crypt in -lcrypt... (cached) yes
checking for library containing readpassphrase... -lbsd
checking for x86_64-linux-pkg-config... no
checking for pkg-config... /home/uvv/projects/upstream/poky-shadow/build/tmp/work/x86_64-linux/shadow-native/4.14.2/recipe-sysroot-native/usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libbsd-overlay... yes
checking for readpassphrase.h... yes
checking for attr/libattr.h... (cached) yes
checking for attr/error_context.h... (cached) yes
checking for attr_copy_file in -lattr... yes
checking for attr_copy_fd in -lattr... yes
checking for sys/statfs.h... yes
checking for linux/magic.h... yes
checking for linux/btrfs_tree.h... yes
checking for tcb.h... no
checking use login and su access checking if PAM not used... yes
checking for fgetpwent_r... yes
checking whether NLS is requested... no
checking for msgfmt... no
checking for gmsgfmt... :
checking for xgettext... no
checking for msgmerge... no
checking for ld... ld  -m elf_x86_64
checking if the linker (ld  -m elf_x86_64) is GNU ld... yes
checking for shared library run path origin... done
checking 32-bit host C ABI... no
checking how to run the C preprocessor... gcc  -E
checking for egrep -e... (cached) /home/uvv/projects/upstream/poky-shadow/build/tmp/hosttools/grep -E
checking for ELF binary format... yes
checking for the common suffixes of directories in the library search path... lib,lib,lib64
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking whether to use NLS... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating po/Makefile.in
config.status: creating doc/Makefile
config.status: creating man/Makefile
config.status: creating man/config.xml
config.status: creating man/po/Makefile
config.status: creating man/cs/Makefile
config.status: creating man/da/Makefile
config.status: creating man/de/Makefile
config.status: creating man/es/Makefile
config.status: creating man/fi/Makefile
config.status: creating man/fr/Makefile
config.status: creating man/hu/Makefile
config.status: creating man/id/Makefile
config.status: creating man/it/Makefile
config.status: creating man/ja/Makefile
config.status: creating man/ko/Makefile
config.status: creating man/pl/Makefile
config.status: creating man/pt_BR/Makefile
config.status: creating man/ru/Makefile
config.status: creating man/sv/Makefile
config.status: creating man/tr/Makefile
config.status: creating man/uk/Makefile
config.status: creating man/zh_CN/Makefile
config.status: creating man/zh_TW/Makefile
config.status: creating lib/Makefile
config.status: creating libsubid/Makefile
config.status: creating libsubid/subid.h
config.status: creating src/Makefile
config.status: creating contrib/Makefile
config.status: creating etc/Makefile
config.status: creating etc/pam.d/Makefile
config.status: creating etc/shadow-maint/Makefile
config.status: creating shadow.spec
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile

shadow will be compiled with the following features:

    auditing support:        no
    CrackLib support:        no
    PAM support:            no
    SELinux support:        no
    BtrFS support:            yes
    ACL support:            no
    Extended Attributes support:    yes
    tcb support (incomplete):    no
    shadow group support:        yes
    S/Key support:            no
    SHA passwords encryption:    yes
    bcrypt passwords encryption:    no
    yescrypt passwords encryption:    no
    nscd support:            no
    sssd support:            no
    subordinate IDs support:    yes
    enable lastlog:            no
    enable logind:            yes
    use file caps:            no
    install su:            yes
    enabled vendor dir:

DEBUG: Shell function do_configure finished
DEBUG: Executing python function do_qa_configure
NOTE: Checking autotools environment for common misconfiguration
NOTE: Checking configure output for unrecognised options
DEBUG: Python function do_qa_configure finished
DEBUG: Executing shell function autotools_postconfigure
DEBUG: Shell function autotools_postconfigure finished

Quoted 9 lines · Richard Purdie

I suspect some kind of host contamination and you have something installed on your distro which the rest of us don't.

Can you share the do_configure logs?

Cheers,

Richard

#23 lore raw
Quoted 1 line · Vyacheslav Yurkov

 shadow-native configure log is below.

Thanks, the line which jumped out at me is:

Quoted 2 lines

 checking for sd_session_get_remote_host in -lsystemd... yes

since we don't (and shouldn't) build a systemd-native.

You might want to see if there is a configure option we should be passing in to disable that.

Cheers,

Richard

#24 lore raw
Quoted 4 lines · Richard Purdie

since we don't (and shouldn't) build a systemd-native.

You might want to see if there is a configure option we should be passing in to disable that.

I just sent a patch that does that.

Alex