attr: fix CVE-2026-54371
PATCH 1/1 attr: fix CVE-2026-54371
From: Hetvi Thakar <[email protected]>
getfattr traversal and setfattr restore operations can follow attacker-controlled symlinks and access unintended files. This can lead to privilege escalation when invoked by a privileged process.
Backport the upstream hardening commits [7] and [8], identified by the Debian tracker [10], while retaining attr 2.5.2. These fixes use interfaces absent from 2.5.2, requiring the following prerequisites in their dependency order:
- [1] Add the visibility attribute header. The compatibility helpers introduced by [3] include this header and use its hidden annotation for internal declarations.
- [2] Add xattrat syscall wrappers. These provide the getxattrat(), setxattrat(), listxattrat() and removexattrat() entry points used by
[3] when the C library does not provide them.
- [3] Add xattrat compatibility helpers. The hardening fixes use these interfaces for directory-relative extended-attribute operations. They provide fallbacks for older kernels and unsupported O_PATH/AT_EMPTY_PATH combinations, using /proc/self/fd where needed.
- [4] Add the directory-fd-based walk_tree implementation and callback interface required by [7]. This allows getfattr to access entries relative to directory descriptors instead of repeatedly resolving their complete pathnames.
- [5] Defer restoration until command-line parsing is complete. This ensures -h and the -P option introduced by [8] take effect even when specified after --restore.
- [6] Add openat2 detection and a syscall wrapper. Commit [8] uses this interface with RESOLVE_NO_SYMLINKS to resolve restore directory components without following symbolic links.
The main fixes then convert getfattr to directory-relative xattr operations [7] and harden setfattr --restore [8]. Restore retains upstream compatibility behavior: -P protects directory traversal, while -h prevents dereferencing the final component. Physical directory resolution fails rather than silently falling back when openat2 is unavailable.
Replace the existing walker in place, avoiding the upstream old-walker rename and duplicate implementation. Include the relevant test changes from [9] to stabilize root-test output on SELinux hosts. Read the ptest TESTS list from the generated Makefile so conditional tests are installed according to the configured build.
[1] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=21b5e5b9d394612f44e384c8fa024aea5e8dac68
[2] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=c62e9b55edd512ba3f87eaaaf5b822bd2a76bfe9
[3] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=c462283577f1a6479229c43184ad6af5921f439b
[4] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=9b37b117c5d5703aa7481f4c34f73b24c010ad25
[5] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=4fce17388e014a06cca16914ab3b7e4a0d117856
[6] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=1cea2fc5e8b5c8a5f29abf1141399e01a57a3154
[7] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=641ea6fcc556c1f34b77efb9cd3f876dff0a0a07
[8] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8
[9] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=303335494a326026bc37e8d83ca47fa1a4d8dde6
[10] https://security-tracker.debian.org/tracker/CVE-2026-54371
--- .../attr/CVE-2026-54371-dependent_p1.patch | 48 ++ .../attr/CVE-2026-54371-dependent_p2.patch | 197 +++++ .../attr/CVE-2026-54371-dependent_p3.patch | 710 ++++++++++++++++++ .../attr/CVE-2026-54371-dependent_p4.patch | 638 ++++++++++++++++ .../attr/CVE-2026-54371-dependent_p5.patch | 63 ++ .../attr/CVE-2026-54371-dependent_p6.patch | 140 ++++ .../attr/attr/CVE-2026-54371_p1.patch | 390 ++++++++++ .../attr/attr/CVE-2026-54371_p2.patch | 476 ++++++++++++ meta/recipes-support/attr/attr_2.5.2.bb | 10 +- 9 files changed, 2671 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p1.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p2.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p3.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p4.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p5.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p6.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371_p1.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371_p2.patch
meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p1.patch new file +48 -0
@@ -0,0 +1,48 @@ +From 21b5e5b9d394612f44e384c8fa024aea5e8dac68 Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher <[email protected]> +Date: Fri, 12 Jun 2026 17:32:40 +0200 +Subject: [PATCH] Add visibility attribute header + +CVE: CVE-2026-54371 +Upstream-Status: Backport [https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=21b5e5b9d394612f44e384c8fa024aea5e8dac68] + +Signed-off-by: Andreas Gruenbacher <[email protected]> +(cherry picked from commit 21b5e5b9d394612f44e384c8fa024aea5e8dac68) +Signed-off-by: Hetvi Thakar <[email protected]> +--- + include/Makemodule.am | 1 + + include/visibility-hidden.h | 11 +++++++++++ + 2 files changed, 12 insertions(+) + create mode 100644 include/visibility-hidden.h + +diff --git a/include/Makemodule.am b/include/Makemodule.am +index 3531fa1..f300edb 100644 +--- a/include/Makemodule.am ++++ b/include/Makemodule.am +@@ -4,6 +4,7 @@ noinst_HEADERS += \ + include/libattr.h \ + include/misc.h \ + include/nls.h \ ++ include/visibility-hidden.h \ + include/walk_tree.h + + +diff --git a/include/visibility-hidden.h b/include/visibility-hidden.h +new file mode 100644 +index 0000000..2d02731 +--- /dev/null ++++ b/include/visibility-hidden.h +@@ -0,0 +1,11 @@ ++#ifndef VISIBILITY_HIDDEN_H ++#define VISIBILITY_HIDDEN_H ++ ++/* Mark library internal functions as hidden */ ++#if defined(HAVE_VISIBILITY_ATTRIBUTE) ++# define hidden __attribute__((visibility("hidden"))) ++#else ++# define hidden /* hidden */ ++#endif ++ ++#endif /* VISIBILITY_HIDDEN_H */ +-- +2.35.6
meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p2.patch new file +197 -0
197 lines not on this page · raw message
meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p3.patch new file +710 -0
710 lines not on this page · raw message
meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p4.patch new file +638 -0
638 lines not on this page · raw message
meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p5.patch new file +63 -0
63 lines not on this page · raw message
meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p6.patch new file +140 -0
140 lines not on this page · raw message
meta/recipes-support/attr/attr/CVE-2026-54371_p1.patch new file +390 -0
390 lines not on this page · raw message
meta/recipes-support/attr/attr/CVE-2026-54371_p2.patch new file +476 -0
476 lines not on this page · raw message
meta/recipes-support/attr/attr_2.5.2.bb +9 -1
@@ -17,6 +17,14 @@ LIC_FILES_CHKSUM = "file://doc/COPYING;md5=2d0aa14b3fce4694e4f615e30186335f \ SRC_URI = "${SAVANNAH_GNU_MIRROR}/attr/${BP}.tar.gz \ file://run-ptest \ file://0001-attr.c-Include-libgen.h-for-posix-version-of-basenam.patch \ + file://CVE-2026-54371-dependent_p1.patch \ + file://CVE-2026-54371-dependent_p2.patch \ + file://CVE-2026-54371-dependent_p3.patch \ + file://CVE-2026-54371-dependent_p4.patch \ + file://CVE-2026-54371-dependent_p5.patch \ + file://CVE-2026-54371-dependent_p6.patch \ + file://CVE-2026-54371_p1.patch \ + file://CVE-2026-54371_p2.patch \ " SRC_URI[sha256sum] = "39bf67452fa41d0948c2197601053f48b3d78a029389734332a6309a680c6c87"
@@ -35,7 +43,7 @@ ALTERNATIVE_TARGET[getfattr] = "${bindir}/getfattr" do_install_ptest() { install -m755 ${S}/test/run ${S}/test/sort-getfattr-output ${D}${PTEST_PATH}/ - for t in $(makefile-getvar ${S}/test/Makemodule.am TESTS); do + for t in $(makefile-getvar ${B}/Makefile TESTS); do install -m644 ${S}/$t ${D}${PTEST_PATH}/ done }
Signature · 1 line
2.35.6
Quoted 73 lines · On Thu Nov 5, 2026 at 6:35 AM CET, Hetvi Thakar -X (hthakar - E INFOCHIPS…
From: Hetvi Thakar <[email protected]>
getfattr traversal and setfattr restore operations can follow attacker-controlled symlinks and access unintended files. This can lead to privilege escalation when invoked by a privileged process.
Backport the upstream hardening commits [7] and [8], identified by the Debian tracker [10], while retaining attr 2.5.2. These fixes use interfaces absent from 2.5.2, requiring the following prerequisites in their dependency order:
- [1] Add the visibility attribute header. The compatibility helpers introduced by [3] include this header and use its hidden annotation for internal declarations.
- [2] Add xattrat syscall wrappers. These provide the
getxattrat(),setxattrat(),listxattrat()andremovexattrat()entry points used by
[3] when the C library does not provide them.- [3] Add xattrat compatibility helpers. The hardening fixes use these interfaces for directory-relative extended-attribute operations. They provide fallbacks for older kernels and unsupported O_PATH/AT_EMPTY_PATH combinations, using
/proc/self/fdwhere needed.- [4] Add the directory-fd-based
walk_treeimplementation and callback interface required by [7]. This allows getfattr to access entries relative to directory descriptors instead of repeatedly resolving their complete pathnames.- [5] Defer restoration until command-line parsing is complete. This ensures -h and the -P option introduced by [8] take effect even when specified after --restore.
- [6] Add openat2 detection and a syscall wrapper. Commit [8] uses this interface with
RESOLVE_NO_SYMLINKSto resolve restore directory components without following symbolic links.The main fixes then convert getfattr to directory-relative xattr operations [7] and harden setfattr --restore [8]. Restore retains upstream compatibility behavior: -P protects directory traversal, while -h prevents dereferencing the final component. Physical directory resolution fails rather than silently falling back when openat2 is unavailable.
Replace the existing walker in place, avoiding the upstream old-walker rename and duplicate implementation. Include the relevant test changes from [9] to stabilize root-test output on SELinux hosts. Read the ptest TESTS list from the generated
Makefileso conditional tests are installed according to the configured build.[1] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=21b5e5b9d394612f44e384c8fa024aea5e8dac68
[2] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=c62e9b55edd512ba3f87eaaaf5b822bd2a76bfe9
[3] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=c462283577f1a6479229c43184ad6af5921f439b
[4] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=9b37b117c5d5703aa7481f4c34f73b24c010ad25
[5] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=4fce17388e014a06cca16914ab3b7e4a0d117856
[6] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=1cea2fc5e8b5c8a5f29abf1141399e01a57a3154
[7] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=641ea6fcc556c1f34b77efb9cd3f876dff0a0a07
[8] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8
[9] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=303335494a326026bc37e8d83ca47fa1a4d8dde6
[10] https://security-tracker.debian.org/tracker/CVE-2026-54371Signed-off-by Hetvi Thakar <[email protected]>--- .../attr/CVE-2026-54371-dependent_p1.patch | 48 ++ .../attr/CVE-2026-54371-dependent_p2.patch | 197 +++++ .../attr/CVE-2026-54371-dependent_p3.patch | 710 ++++++++++++++++++ .../attr/CVE-2026-54371-dependent_p4.patch | 638 ++++++++++++++++ .../attr/CVE-2026-54371-dependent_p5.patch | 63 ++ .../attr/CVE-2026-54371-dependent_p6.patch | 140 ++++ .../attr/attr/CVE-2026-54371_p1.patch | 390 ++++++++++ .../attr/attr/CVE-2026-54371_p2.patch | 476 ++++++++++++ meta/recipes-support/attr/attr_2.5.2.bb | 10 +- 9 files changed, 2671 insertions(+), 1 deletion(-)
Quoted 8 lines
create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p1.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p2.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p3.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p4.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p5.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p6.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371_p1.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371_p2.patch
Hello,
This is quite a big patch ("2671 insertions(+)"). Looking at it, I think this might be just backporting most of the risky parts of the 2.6.0 upgrade, but then, we might just be better off simply upgrading to 2.6.0. Do you have thoughts about that? Are there definite breakage on a potential 2.6.0 upgrade?
Obviously, a 2.6.0 upgrade would need serious thoughts/discussion but this might be the way forward.
Note: This is a similar situation to the acl series (CVE-2026-54369 and CVE-2026-54370, acl 2.3.2 vs 2.4.0), see [1].
[1] https://lore.kernel.org/all/[email protected]/
Regards,
Signature · 2 lines
Yoann Congal Smile ECS
Hi Yoann,
Thanks for the review. I agree that upgrading to 2.6.0 makes more sense given the size and scope of the backport.
I haven’t identified any definite upgrade-related breakage so far.
I’m preparing the 2.6.0 upgrade for Wrynose and will share it for review.
Thanks,
Hetvi
________________________________
From: Yoann Congal via openembedded-core <[email protected]>
Sent: 15 November 2026 06:19
To: Hetvi Thakar -X (hthakar - E INFOCHIPS PRIVATE LIMITED at Cisco) <[email protected]>; [email protected] <[email protected]>
Subject: Re: [OE-core][wrynose][PATCH ] attr: fix CVE-2026-54371
Quoted 73 lines · On Thu Nov 5, 2026 at 6:35 AM CET, Hetvi Thakar -X (hthakar - E INFOCHIPS…
From: Hetvi Thakar <[email protected]>
getfattr traversal and setfattr restore operations can follow attacker-controlled symlinks and access unintended files. This can lead to privilege escalation when invoked by a privileged process.
Backport the upstream hardening commits [7] and [8], identified by the Debian tracker [10], while retaining attr 2.5.2. These fixes use interfaces absent from 2.5.2, requiring the following prerequisites in their dependency order:
- [1] Add the visibility attribute header. The compatibility helpers introduced by [3] include this header and use its hidden annotation for internal declarations.
- [2] Add xattrat syscall wrappers. These provide the
getxattrat(),setxattrat(),listxattrat()andremovexattrat()entry points used by
[3] when the C library does not provide them.- [3] Add xattrat compatibility helpers. The hardening fixes use these interfaces for directory-relative extended-attribute operations. They provide fallbacks for older kernels and unsupported O_PATH/AT_EMPTY_PATH combinations, using
/proc/self/fdwhere needed.- [4] Add the directory-fd-based
walk_treeimplementation and callback interface required by [7]. This allows getfattr to access entries relative to directory descriptors instead of repeatedly resolving their complete pathnames.- [5] Defer restoration until command-line parsing is complete. This ensures -h and the -P option introduced by [8] take effect even when specified after --restore.
- [6] Add openat2 detection and a syscall wrapper. Commit [8] uses this interface with
RESOLVE_NO_SYMLINKSto resolve restore directory components without following symbolic links.The main fixes then convert getfattr to directory-relative xattr operations [7] and harden setfattr --restore [8]. Restore retains upstream compatibility behavior: -P protects directory traversal, while -h prevents dereferencing the final component. Physical directory resolution fails rather than silently falling back when openat2 is unavailable.
Replace the existing walker in place, avoiding the upstream old-walker rename and duplicate implementation. Include the relevant test changes from [9] to stabilize root-test output on SELinux hosts. Read the ptest TESTS list from the generated
Makefileso conditional tests are installed according to the configured build.[1] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=21b5e5b9d394612f44e384c8fa024aea5e8dac68
[2] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=c62e9b55edd512ba3f87eaaaf5b822bd2a76bfe9
[3] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=c462283577f1a6479229c43184ad6af5921f439b
[4] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=9b37b117c5d5703aa7481f4c34f73b24c010ad25
[5] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=4fce17388e014a06cca16914ab3b7e4a0d117856
[6] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=1cea2fc5e8b5c8a5f29abf1141399e01a57a3154
[7] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=641ea6fcc556c1f34b77efb9cd3f876dff0a0a07
[8] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8
[9] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=303335494a326026bc37e8d83ca47fa1a4d8dde6
[10] https://security-tracker.debian.org/tracker/CVE-2026-54371Signed-off-by Hetvi Thakar <[email protected]>--- .../attr/CVE-2026-54371-dependent_p1.patch | 48 ++ .../attr/CVE-2026-54371-dependent_p2.patch | 197 +++++ .../attr/CVE-2026-54371-dependent_p3.patch | 710 ++++++++++++++++++ .../attr/CVE-2026-54371-dependent_p4.patch | 638 ++++++++++++++++ .../attr/CVE-2026-54371-dependent_p5.patch | 63 ++ .../attr/CVE-2026-54371-dependent_p6.patch | 140 ++++ .../attr/attr/CVE-2026-54371_p1.patch | 390 ++++++++++ .../attr/attr/CVE-2026-54371_p2.patch | 476 ++++++++++++ meta/recipes-support/attr/attr_2.5.2.bb | 10 +- 9 files changed, 2671 insertions(+), 1 deletion(-)
Quoted 8 lines
create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p1.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p2.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p3.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p4.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p5.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371-dependent_p6.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371_p1.patch create mode 100644 meta/recipes-support/attr/attr/CVE-2026-54371_p2.patch
Hello,
This is quite a big patch ("2671 insertions(+)"). Looking at it, I think this might be just backporting most of the risky parts of the 2.6.0 upgrade, but then, we might just be better off simply upgrading to 2.6.0. Do you have thoughts about that? Are there definite breakage on a potential 2.6.0 upgrade?
Obviously, a 2.6.0 upgrade would need serious thoughts/discussion but this might be the way forward.
Note: This is a similar situation to the acl series (CVE-2026-54369 and CVE-2026-54370, acl 2.3.2 vs 2.4.0), see [1].
[1] https://lore.kernel.org/all/[email protected]/
Regards,
--
Yoann Congal
Smile ECS