@@ -22,6 +22,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
file://0003-mount-fix-grammar-and-typo-in-X-mount.idmap-document.patch \
file://0004-libmount-use-USE_LIBMOUNT_MOUNTFD_SUPPORT-for-idmap-h.patch \
file://0005-tools-add-non-newmount.conf-config-gen-profile.patch \
+ file://0006-tests-lsfd-accept-rw-mode-for-mmap-ed-packet-socket-.patch \
"
SRC_URI[sha256sum] = "66ac7c0e725278eb2b039e3104f2c91119341d941b41bac7a285c695f940bd57"
new file mode 100644
@@ -0,0 +1,45 @@
+From e3c633ee981969d4bf53d276bc72052121774aaf Mon Sep 17 00:00:00 2001
+From: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
+Date: Thu, 10 Sep 2026 09:35:49 +0000
+Subject: [PATCH] tests: (lsfd) accept "rw-" mode for mmap'ed packet socket
+
+mkfds-mapped-packet-socket creates the packet ring with
+mmap(..., PROT_WRITE, MAP_SHARED, sd, 0), i.e. write-only, and filters
+the lsfd output with (MODE == "-w-").
+
+On architectures such as riscv64 the kernel reports a PROT_WRITE-only
+mapping as readable too, because RISC-V has no write-only page
+permission encoding (a writable page is implicitly readable). As a
+result /proc/PID/maps shows the mapping as "rw-s" rather than "-w-s":
+
+ 3fbec87000-3fbec88000 rw-s 00000000 00:09 4238 socket:[4238]
+
+lsfd derives MODE from these bits and reports "rw-", so the
+(MODE == "-w-") filter matches nothing and the expected PACKET /
+SOCK.PROTONAME lines are missing, failing the test even though lsfd
+behaves correctly.
+
+Relax the filter to also accept "rw-" so the test passes on riscv64
+while remaining correct on architectures that report "-w-".
+
+Closes: https://github.com/util-linux/util-linux/issues/4618
+
+Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/4619]
+
+Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
+---
+diff --git a/tests/ts/lsfd/mkfds-mapped-packet-socket b/tests/ts/lsfd/mkfds-mapped-packet-socket
+index ab1f72c..03d5db5 100755
+--- a/tests/ts/lsfd/mkfds-mapped-packet-socket
++++ b/tests/ts/lsfd/mkfds-mapped-packet-socket
+@@ -42,7 +42,7 @@ for PROTOCOL in $(printf "%d" 0x10) 10000; do
+ coproc MKFDS { "$TS_HELPER_MKFDS" mapped-packet-socket $FD \
+ interface=${INTERFACE} socktype=${SOCKTYPE} protocol=${PROTOCOL}; }
+ if read -u ${MKFDS[0]} PID; then
+- EXPR='(ASSOC == "shm") and (STTYPE == "SOCK") and (MODE == "-w-")'
++ EXPR='(ASSOC == "shm") and (STTYPE == "SOCK") and ((MODE == "-w-") or (MODE == "rw-"))'
+ ${TS_CMD_LSFD} --pid "$PID" --noheadings --output SOCK.PROTONAME --filter "${EXPR}"
+ echo 'SOCK.PROTONAME': $?
+
+--
+2.43.0
riscv64 reports the write-only packet-ring mmap as "rw-s" (RISC-V has no write-only page encoding), so lsfd reports MODE "rw-" and the test's (MODE == "-w-") filter excluded the shm row, making the expected PACKET lines disappear. Reported upstream (issue #4618) and backport the fix. Failure case logs: root@qemuriscv64:/usr/lib/util-linux/ptest# ./tests/run.sh --use-system-commands --show-diff lsfd/mkfds-mapped-packet-socket ---- kernel: 7.2.4-yocto-standard options: --use-system-commands \ --show-diff \ --srcdir=/usr/lib/util-linux/ptest/tests/.. \ --builddir=/usr/lib/util-linux/ptest/tests/.. lsfd: mmap'ed AF_PACKET socket ... diff-{{{ --- /usr/lib/util-linux/ptest/tests/expected/lsfd/mkfds-mapped-packet-socket 2011-04-05 23:00:00.000000000 +0000 +++ /usr/lib/util-linux/ptest/tests/output/lsfd/mkfds-mapped-packet-socket 2026-09-10 05:57:24.219872733 +0000 @@ -1,16 +1,12 @@ -PACKET SOCK.PROTONAME: 0 type=raw protocol=ppptalk iface=lo raw PACKET lo ppptalk 16 NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL,PACKET.PROTOCOL.RAW: 0 -PACKET SOCK.PROTONAME: 0 type=dgram protocol=ppptalk iface=lo dgram PACKET lo ppptalk 16 NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL,PACKET.PROTOCOL.RAW: 0 -PACKET SOCK.PROTONAME: 0 type=raw protocol=unknown(10000) iface=lo raw PACKET lo unknown(10000) 10000 NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL,PACKET.PROTOCOL.RAW: 0 -PACKET SOCK.PROTONAME: 0 type=dgram protocol=unknown(10000) iface=lo dgram PACKET lo unknown(10000) 10000 NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL,PACKET.PROTOCOL.RAW: 0 }}}-diff FAILED (lsfd/mkfds-mapped-packet-socket) ---- Working case logs: root@qemuriscv64:/usr/lib/util-linux/ptest# ./tests/run.sh --use-system-commands --show-diff lsfd/mkfds-mapped-packet-socket ---- kernel: 7.2.4-yocto-standard options: --use-system-commands \ --show-diff \ --srcdir=/usr/lib/util-linux/ptest/tests/.. \ --builddir=/usr/lib/util-linux/ptest/tests/.. lsfd: mmap'ed AF_PACKET socket ... OK ---- Upstream issue: https://github.com/util-linux/util-linux/issues/4618 Upstream PR: https://github.com/util-linux/util-linux/pull/4619 Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech> --- meta/recipes-core/util-linux/util-linux.inc | 1 + ...t-rw-mode-for-mmap-ed-packet-socket-.patch | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 meta/recipes-core/util-linux/util-linux/0006-tests-lsfd-accept-rw-mode-for-mmap-ed-packet-socket-.patch