# HG changeset patch # User Stanislas Leduc # Date 1706898981 -3600 # Node ID cae6bd8b02edc0bb63fc11da9c2ffd48a04ddd0a # Parent 8ed39abf4bbb6780f7e64222201e12cfe717da3d Patch pam CVE-2024-22365 diff -r 8ed39abf4bbb -r cae6bd8b02ed pam/receipt --- a/pam/receipt Fri Jan 26 18:17:03 2024 +0100 +++ b/pam/receipt Fri Feb 02 19:36:21 2024 +0100 @@ -25,6 +25,10 @@ # Rules to configure and make the package. compile_rules() { + # Patch CVE-2024-22365 + # see https://seclists.org/oss-sec/2024/q1/31 + patch -p1 < $stuff/CVE-2024-22365.patch + sed -i 's|(uname -m)|(echo i686)|;s|`uname -m`|`echo i686`|' \ configure build-aux/config.guess ./configure --sysconfdir=/etc \ diff -r 8ed39abf4bbb -r cae6bd8b02ed pam/stuff/CVE-2024-22365.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pam/stuff/CVE-2024-22365.patch Fri Feb 02 19:36:21 2024 +0100 @@ -0,0 +1,36 @@ +diff --git a/modules/pam_namespace/pam_namespace.c b/modules/pam_namespace/pam_namespace.c +index 2528cff86..f72d67189 100644 +--- a/modules/pam_namespace/pam_namespace.c ++++ b/modules/pam_namespace/pam_namespace.c +@@ -1201,7 +1201,7 @@ static int protect_dir(const char *path, mode_t mode, int do_mkdir, + int dfd = AT_FDCWD; + int dfd_next; + int save_errno; +- int flags = O_RDONLY; ++ int flags = O_RDONLY | O_DIRECTORY; + int rv = -1; + struct stat st; + +@@ -1255,22 +1255,6 @@ static int protect_dir(const char *path, mode_t mode, int do_mkdir, + rv = openat(dfd, dir, flags); + } + +- if (rv != -1) { +- if (fstat(rv, &st) != 0) { +- save_errno = errno; +- close(rv); +- rv = -1; +- errno = save_errno; +- goto error; +- } +- if (!S_ISDIR(st.st_mode)) { +- close(rv); +- errno = ENOTDIR; +- rv = -1; +- goto error; +- } +- } +- + if (flags & O_NOFOLLOW) { + /* we are inside user-owned dir - protect */ + if (protect_mount(rv, p, idata) == -1) {