From: Hemanth.KumarMD@windriver.com
To: openembedded-core@lists.openembedded.org
Cc: Sundeep.Kokkonda@windriver.com, Hemanth.kumarMD@windriver.com
Subject: [scarthgap][PATCH v2] unfs3: Fix race issue causing a glibc test hang
Date: Thu, 2 Apr 2026 01:21:35 -0700 [thread overview]
Message-ID: <20260402082135.1576318-1-Hemanth.KumarMD@windriver.com> (raw)
From: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
When running glibc tests under user mode NFS, tst-syslog was causing a hang. The
hang was traced to unfsd exitting with a buffer overflow being detected.
This was traced down to mksocket() where we'd see:
socket path '/media/build/poky/build/build-st-2118464/tmp/work/x86-64-v3-poky-linux/glibc-testsuite/2.42+git/build-x86_64-poky-linux/testroot.root/dev/log' is too long at 141 vs 108
There is a length check in mknod_args() but obj may not be setup at this point by
cat_name() since the functions can be executed out of order according to C.
To avoid this, make the order explict. This means the length is checked and we
avoid the buffer overflow. This will likely cause the glibc test to fail however
it won't hang, which is a win.
[YOCTO #16113]
(From OE-Core rev: e51d5e19cb1ba1d5ad7442064b64821d178bc9ca)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
---
.../unfs3/unfs3/fixrace.patch | 38 +++++++++++++++++++
meta/recipes-devtools/unfs3/unfs3_git.bb | 1 +
2 files changed, 39 insertions(+)
create mode 100644 meta/recipes-devtools/unfs3/unfs3/fixrace.patch
diff --git a/meta/recipes-devtools/unfs3/unfs3/fixrace.patch b/meta/recipes-devtools/unfs3/unfs3/fixrace.patch
new file mode 100644
index 0000000000..ebdb0d79f5
--- /dev/null
+++ b/meta/recipes-devtools/unfs3/unfs3/fixrace.patch
@@ -0,0 +1,38 @@
+When running glibc tests under user mode NFS, tst-syslog was causing a hang. The
+hang was traced to unfsd exitting with a buffer overflow being detected.
+
+This was traced down to mksocket() where we'd see:
+
+socket path '/media/build/poky/build/build-st-2118464/tmp/work/x86-64-v3-poky-linux/glibc-testsuite/2.42+git/build-x86_64-poky-linux/testroot.root/dev/log' is too long at 141 vs 108
+
+There is a length check in mknod_args() but obj may not be setup at this point by
+cat_name() since the functions can be executed out of order according to C.
+
+To avoid this, make the order explict. This means the length is checked and we
+avoid the buffer overflow. This will likely cause the glibc test to fail however
+it won't hang, which is a win.
+
+Upstream-Status: Pending
+
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+Signed-off-by: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
+
+diff --git a/nfs.c b/nfs.c
+index 3e92f87..784089a 100644
+--- a/nfs.c
++++ b/nfs.c
+@@ -776,9 +776,11 @@ MKNOD3res *nfsproc3_mknod_3_svc(MKNOD3args * argp, struct svc_req * rqstp)
+
+ PREP(path, argp->where.dir);
+ pre = get_pre_cached();
+- result.status =
+- join3(cat_name(path, argp->where.name, obj),
+- mknod_args(argp->what, obj, &new_mode, &dev), exports_rw());
++ result.status = cat_name(path, argp->where.name, obj);
++ if (result.status == NFS3_OK)
++ result.status = mknod_args(argp->what, obj, &new_mode, &dev);
++ if (result.status == NFS3_OK)
++ result.status = exports_rw();
+
+ cluster_create(obj, rqstp, &result.status);
+
diff --git a/meta/recipes-devtools/unfs3/unfs3_git.bb b/meta/recipes-devtools/unfs3/unfs3_git.bb
index c5b7898b3c..50d5cd272f 100644
--- a/meta/recipes-devtools/unfs3/unfs3_git.bb
+++ b/meta/recipes-devtools/unfs3/unfs3_git.bb
@@ -18,6 +18,7 @@ SRC_URI = "git://github.com/unfs3/unfs3.git;protocol=https;branch=master \
file://0001-locate.c-Include-attr.h.patch \
file://0001-fix-building-on-macOS.patch \
file://0001-attr-fix-utime-for-symlink.patch \
+ file://fixrace.patch \
"
SRCREV = "c8f2d2cd4529955419bad0e163f88d47ff176b8d"
UPSTREAM_CHECK_GITTAGREGEX = "unfs3\-(?P<pver>\d+(\.\d+)+)"
--
2.49.0
reply other threads:[~2026-04-02 8:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260402082135.1576318-1-Hemanth.KumarMD@windriver.com \
--to=hemanth.kumarmd@windriver.com \
--cc=Sundeep.Kokkonda@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/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