]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
unfs3: Fix race issue causing a glibc test hang
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 13 Jan 2026 10:50:48 +0000 (10:50 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 13 Jan 2026 23:26:06 +0000 (23:26 +0000)
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]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/unfs3/unfs3/fixrace.patch [new file with mode: 0644]
meta/recipes-devtools/unfs3/unfs3_0.11.0.bb

diff --git a/meta/recipes-devtools/unfs3/unfs3/fixrace.patch b/meta/recipes-devtools/unfs3/unfs3/fixrace.patch
new file mode 100644 (file)
index 0000000..b41ec4b
--- /dev/null
@@ -0,0 +1,35 @@
+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
+
+Index: unfs3-0.11.0/nfs.c
+===================================================================
+--- unfs3-0.11.0.orig/nfs.c
++++ unfs3-0.11.0/nfs.c
+@@ -776,9 +776,11 @@ MKNOD3res *nfsproc3_mknod_3_svc(MKNOD3ar
+     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);
index b8c235fb7cd7402d8b8083ea9511e724b5575bba..793f5c83ce5a8fc10e8d7b7e200d4d6da18cac12 100644 (file)
@@ -9,7 +9,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=c1c621cd2786a3a1344a60a0d608c910"
 
 DEPENDS = "bison-native flex-native libtirpc"
 
-SRC_URI = "git://github.com/unfs3/unfs3.git;protocol=https;branch=master;tag=${BP}"
+SRC_URI = "git://github.com/unfs3/unfs3.git;protocol=https;branch=master;tag=${BP} \
+           file://fixrace.patch"
 SRCREV = "ec1660ba33c80d5c67131e163e68834c1a10e243"
 UPSTREAM_CHECK_GITTAGREGEX = "unfs3\-(?P<pver>\d+(\.\d+)+)"