diff options
4 files changed, 102 insertions, 38 deletions
diff --git a/meta/recipes-devtools/strace/strace/3bbfb541b258baec9eba674b5d8dc30007a61542.patch b/meta/recipes-devtools/strace/strace/3bbfb541b258baec9eba674b5d8dc30007a61542.patch new file mode 100644 index 0000000000..b4c6ff99de --- /dev/null +++ b/meta/recipes-devtools/strace/strace/3bbfb541b258baec9eba674b5d8dc30007a61542.patch | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | From 3bbfb541b258baec9eba674b5d8dc30007a61542 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Dmitry V. Levin" <ldv@strace.io> | ||
| 3 | Date: Wed, 21 Jun 2023 08:00:00 +0000 | ||
| 4 | Subject: [PATCH] net: enhance getsockopt decoding | ||
| 5 | |||
| 6 | When getsockopt syscall fails the kernel sometimes updates the optlen | ||
| 7 | argument, for example, NETLINK_LIST_MEMBERSHIPS updates it even if | ||
| 8 | optval is not writable. | ||
| 9 | |||
| 10 | * src/net.c (SYS_FUNC(getsockopt)): Try to fetch and print optlen | ||
| 11 | argument on exiting syscall regardless of getsockopt exit status. | ||
| 12 | |||
| 13 | Upstream-Status: Backport | ||
| 14 | --- | ||
| 15 | src/net.c | 15 ++++++++++++++- | ||
| 16 | 1 file changed, 14 insertions(+), 1 deletion(-) | ||
| 17 | |||
| 18 | diff --git a/src/net.c b/src/net.c | ||
| 19 | index f68ccb947..7244b5e57 100644 | ||
| 20 | --- a/src/net.c | ||
| 21 | +++ b/src/net.c | ||
| 22 | @@ -1038,7 +1038,7 @@ SYS_FUNC(getsockopt) | ||
| 23 | } else { | ||
| 24 | ulen = get_tcb_priv_ulong(tcp); | ||
| 25 | |||
| 26 | - if (syserror(tcp) || umove(tcp, tcp->u_arg[4], &rlen) < 0) { | ||
| 27 | + if (umove(tcp, tcp->u_arg[4], &rlen) < 0) { | ||
| 28 | /* optval */ | ||
| 29 | printaddr(tcp->u_arg[3]); | ||
| 30 | tprint_arg_next(); | ||
| 31 | @@ -1047,6 +1047,19 @@ SYS_FUNC(getsockopt) | ||
| 32 | tprint_indirect_begin(); | ||
| 33 | PRINT_VAL_D(ulen); | ||
| 34 | tprint_indirect_end(); | ||
| 35 | + } else if (syserror(tcp)) { | ||
| 36 | + /* optval */ | ||
| 37 | + printaddr(tcp->u_arg[3]); | ||
| 38 | + tprint_arg_next(); | ||
| 39 | + | ||
| 40 | + /* optlen */ | ||
| 41 | + tprint_indirect_begin(); | ||
| 42 | + if (ulen != rlen) { | ||
| 43 | + PRINT_VAL_D(ulen); | ||
| 44 | + tprint_value_changed(); | ||
| 45 | + } | ||
| 46 | + PRINT_VAL_D(rlen); | ||
| 47 | + tprint_indirect_end(); | ||
| 48 | } else { | ||
| 49 | /* optval */ | ||
| 50 | print_getsockopt(tcp, tcp->u_arg[1], tcp->u_arg[2], | ||
diff --git a/meta/recipes-devtools/strace/strace/f31c2f4494779e5c5f170ad10539bfc2dfafe967.patch b/meta/recipes-devtools/strace/strace/f31c2f4494779e5c5f170ad10539bfc2dfafe967.patch new file mode 100644 index 0000000000..a0843836c2 --- /dev/null +++ b/meta/recipes-devtools/strace/strace/f31c2f4494779e5c5f170ad10539bfc2dfafe967.patch | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | From f31c2f4494779e5c5f170ad10539bfc2dfafe967 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Dmitry V. Levin" <ldv@strace.io> | ||
| 3 | Date: Sat, 24 Jun 2023 08:00:00 +0000 | ||
| 4 | Subject: [PATCH] tests: update sockopt-sol_netlink test | ||
| 5 | |||
| 6 | Update sockopt-sol_netlink test that started to fail, likely | ||
| 7 | due to recent linux kernel commit f4e4534850a9 ("net/netlink: fix | ||
| 8 | NETLINK_LIST_MEMBERSHIPS length report"). | ||
| 9 | |||
| 10 | * tests/sockopt-sol_netlink.c (main): Always print changing optlen value | ||
| 11 | on exiting syscall. | ||
| 12 | |||
| 13 | Reported-by: Alexander Gordeev <agordeev@linux.ibm.com> | ||
| 14 | --- | ||
| 15 | tests/sockopt-sol_netlink.c | 13 ++++++++++--- | ||
| 16 | 1 file changed, 10 insertions(+), 3 deletions(-) | ||
| 17 | |||
| 18 | Upstream-Status: Backport | ||
| 19 | |||
| 20 | diff --git a/tests/sockopt-sol_netlink.c b/tests/sockopt-sol_netlink.c | ||
| 21 | index 82b98adc23..1c33219ac5 100644 | ||
| 22 | --- a/tests/sockopt-sol_netlink.c | ||
| 23 | +++ b/tests/sockopt-sol_netlink.c | ||
| 24 | @@ -94,7 +94,10 @@ main(void) | ||
| 25 | printf("%p", val); | ||
| 26 | else | ||
| 27 | printf("[%d]", *val); | ||
| 28 | - printf(", [%d]) = %s\n", *len, errstr); | ||
| 29 | + printf(", [%d", (int) sizeof(*val)); | ||
| 30 | + if ((int) sizeof(*val) != *len) | ||
| 31 | + printf(" => %d", *len); | ||
| 32 | + printf("]) = %s\n", errstr); | ||
| 33 | |||
| 34 | /* optlen larger than necessary - shortened */ | ||
| 35 | *len = sizeof(*val) + 1; | ||
| 36 | @@ -150,8 +153,12 @@ main(void) | ||
| 37 | /* optval EFAULT - print address */ | ||
| 38 | *len = sizeof(*val); | ||
| 39 | get_sockopt(fd, names[i].val, efault, len); | ||
| 40 | - printf("getsockopt(%d, SOL_NETLINK, %s, %p, [%d]) = %s\n", | ||
| 41 | - fd, names[i].str, efault, *len, errstr); | ||
| 42 | + printf("getsockopt(%d, SOL_NETLINK, %s, %p", | ||
| 43 | + fd, names[i].str, efault); | ||
| 44 | + printf(", [%d", (int) sizeof(*val)); | ||
| 45 | + if ((int) sizeof(*val) != *len) | ||
| 46 | + printf(" => %d", *len); | ||
| 47 | + printf("]) = %s\n", errstr); | ||
| 48 | |||
| 49 | /* optlen EFAULT - print address */ | ||
| 50 | get_sockopt(fd, names[i].val, val, len + 1); | ||
diff --git a/meta/recipes-devtools/strace/strace/skip-sockopt-test.patch b/meta/recipes-devtools/strace/strace/skip-sockopt-test.patch deleted file mode 100644 index 5741bf8672..0000000000 --- a/meta/recipes-devtools/strace/strace/skip-sockopt-test.patch +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | Upstream-Status: Inappropriate [avoid this test until fixed by upstream] | ||
| 2 | |||
| 3 | Reported at https://github.com/strace/strace/issues/257 | ||
| 4 | |||
| 5 | root@qemux86-64:/usr/lib/strace/ptest/tests# make sockopt-sol_netlink.gen.log | ||
| 6 | FAIL: sockopt-sol_netlink.gen.test | ||
| 7 | |||
| 8 | #root@qemux86-64:/usr/lib/strace/ptest/tests# diff sockopt-sol_netlink.dir/exp sockopt-sol_netlink.dir/out | ||
| 9 | #--- sockopt-sol_netlink.dir/exp | ||
| 10 | #+++ sockopt-sol_netlink.dir/out | ||
| 11 | #@@ -86,11 +86,11 @@ | ||
| 12 | setsockopt(3, SOL_NETLINK, NETLINK_LISTEN_ALL_NSID, 0x7fa18a802ffc, -1) = -1 EINVAL (Invalid argument) | ||
| 13 | setsockopt(3, SOL_NETLINK, NETLINK_LISTEN_ALL_NSID, 0x7fa18a802ffc, 3) = 0 | ||
| 14 | setsockopt(3, SOL_NETLINK, NETLINK_LISTEN_ALL_NSID, 0x7fa18a803000, 4) = -1 EFAULT (Bad address) | ||
| 15 | -getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [0], [8]) = 0 | ||
| 16 | +getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [0], [4 => 8]) = 0 | ||
| 17 | getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [0], [5 => 8]) = 0 | ||
| 18 | getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, NULL, [0 => 8]) = 0 | ||
| 19 | getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [], [3 => 8]) = 0 | ||
| 20 | -getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, 0x7fa18a803000, [8]) = -1 EFAULT (Bad address) | ||
| 21 | +getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, 0x7fa18a803000, [4]) = -1 EFAULT (Bad address) | ||
| 22 | getsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, 0x7fa18a802ffc, 0x7fa18a7fd000) = -1 EFAULT (Bad address) | ||
| 23 | setsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [233811181], 4) = -1 ENOPROTOOPT (Protocol not available) | ||
| 24 | setsockopt(3, SOL_NETLINK, NETLINK_LIST_MEMBERSHIPS, [233811181], 5) = -1 ENOPROTOOPT (Protocol not available) | ||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | Index: strace-6.3/tests/sockopt-sol_netlink.gen.test | ||
| 29 | =================================================================== | ||
| 30 | --- strace-6.3.orig/tests/sockopt-sol_netlink.gen.test | ||
| 31 | +++ strace-6.3/tests/sockopt-sol_netlink.gen.test | ||
| 32 | @@ -1,4 +1,5 @@ | ||
| 33 | #!/bin/sh -efu | ||
| 34 | # Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (sockopt-sol_netlink -e trace=getsockopt,setsockopt); do not edit. | ||
| 35 | . "${srcdir=.}/init.sh" | ||
| 36 | +skip_ "Test failing after system upgrades, wait for upstream fixes" | ||
| 37 | run_strace_match_diff -e trace=getsockopt,setsockopt | ||
diff --git a/meta/recipes-devtools/strace/strace_5.16.bb b/meta/recipes-devtools/strace/strace_5.16.bb index d97a1260d1..39082a5bc7 100644 --- a/meta/recipes-devtools/strace/strace_5.16.bb +++ b/meta/recipes-devtools/strace/strace_5.16.bb | |||
| @@ -13,7 +13,8 @@ SRC_URI = "https://strace.io/files/${PV}/strace-${PV}.tar.xz \ | |||
| 13 | file://0001-strace-fix-reproducibilty-issues.patch \ | 13 | file://0001-strace-fix-reproducibilty-issues.patch \ |
| 14 | file://skip-load.patch \ | 14 | file://skip-load.patch \ |
| 15 | file://0001-landlock-update-expected-string.patch \ | 15 | file://0001-landlock-update-expected-string.patch \ |
| 16 | file://skip-sockopt-test.patch \ | 16 | file://f31c2f4494779e5c5f170ad10539bfc2dfafe967.patch \ |
| 17 | file://3bbfb541b258baec9eba674b5d8dc30007a61542.patch \ | ||
| 17 | " | 18 | " |
| 18 | SRC_URI[sha256sum] = "dc7db230ff3e57c249830ba94acab2b862da1fcaac55417e9b85041a833ca285" | 19 | SRC_URI[sha256sum] = "dc7db230ff3e57c249830ba94acab2b862da1fcaac55417e9b85041a833ca285" |
| 19 | 20 | ||
