diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-06-27 10:10:26 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-06-28 23:02:50 +0100 |
| commit | f873b210f1f759a82a774694b04a44642a2abd92 (patch) | |
| tree | ce55aa935d2695cf4461ddb894db1ca6309f3bc0 | |
| parent | 356d2369c743634856d4b514166433947961a60d (diff) | |
| download | poky-f873b210f1f759a82a774694b04a44642a2abd92.tar.gz | |
strace: Update patches/tests with upstream fixes
Replace the sockopt disable patch with a fix from upstream. Also add a
patch to handle accept/accept4 differences when using glibc optimisations
for platforms where socketcall is used instead of an accept syscall such
as 32 bit x86.
(From OE-Core rev: ac921989991c319ecad01bec37c4ccaa15a7b58f)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
5 files changed, 406 insertions, 38 deletions
diff --git a/meta/recipes-devtools/strace/strace/00ace1392f5bd289239b755458dcdeeed69af1da.patch b/meta/recipes-devtools/strace/strace/00ace1392f5bd289239b755458dcdeeed69af1da.patch new file mode 100644 index 0000000000..bdf815e55e --- /dev/null +++ b/meta/recipes-devtools/strace/strace/00ace1392f5bd289239b755458dcdeeed69af1da.patch | |||
| @@ -0,0 +1,303 @@ | |||
| 1 | From 00ace1392f5bd289239b755458dcdeeed69af1da Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Dmitry V. Levin" <ldv@strace.io> | ||
| 3 | Date: Mon, 26 Jun 2023 10:00:00 +0000 | ||
| 4 | Subject: [PATCH] tests: avoid accept() libc function when tracing accept() | ||
| 5 | syscall | ||
| 6 | |||
| 7 | The libc function is allowed to implement accept() using accept4() | ||
| 8 | syscall, so migrate to accept4() those tests that trace accept() syscall | ||
| 9 | but do not test accept() specifically, and change the test of accept() | ||
| 10 | syscall to invoke either __NR_accept or __NR_socketcall(SYS_ACCEPT) | ||
| 11 | directly. | ||
| 12 | |||
| 13 | * tests/accept_compat.h: Remove. | ||
| 14 | * tests/Makefile.am (EXTRA_DIST): Remove accept_compat.h. | ||
| 15 | * tests/accept.c [TEST_SYSCALL_NAME]: Do not invoke accept(), | ||
| 16 | call __NR_accept or __NR_socketcall if available, or skip the test. | ||
| 17 | * tests/net-y-unix.c: Do not include "accept_compat.h". | ||
| 18 | (main): Invoke accept4() instead of accept(). | ||
| 19 | * tests/net-yy-inet.c: Likewise. | ||
| 20 | * tests/net-yy-unix.c: Likewise. | ||
| 21 | |||
| 22 | Resolves: https://github.com/strace/strace/issues/260 | ||
| 23 | |||
| 24 | Upstream-Status: Backport | ||
| 25 | --- | ||
| 26 | tests/Makefile.am | 1 - | ||
| 27 | tests/accept.c | 36 ++++++++++++++++++++---------------- | ||
| 28 | tests/accept_compat.h | 32 -------------------------------- | ||
| 29 | tests/net-y-unix.c | 16 ++++++++-------- | ||
| 30 | tests/net-yy-inet.c | 12 ++++++------ | ||
| 31 | tests/net-yy-unix.c | 16 ++++++++-------- | ||
| 32 | 6 files changed, 42 insertions(+), 71 deletions(-) | ||
| 33 | delete mode 100644 tests/accept_compat.h | ||
| 34 | |||
| 35 | Index: strace-6.3/tests/Makefile.am | ||
| 36 | =================================================================== | ||
| 37 | --- strace-6.3.orig/tests/Makefile.am | ||
| 38 | +++ strace-6.3/tests/Makefile.am | ||
| 39 | @@ -776,7 +776,6 @@ check_DATA = \ | ||
| 40 | # end of check_DATA | ||
| 41 | |||
| 42 | EXTRA_DIST = \ | ||
| 43 | - accept_compat.h \ | ||
| 44 | attach-p-cmd.h \ | ||
| 45 | clock_adjtime-common.c \ | ||
| 46 | clock_xettime-common.c \ | ||
| 47 | Index: strace-6.3/tests/accept.c | ||
| 48 | =================================================================== | ||
| 49 | --- strace-6.3.orig/tests/accept.c | ||
| 50 | +++ strace-6.3/tests/accept.c | ||
| 51 | @@ -9,38 +9,36 @@ | ||
| 52 | */ | ||
| 53 | |||
| 54 | #include "tests.h" | ||
| 55 | - | ||
| 56 | +#include "scno.h" | ||
| 57 | #include <unistd.h> | ||
| 58 | |||
| 59 | -#include "scno.h" | ||
| 60 | +#ifndef TEST_SYSCALL_NAME | ||
| 61 | |||
| 62 | -#if defined __NR_accept | ||
| 63 | +# if defined __NR_accept || defined __NR_socketcall | ||
| 64 | |||
| 65 | -# ifndef TEST_SYSCALL_NAME | ||
| 66 | # define TEST_SYSCALL_NAME do_accept | ||
| 67 | - | ||
| 68 | -# ifndef TEST_SYSCALL_STR | ||
| 69 | -# define TEST_SYSCALL_STR "accept" | ||
| 70 | -# endif | ||
| 71 | +# define TEST_SYSCALL_STR "accept" | ||
| 72 | |||
| 73 | static int | ||
| 74 | do_accept(int sockfd, void *addr, void *addrlen) | ||
| 75 | { | ||
| 76 | +# ifdef __NR_accept | ||
| 77 | return syscall(__NR_accept, sockfd, addr, addrlen); | ||
| 78 | +# else /* __NR_socketcall */ | ||
| 79 | + const long args[] = { sockfd, (long) addr, (long) addrlen }; | ||
| 80 | + return syscall(__NR_socketcall, 5, args); | ||
| 81 | +# endif | ||
| 82 | } | ||
| 83 | -# endif /* !TEST_SYSCALL_NAME */ | ||
| 84 | |||
| 85 | -#else /* !__NR_accept */ | ||
| 86 | +# endif /* __NR_accept || __NR_socketcall */ | ||
| 87 | |||
| 88 | -# ifndef TEST_SYSCALL_NAME | ||
| 89 | -# define TEST_SYSCALL_NAME accept | ||
| 90 | -# endif | ||
| 91 | +#endif /* !TEST_SYSCALL_NAME */ | ||
| 92 | |||
| 93 | -#endif /* __NR_accept */ | ||
| 94 | +#ifdef TEST_SYSCALL_NAME | ||
| 95 | |||
| 96 | -#define TEST_SYSCALL_PREPARE connect_un() | ||
| 97 | +# define TEST_SYSCALL_PREPARE connect_un() | ||
| 98 | static void connect_un(void); | ||
| 99 | -#include "sockname.c" | ||
| 100 | +# include "sockname.c" | ||
| 101 | |||
| 102 | static void | ||
| 103 | connect_un(void) | ||
| 104 | @@ -90,3 +88,9 @@ main(void) | ||
| 105 | puts("+++ exited with 0 +++"); | ||
| 106 | return 0; | ||
| 107 | } | ||
| 108 | + | ||
| 109 | +#else | ||
| 110 | + | ||
| 111 | +SKIP_MAIN_UNDEFINED("__NR_accept || __NR_socketcall") | ||
| 112 | + | ||
| 113 | +#endif | ||
| 114 | Index: strace-6.3/tests/accept_compat.h | ||
| 115 | =================================================================== | ||
| 116 | --- strace-6.3.orig/tests/accept_compat.h | ||
| 117 | +++ /dev/null | ||
| 118 | @@ -1,32 +0,0 @@ | ||
| 119 | -/* | ||
| 120 | - * Copyright (c) 2018-2019 The strace developers. | ||
| 121 | - * All rights reserved. | ||
| 122 | - * | ||
| 123 | - * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 124 | - */ | ||
| 125 | - | ||
| 126 | -#ifndef _STRACE_TESTS_ACCEPT_COMPAT_H_ | ||
| 127 | -# define _STRACE_TESTS_ACCEPT_COMPAT_H_ | ||
| 128 | - | ||
| 129 | -# include <unistd.h> | ||
| 130 | -# include <sys/socket.h> | ||
| 131 | -# include "scno.h" | ||
| 132 | - | ||
| 133 | -# if defined __NR_socketcall && defined __sparc__ | ||
| 134 | -/* | ||
| 135 | - * Work around the fact that | ||
| 136 | - * - glibc >= 2.26 uses accept4 syscall to implement accept() call on sparc; | ||
| 137 | - * - accept syscall had not been wired up on sparc until v4.4-rc8~4^2~1. | ||
| 138 | - */ | ||
| 139 | -static inline int | ||
| 140 | -do_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) | ||
| 141 | -{ | ||
| 142 | - const long args[] = { sockfd, (long) addr, (long) addrlen }; | ||
| 143 | - | ||
| 144 | - return syscall(__NR_socketcall, 5, args); | ||
| 145 | -} | ||
| 146 | -# else | ||
| 147 | -# define do_accept accept | ||
| 148 | -# endif | ||
| 149 | - | ||
| 150 | -#endif /* !_STRACE_TESTS_ACCEPT_COMPAT_H_ */ | ||
| 151 | Index: strace-6.3/tests/net-y-unix.c | ||
| 152 | =================================================================== | ||
| 153 | --- strace-6.3.orig/tests/net-y-unix.c | ||
| 154 | +++ strace-6.3/tests/net-y-unix.c | ||
| 155 | @@ -10,6 +10,7 @@ | ||
| 156 | |||
| 157 | #include "tests.h" | ||
| 158 | #include <assert.h> | ||
| 159 | +#include <fcntl.h> | ||
| 160 | #include <stddef.h> | ||
| 161 | #include <stdio.h> | ||
| 162 | #include <stdlib.h> | ||
| 163 | @@ -18,8 +19,6 @@ | ||
| 164 | #include <sys/socket.h> | ||
| 165 | #include <sys/un.h> | ||
| 166 | |||
| 167 | -#include "accept_compat.h" | ||
| 168 | - | ||
| 169 | #define TEST_SOCKET "net-y-unix.socket" | ||
| 170 | |||
| 171 | int | ||
| 172 | @@ -88,12 +87,12 @@ main(void) | ||
| 173 | struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); | ||
| 174 | memset(accept_sa, 0, sizeof(addr)); | ||
| 175 | *len = sizeof(addr); | ||
| 176 | - int accept_fd = do_accept(listen_fd, accept_sa, len); | ||
| 177 | + int accept_fd = accept4(listen_fd, accept_sa, len, O_CLOEXEC); | ||
| 178 | if (accept_fd < 0) | ||
| 179 | perror_msg_and_fail("accept"); | ||
| 180 | unsigned long accept_inode = inode_of_sockfd(accept_fd); | ||
| 181 | - printf("accept(%d<socket:[%lu]>, {sa_family=AF_UNIX}" | ||
| 182 | - ", [%d => %d]) = %d<socket:[%lu]>\n", | ||
| 183 | + printf("accept4(%d<socket:[%lu]>, {sa_family=AF_UNIX}" | ||
| 184 | + ", [%d => %d], SOCK_CLOEXEC) = %d<socket:[%lu]>\n", | ||
| 185 | listen_fd, listen_inode, | ||
| 186 | (int) sizeof(addr), (int) *len, | ||
| 187 | accept_fd, accept_inode); | ||
| 188 | @@ -160,14 +159,15 @@ main(void) | ||
| 189 | |||
| 190 | memset(accept_sa, 0, sizeof(addr)); | ||
| 191 | *len = sizeof(addr); | ||
| 192 | - accept_fd = do_accept(listen_fd, accept_sa, len); | ||
| 193 | + accept_fd = accept4(listen_fd, accept_sa, len, O_CLOEXEC); | ||
| 194 | if (accept_fd < 0) | ||
| 195 | perror_msg_and_fail("accept"); | ||
| 196 | accept_inode = inode_of_sockfd(accept_fd); | ||
| 197 | const char * const sun_path1 = | ||
| 198 | ((struct sockaddr_un *) accept_sa)->sun_path + 1; | ||
| 199 | - printf("accept(%d<socket:[%lu]>, {sa_family=AF_UNIX" | ||
| 200 | - ", sun_path=@\"%s\"}, [%d => %d]) = %d<socket:[%lu]>\n", | ||
| 201 | + printf("accept4(%d<socket:[%lu]>, {sa_family=AF_UNIX" | ||
| 202 | + ", sun_path=@\"%s\"}, [%d => %d], SOCK_CLOEXEC)" | ||
| 203 | + " = %d<socket:[%lu]>\n", | ||
| 204 | listen_fd, listen_inode, sun_path1, | ||
| 205 | (int) sizeof(addr), (int) *len, | ||
| 206 | accept_fd, accept_inode); | ||
| 207 | Index: strace-6.3/tests/net-yy-inet.c | ||
| 208 | =================================================================== | ||
| 209 | --- strace-6.3.orig/tests/net-yy-inet.c | ||
| 210 | +++ strace-6.3/tests/net-yy-inet.c | ||
| 211 | @@ -10,6 +10,7 @@ | ||
| 212 | |||
| 213 | #include "tests.h" | ||
| 214 | #include <assert.h> | ||
| 215 | +#include <fcntl.h> | ||
| 216 | #include <stddef.h> | ||
| 217 | #include <stdio.h> | ||
| 218 | #include <string.h> | ||
| 219 | @@ -19,8 +20,6 @@ | ||
| 220 | #include <netinet/tcp.h> | ||
| 221 | #include <arpa/inet.h> | ||
| 222 | |||
| 223 | -#include "accept_compat.h" | ||
| 224 | - | ||
| 225 | #ifndef ADDR_FAMILY | ||
| 226 | # define ADDR_FAMILY_FIELD sin_family | ||
| 227 | # define ADDR_FAMILY AF_INET | ||
| 228 | @@ -104,14 +103,15 @@ main(void) | ||
| 229 | struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); | ||
| 230 | memset(accept_sa, 0, sizeof(addr)); | ||
| 231 | *len = sizeof(addr); | ||
| 232 | - const int accept_fd = do_accept(listen_fd, accept_sa, len); | ||
| 233 | + const int accept_fd = accept4(listen_fd, accept_sa, len, O_CLOEXEC); | ||
| 234 | if (accept_fd < 0) | ||
| 235 | perror_msg_and_fail("accept"); | ||
| 236 | const unsigned int connect_port = | ||
| 237 | ntohs(((struct SOCKADDR_TYPE *) accept_sa)->INPORT); | ||
| 238 | - printf("accept(%d<" TCP_STR ":[" LOOPBACK ":%u]>, {sa_family=" AF_STR | ||
| 239 | - ", " INPORT_STR "=htons(%u), " INADDR_STR SA_FIELDS "}" | ||
| 240 | - ", [%u]) = %d<" TCP_STR ":[" LOOPBACK ":%u->" LOOPBACK ":%u]>\n", | ||
| 241 | + printf("accept4(%d<" TCP_STR ":[" LOOPBACK ":%u]>, {sa_family=" AF_STR | ||
| 242 | + ", " INPORT_STR "=htons(%u), " INADDR_STR SA_FIELDS "}, [%u]" | ||
| 243 | + ", SOCK_CLOEXEC) = %d<" TCP_STR ":[" LOOPBACK ":%u->" LOOPBACK | ||
| 244 | + ":%u]>\n", | ||
| 245 | listen_fd, listen_port, connect_port, (unsigned) *len, | ||
| 246 | accept_fd, listen_port, connect_port); | ||
| 247 | |||
| 248 | Index: strace-6.3/tests/net-yy-unix.c | ||
| 249 | =================================================================== | ||
| 250 | --- strace-6.3.orig/tests/net-yy-unix.c | ||
| 251 | +++ strace-6.3/tests/net-yy-unix.c | ||
| 252 | @@ -10,6 +10,7 @@ | ||
| 253 | |||
| 254 | #include "tests.h" | ||
| 255 | #include <assert.h> | ||
| 256 | +#include <fcntl.h> | ||
| 257 | #include <stddef.h> | ||
| 258 | #include <stdio.h> | ||
| 259 | #include <stdlib.h> | ||
| 260 | @@ -22,8 +23,6 @@ | ||
| 261 | # include "xmalloc.h" | ||
| 262 | #endif | ||
| 263 | |||
| 264 | -#include "accept_compat.h" | ||
| 265 | - | ||
| 266 | #define TEST_SOCKET "net-yy-unix.socket" | ||
| 267 | |||
| 268 | int | ||
| 269 | @@ -112,12 +111,12 @@ main(void) | ||
| 270 | struct sockaddr * const accept_sa = tail_alloc(sizeof(addr)); | ||
| 271 | memset(accept_sa, 0, sizeof(addr)); | ||
| 272 | *len = sizeof(addr); | ||
| 273 | - int accept_fd = do_accept(listen_fd, accept_sa, len); | ||
| 274 | + int accept_fd = accept4(listen_fd, accept_sa, len, O_CLOEXEC); | ||
| 275 | if (accept_fd < 0) | ||
| 276 | perror_msg_and_fail("accept"); | ||
| 277 | unsigned long accept_inode = inode_of_sockfd(accept_fd); | ||
| 278 | - printf("accept(%d<%s:[%lu,\"%s\"]>, {sa_family=AF_UNIX}" | ||
| 279 | - ", [%d => %d]) = %d<%s:[%lu->%lu,\"%s\"]>\n", | ||
| 280 | + printf("accept4(%d<%s:[%lu,\"%s\"]>, {sa_family=AF_UNIX}" | ||
| 281 | + ", [%d => %d], SOCK_CLOEXEC) = %d<%s:[%lu->%lu,\"%s\"]>\n", | ||
| 282 | listen_fd, sock_proto_name, listen_inode, TEST_SOCKET, | ||
| 283 | (int) sizeof(addr), (int) *len, | ||
| 284 | accept_fd, sock_proto_name, accept_inode, connect_inode, | ||
| 285 | @@ -191,14 +190,15 @@ main(void) | ||
| 286 | |||
| 287 | memset(accept_sa, 0, sizeof(addr)); | ||
| 288 | *len = sizeof(addr); | ||
| 289 | - accept_fd = do_accept(listen_fd, accept_sa, len); | ||
| 290 | + accept_fd = accept4(listen_fd, accept_sa, len, O_CLOEXEC); | ||
| 291 | if (accept_fd < 0) | ||
| 292 | perror_msg_and_fail("accept"); | ||
| 293 | accept_inode = inode_of_sockfd(accept_fd); | ||
| 294 | const char * const sun_path1 = | ||
| 295 | ((struct sockaddr_un *) accept_sa)->sun_path + 1; | ||
| 296 | - printf("accept(%d<%s:[%lu,\"%s\"]>, {sa_family=AF_UNIX" | ||
| 297 | - ", sun_path=@\"%s\"}, [%d => %d]) = %d<%s:[%lu->%lu,\"%s\"]>\n", | ||
| 298 | + printf("accept4(%d<%s:[%lu,\"%s\"]>, {sa_family=AF_UNIX" | ||
| 299 | + ", sun_path=@\"%s\"}, [%d => %d], SOCK_CLOEXEC)" | ||
| 300 | + " = %d<%s:[%lu->%lu,\"%s\"]>\n", | ||
| 301 | listen_fd, sock_proto_name, listen_inode, TEST_SOCKET, | ||
| 302 | sun_path1, (int) sizeof(addr), (int) *len, | ||
| 303 | accept_fd, sock_proto_name, accept_inode, connect_inode, | ||
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_6.3.bb b/meta/recipes-devtools/strace/strace_6.3.bb index 7ba9fcc468..a47cc71724 100644 --- a/meta/recipes-devtools/strace/strace_6.3.bb +++ b/meta/recipes-devtools/strace/strace_6.3.bb | |||
| @@ -14,7 +14,9 @@ SRC_URI = "https://strace.io/files/${PV}/strace-${PV}.tar.xz \ | |||
| 14 | file://skip-load.patch \ | 14 | file://skip-load.patch \ |
| 15 | file://0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch \ | 15 | file://0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch \ |
| 16 | file://0002-tests-Replace-off64_t-with-off_t.patch \ | 16 | file://0002-tests-Replace-off64_t-with-off_t.patch \ |
| 17 | file://skip-sockopt-test.patch \ | 17 | file://00ace1392f5bd289239b755458dcdeeed69af1da.patch \ |
| 18 | file://f31c2f4494779e5c5f170ad10539bfc2dfafe967.patch \ | ||
| 19 | file://3bbfb541b258baec9eba674b5d8dc30007a61542.patch \ | ||
| 18 | " | 20 | " |
| 19 | SRC_URI[sha256sum] = "e17878e301506c1cc301611118ad14efee7f8bcef63b27ace5d290acce7bb731" | 21 | SRC_URI[sha256sum] = "e17878e301506c1cc301611118ad14efee7f8bcef63b27ace5d290acce7bb731" |
| 20 | 22 | ||
