From: Richard Purdie Date: Tue, 13 Jan 2026 10:50:48 +0000 (+0000) Subject: unfs3: Fix race issue causing a glibc test hang X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e51d5e19cb1ba1d5ad7442064b64821d178bc9ca;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git unfs3: Fix race issue causing a glibc test hang 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 --- diff --git a/meta/recipes-devtools/unfs3/unfs3/fixrace.patch b/meta/recipes-devtools/unfs3/unfs3/fixrace.patch new file mode 100644 index 0000000000..b41ec4b3d2 --- /dev/null +++ b/meta/recipes-devtools/unfs3/unfs3/fixrace.patch @@ -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); + diff --git a/meta/recipes-devtools/unfs3/unfs3_0.11.0.bb b/meta/recipes-devtools/unfs3/unfs3_0.11.0.bb index b8c235fb7c..793f5c83ce 100644 --- a/meta/recipes-devtools/unfs3/unfs3_0.11.0.bb +++ b/meta/recipes-devtools/unfs3/unfs3_0.11.0.bb @@ -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\d+(\.\d+)+)"