mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
strace: Update patches/tests with upstream fixes
Replace the sockopt disable patch with a fix from upstream (From OE-Core rev: cef730284b8616ba07c1b062c992c36af730580e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit ac921989991c319ecad01bec37c4ccaa15a7b58f) Signed-off-by: Steve Sakoman <steve@sakoman.com> (cherry picked from commit c1beb73526e3ade75bd6dae5f9310107c50f1226) Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
committed by
Steve Sakoman
parent
97654445c6
commit
fdd6898464
@@ -0,0 +1,50 @@
|
||||
From 3bbfb541b258baec9eba674b5d8dc30007a61542 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@strace.io>
|
||||
Date: Wed, 21 Jun 2023 08:00:00 +0000
|
||||
Subject: [PATCH] net: enhance getsockopt decoding
|
||||
|
||||
When getsockopt syscall fails the kernel sometimes updates the optlen
|
||||
argument, for example, NETLINK_LIST_MEMBERSHIPS updates it even if
|
||||
optval is not writable.
|
||||
|
||||
* src/net.c (SYS_FUNC(getsockopt)): Try to fetch and print optlen
|
||||
argument on exiting syscall regardless of getsockopt exit status.
|
||||
|
||||
Upstream-Status: Backport
|
||||
---
|
||||
src/net.c | 15 ++++++++++++++-
|
||||
1 file changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/net.c b/src/net.c
|
||||
index f68ccb947..7244b5e57 100644
|
||||
--- a/src/net.c
|
||||
+++ b/src/net.c
|
||||
@@ -1038,7 +1038,7 @@ SYS_FUNC(getsockopt)
|
||||
} else {
|
||||
ulen = get_tcb_priv_ulong(tcp);
|
||||
|
||||
- if (syserror(tcp) || umove(tcp, tcp->u_arg[4], &rlen) < 0) {
|
||||
+ if (umove(tcp, tcp->u_arg[4], &rlen) < 0) {
|
||||
/* optval */
|
||||
printaddr(tcp->u_arg[3]);
|
||||
tprint_arg_next();
|
||||
@@ -1047,6 +1047,19 @@ SYS_FUNC(getsockopt)
|
||||
tprint_indirect_begin();
|
||||
PRINT_VAL_D(ulen);
|
||||
tprint_indirect_end();
|
||||
+ } else if (syserror(tcp)) {
|
||||
+ /* optval */
|
||||
+ printaddr(tcp->u_arg[3]);
|
||||
+ tprint_arg_next();
|
||||
+
|
||||
+ /* optlen */
|
||||
+ tprint_indirect_begin();
|
||||
+ if (ulen != rlen) {
|
||||
+ PRINT_VAL_D(ulen);
|
||||
+ tprint_value_changed();
|
||||
+ }
|
||||
+ PRINT_VAL_D(rlen);
|
||||
+ tprint_indirect_end();
|
||||
} else {
|
||||
/* optval */
|
||||
print_getsockopt(tcp, tcp->u_arg[1], tcp->u_arg[2],
|
||||
@@ -0,0 +1,50 @@
|
||||
From f31c2f4494779e5c5f170ad10539bfc2dfafe967 Mon Sep 17 00:00:00 2001
|
||||
From: "Dmitry V. Levin" <ldv@strace.io>
|
||||
Date: Sat, 24 Jun 2023 08:00:00 +0000
|
||||
Subject: [PATCH] tests: update sockopt-sol_netlink test
|
||||
|
||||
Update sockopt-sol_netlink test that started to fail, likely
|
||||
due to recent linux kernel commit f4e4534850a9 ("net/netlink: fix
|
||||
NETLINK_LIST_MEMBERSHIPS length report").
|
||||
|
||||
* tests/sockopt-sol_netlink.c (main): Always print changing optlen value
|
||||
on exiting syscall.
|
||||
|
||||
Reported-by: Alexander Gordeev <agordeev@linux.ibm.com>
|
||||
---
|
||||
tests/sockopt-sol_netlink.c | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
diff --git a/tests/sockopt-sol_netlink.c b/tests/sockopt-sol_netlink.c
|
||||
index 82b98adc23..1c33219ac5 100644
|
||||
--- a/tests/sockopt-sol_netlink.c
|
||||
+++ b/tests/sockopt-sol_netlink.c
|
||||
@@ -94,7 +94,10 @@ main(void)
|
||||
printf("%p", val);
|
||||
else
|
||||
printf("[%d]", *val);
|
||||
- printf(", [%d]) = %s\n", *len, errstr);
|
||||
+ printf(", [%d", (int) sizeof(*val));
|
||||
+ if ((int) sizeof(*val) != *len)
|
||||
+ printf(" => %d", *len);
|
||||
+ printf("]) = %s\n", errstr);
|
||||
|
||||
/* optlen larger than necessary - shortened */
|
||||
*len = sizeof(*val) + 1;
|
||||
@@ -150,8 +153,12 @@ main(void)
|
||||
/* optval EFAULT - print address */
|
||||
*len = sizeof(*val);
|
||||
get_sockopt(fd, names[i].val, efault, len);
|
||||
- printf("getsockopt(%d, SOL_NETLINK, %s, %p, [%d]) = %s\n",
|
||||
- fd, names[i].str, efault, *len, errstr);
|
||||
+ printf("getsockopt(%d, SOL_NETLINK, %s, %p",
|
||||
+ fd, names[i].str, efault);
|
||||
+ printf(", [%d", (int) sizeof(*val));
|
||||
+ if ((int) sizeof(*val) != *len)
|
||||
+ printf(" => %d", *len);
|
||||
+ printf("]) = %s\n", errstr);
|
||||
|
||||
/* optlen EFAULT - print address */
|
||||
get_sockopt(fd, names[i].val, val, len + 1);
|
||||
@@ -1,37 +0,0 @@
|
||||
Upstream-Status: Inappropriate [avoid this test until fixed by upstream]
|
||||
|
||||
Reported at https://github.com/strace/strace/issues/257
|
||||
|
||||
root@qemux86-64:/usr/lib/strace/ptest/tests# make sockopt-sol_netlink.gen.log
|
||||
FAIL: sockopt-sol_netlink.gen.test
|
||||
|
||||
#root@qemux86-64:/usr/lib/strace/ptest/tests# diff sockopt-sol_netlink.dir/exp sockopt-sol_netlink.dir/out
|
||||
#--- sockopt-sol_netlink.dir/exp
|
||||
#+++ sockopt-sol_netlink.dir/out
|
||||
#@@ -86,11 +86,11 @@
|
||||
setsockopt(3, SOL_NETLINK, NETLINK_LISTEN_ALL_NSID, 0x7fa18a802ffc, -1) = -1 EINVAL (Invalid argument)
|
||||
setsockopt(3, SOL_NETLINK, NETLINK_LISTEN_ALL_NSID, 0x7fa18a802ffc, 3) = 0
|
||||
setsockopt(3, SOL_NETLINK, NETLINK_LISTEN_ALL_NSID, 0x7fa18a803000, 4) = -1 EFAULT (Bad address)
|
||||
-getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [0], [8]) = 0
|
||||
+getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [0], [4 => 8]) = 0
|
||||
getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [0], [5 => 8]) = 0
|
||||
getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, NULL, [0 => 8]) = 0
|
||||
getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [], [3 => 8]) = 0
|
||||
-getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, 0x7fa18a803000, [8]) = -1 EFAULT (Bad address)
|
||||
+getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, 0x7fa18a803000, [4]) = -1 EFAULT (Bad address)
|
||||
getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, 0x7fa18a802ffc, 0x7fa18a7fd000) = -1 EFAULT (Bad address)
|
||||
setsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [233811181], 4) = -1 ENOPROTOOPT (Protocol not available)
|
||||
setsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [233811181], 5) = -1 ENOPROTOOPT (Protocol not available)
|
||||
|
||||
|
||||
|
||||
Index: strace-6.3/tests/sockopt-sol_netlink.gen.test
|
||||
===================================================================
|
||||
--- strace-6.3.orig/tests/sockopt-sol_netlink.gen.test
|
||||
+++ strace-6.3/tests/sockopt-sol_netlink.gen.test
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh -efu
|
||||
# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sockopt-sol_netlink -e trace=getsockopt,setsockopt); do not edit.
|
||||
. "${srcdir=.}/init.sh"
|
||||
+skip_ "Test failing after system upgrades, wait for upstream fixes"
|
||||
run_strace_match_diff -e trace=getsockopt,setsockopt
|
||||
@@ -13,7 +13,8 @@ SRC_URI = "https://strace.io/files/${PV}/strace-${PV}.tar.xz \
|
||||
file://0001-strace-fix-reproducibilty-issues.patch \
|
||||
file://skip-load.patch \
|
||||
file://0001-landlock-update-expected-string.patch \
|
||||
file://skip-sockopt-test.patch \
|
||||
file://f31c2f4494779e5c5f170ad10539bfc2dfafe967.patch \
|
||||
file://3bbfb541b258baec9eba674b5d8dc30007a61542.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "dc7db230ff3e57c249830ba94acab2b862da1fcaac55417e9b85041a833ca285"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user