Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Suresh H A <UpStream_IP-SH@bmwtechworks.in>
To: openembedded-core@lists.openembedded.org, suresh.ha@bmwtechworks.in
Cc: Suresh H A <Suresh.HA@bmwtechworks.in>
Subject: [scarthgap][PATCH] fs-util: try AT_EMPTY_PATH for access_fd() first
Date: Wed,  2 Sep 2026 15:54:03 +0530	[thread overview]
Message-ID: <20260902102403.4010166-1-UpStream_IP-SH@bmwtechworks.in> (raw)

From: Suresh H A <Suresh.HA@bmwtechworks.in>

Backport a fix to try AT_EMPTY_PATH for access_fd() first
Fix is already available since systemd v257-rc1.

Signed-off-by: Suresh H A <Suresh.HA@bmwtechworks.in>
---
 ...ry-AT_EMPTY_PATH-for-access_fd-first.patch | 37 +++++++++++++++++++
 meta/recipes-core/systemd/systemd_255.21.bb   |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/0023-fs-util-try-AT_EMPTY_PATH-for-access_fd-first.patch

diff --git a/meta/recipes-core/systemd/systemd/0023-fs-util-try-AT_EMPTY_PATH-for-access_fd-first.patch b/meta/recipes-core/systemd/systemd/0023-fs-util-try-AT_EMPTY_PATH-for-access_fd-first.patch
new file mode 100644
index 0000000000..29dd86c850
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0023-fs-util-try-AT_EMPTY_PATH-for-access_fd-first.patch
@@ -0,0 +1,37 @@
+From 55453c9671934fc7ee369788eb0a1a9c8c850e8f Mon Sep 17 00:00:00 2001
+From: Mike Yuan <me@yhndnzj.com>
+Date: Mon, 20 May 2024 19:33:26 +0800
+Subject: [PATCH] fs-util: try AT_EMPTY_PATH for access_fd() first
+
+Upstream-Status: Backport
+[https://github.com/systemd/systemd/pull/32933/commits/c675851d5fd503c1ae5d244f041d43ae9e3ab79b]
+
+Comment: Patch is refreshed as per codebase of v255
+
+Signed-off-by: Suresh H A <Suresh.HA@bmwtechworks.in>
+---
+ src/basic/fs-util.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
+index ee38e0266a..0f65af1a07 100644
+--- a/src/basic/fs-util.c
++++ b/src/basic/fs-util.c
+@@ -664,6 +664,14 @@ int unlink_or_warn(const char *filename) {
+ int access_fd(int fd, int mode) {
+         /* Like access() but operates on an already open fd */
+ 
++        if (faccessat(fd, "", mode, AT_EMPTY_PATH) >= 0)
++                return 0;
++        if (errno != EINVAL)
++                return -errno;
++
++        /* Support for AT_EMPTY_PATH is added rather late (kernel 5.8), so fall back to going through /proc/
++         * if unavailable. */
++
+         if (access(FORMAT_PROC_FD_PATH(fd), mode) < 0) {
+                 if (errno != ENOENT)
+                         return -errno;
+-- 
+2.43.0
+
diff --git a/meta/recipes-core/systemd/systemd_255.21.bb b/meta/recipes-core/systemd/systemd_255.21.bb
index 9c5f8af240..b6e75d42b0 100644
--- a/meta/recipes-core/systemd/systemd_255.21.bb
+++ b/meta/recipes-core/systemd/systemd_255.21.bb
@@ -33,6 +33,7 @@ SRC_URI += " \
            file://CVE-2026-40225-02.patch \
            file://CVE-2026-40226-01.patch \
            file://CVE-2026-40226-02.patch \
+           file://0023-fs-util-try-AT_EMPTY_PATH-for-access_fd-first.patch \
            "
 
 # patches needed by musl
-- 
2.43.0



             reply	other threads:[~2026-09-02 12:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 10:24 Suresh H A [this message]
2026-09-15  6:42 ` [scarthgap][PATCH] fs-util: try AT_EMPTY_PATH for access_fd() first Suresh H A
2026-09-22 11:52 ` [OE-core] " Yoann Congal
2026-09-25  6:43   ` Suresh H A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260902102403.4010166-1-UpStream_IP-SH@bmwtechworks.in \
    --to=upstream_ip-sh@bmwtechworks.in \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=suresh.ha@bmwtechworks.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox