linux-user: strace improvements
v6 cover linux-user: strace improvements
Hi Laurent,
Few patches I'v been writting while trying to figure out this issue:
http://lists.nongnu.org/archive/html/qemu-arm/2018-01/msg00514.html
As usual with linux-user files, this series will trigger some checkpatch benign warnings.
Regards,
Phil.
Since v5:
- dropped 'Verify recvfrom(addr)' since failing LTP testsuite (see [1])
- also define print_sockfd() for bind() (patches #6 and #7)
Since v4:
- rebased on master (no change)
Since v3:
- addressed Laurent comments
- added print_sockfd()
- removed the print_sockaddr_ptr() patch, also the two getsockname()/recvfrom() patches for after 3.0.
Since v2:
- display invalid pointer in print_timeval() and print_timezone()
- do not display gettimeofday() arguments
Since v1:
- addressed Laurent comments
- added 'last' argument to print_sockaddr()
- reordered series, so patches already correct can get applied directly
- dropped "linux-user/syscall: simplify recvfrom()" for now
v1: http://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg05855.html
v2: http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg08216.html
v3: http://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg00411.html
v5: https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg02067.html
[1] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg02807.html
Philippe Mathieu-Daudé (8):
linux-user/strace: Display invalid pointer in print_timeval() linux-user/strace: Add print_timezone() linux-user/strace: Improve settimeofday() linux-user/syscall: Introduce target_sockaddr_nl linux-user/strace: Dump AF_NETLINK sockaddr content linux-user/strace: Add print_sockfd() linux-user/strace: Improve bind() output linux-user/strace: Let print_sockaddr() have a 'last' argument
linux-user/strace.c | 121 ++++++++++++++++++++++++++++++++++---- linux-user/strace.list | 4 +- linux-user/syscall.c | 6 +- linux-user/syscall_defs.h | 7 +++ 4 files changed, 121 insertions(+), 17 deletions(-)
Signature · 1 line
2.20.1
PATCH v6 1/8 linux-user/strace: Display invalid pointer in print_timeval()
--- linux-user/strace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
linux-user/strace.c +3 -1
@@ -1243,8 +1243,10 @@ print_timeval(abi_ulong tv_addr, int last)struct target_timeval *tv; tv =lock_user (VERIFY_READ , tv_addr,sizeof (*tv),1 ); -if (!tv) +if (!tv) { +print_pointer (tv_addr, last);return ; + }gemu_log ("{" TARGET_ABI_FMT_ld"," TARGET_ABI_FMT_ld"}%s" ,tswapal (tv->tv_sec),tswapal (tv->tv_usec),get_comma (last));unlock_user (tv, tv_addr,0 );
Signature · 1 line
2.20.1
PATCH v6 2/8 linux-user/strace: Add print_timezone()
In reply to Philippe Mathieu-Daudé---
checkpatch error:
ERROR: storage class should be at the beginning of the declaration
--- linux-user/strace.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
linux-user/strace.c +21 -0
@@ -63,6 +63,7 @@ UNUSED static void print_string(abi_long, int); UNUSED static void print_buf(abi_long addr, abi_long len, int last); UNUSED static void print_raw_param(const char *, abi_long, int); UNUSED static void print_timeval(abi_ulong, int); +UNUSED static void print_timezone(abi_ulong, int); UNUSED static void print_number(abi_long, int); UNUSED static void print_signal(abi_ulong, int); UNUSED static void print_sockaddr(abi_ulong addr, abi_long addrlen);
@@ -1254,6 +1255,26 @@ print_timeval(abi_ulong tv_addr, int last)gemu_log ("NULL%s" ,get_comma (last)); } +static void +print_timezone (abi_ulong tz_addr,int last) +{ +if (tz_addr) { +struct target_timezone *tz; + + tz =lock_user (VERIFY_READ , tz_addr,sizeof (*tz),1 ); +if (!tz) { +print_pointer (tz_addr, last); +return ; + } +gemu_log ("{" TARGET_ABI_FMT_ld"," TARGET_ABI_FMT_ld"}%s" , +tswapal (tz->tz_minuteswest),tswapal (tz->tz_dsttime), +get_comma (last)); +unlock_user (tz, tz_addr,0 ); + }else { +gemu_log ("NULL%s" ,get_comma (last)); + } +} +#undef UNUSED#ifdef TARGET_NR_accept
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v6 2/8] linux-user/strace: Add print_timezone()
Le 08/09/2019 à 08:15, Philippe Mathieu-Daudé a écrit :
Quoted 28 lines
Suggested-by Laurent Vivier <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
checkpatch error:
ERROR: storage class should be at the beginning of the declaration--- linux-user/strace.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)linux-user/strace.c +4
-0@@ -63,6 +63,7 @@ UNUSED static void print_string(abi_long, int); UNUSED static void print_buf(abi_long addr, abi_long len, int last); UNUSED static void print_raw_param(const char *, abi_long, int); UNUSED static void print_timeval(abi_ulong, int); +UNUSED static void print_timezone(abi_ulong, int); UNUSED static void print_number(abi_long, int); UNUSED static void print_signal(abi_ulong, int); UNUSED static void print_sockaddr(abi_ulong addr, abi_long addrlen);@@ -1254,6 +1255,26 @@ print_timeval(abi_ulong tv_addr, int last)gemu_log ("NULL%s" ,get_comma (last)); } +static void +print_timezone (abi_ulong tz_addr,int last) +{
linux-user/strace.c print_timeval(abi_ulong tv_addr, int last) · line 1270
Quoted 10 lines
linux-user/strace.c +10
-0+if (tz_addr) { +struct target_timezone *tz; + + tz =lock_user (VERIFY_READ , tz_addr,sizeof (*tz),1 ); +if (!tz) { +print_pointer (tz_addr, last); +return ; + } + gemu_log("{" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "}%s", + tswapal(tz->tz_minuteswest), tswapal(tz->tz_dsttime),
tz_minuteswest and tz_dsttime are abi_int, so it should be "%d" and tswap32().
Quoted 11 lines
linux-user/strace.c +7
-0+ get_comma(last)); +unlock_user (tz, tz_addr,0 ); + }else { +gemu_log ("NULL%s" ,get_comma (last)); + } +} +#undef UNUSED#ifdef TARGET_NR_accept
PATCH v6 3/8 linux-user/strace: Improve settimeofday()
In reply to Philippe Mathieu-Daudé--- linux-user/strace.c | 13 +++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-)
linux-user/strace.c +13 -0
@@ -1584,6 +1584,19 @@ print_futimesat(const struct syscallname *name, }#endif +#ifdef TARGET_NR_settimeofday +static void +print_settimeofday (const struct syscallname *name, +abi_long arg0,abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ +print_syscall_prologue (name); +print_timeval (arg0,0 ); +print_timezone (arg1,1 ); +print_syscall_epilogue (name); +} +#endif +#ifdef TARGET_NR_link static void print_link(const struct syscallname *name,
linux-user/strace.list +1 -1
@@ -1345,7 +1345,7 @@ { TARGET_NR_set_tid_address, "set_tid_address" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_settimeofday -{ TARGET_NR_settimeofday, "settimeofday" , NULL, NULL, NULL }, +{ TARGET_NR_settimeofday, "settimeofday" , NULL, print_settimeofday, NULL }, #endif #ifdef TARGET_NR_setuid { TARGET_NR_setuid, "setuid" , NULL, NULL, NULL },
Signature · 1 line
2.20.1
Laurent Vivier
AppliedRe: [Qemu-devel] [PATCH v6 3/8] linux-user/strace: Improve settimeofday()
Le 08/09/2019 à 08:15, Philippe Mathieu-Daudé a écrit :
Quoted 38 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Tested-by Guido Günther <[email protected]>Reviewed-by Laurent Vivier <[email protected]>--- linux-user/strace.c | 13 +++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-)linux-user/strace.c +13
-0@@ -1584,6 +1584,19 @@ print_futimesat(const struct syscallname *name, }#endif +#ifdef TARGET_NR_settimeofday +static void +print_settimeofday (const struct syscallname *name, +abi_long arg0,abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ +print_syscall_prologue (name); +print_timeval (arg0,0 ); +print_timezone (arg1,1 ); +print_syscall_epilogue (name); +} +#endif +#ifdef TARGET_NR_link static void print_link(const struct syscallname *name,linux-user/strace.list +0
-0
linux-user/strace.list line 1351
Quoted 8 lines
linux-user/strace.list +1
-1@@ -1345,7 +1345,7 @@ { TARGET_NR_set_tid_address, "set_tid_address" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_settimeofday -{ TARGET_NR_settimeofday, "settimeofday" , NULL, NULL, NULL }, +{ TARGET_NR_settimeofday, "settimeofday" , NULL, print_settimeofday, NULL }, #endif #ifdef TARGET_NR_setuid { TARGET_NR_setuid, "setuid" , NULL, NULL, NULL },
Applied to my linux-user branch.
Thanks,
Laurent
Re: [Qemu-devel] [PATCH v6 3/8] linux-user/strace: Improve settimeofday()
Le 10/09/2019 à 10:30, Laurent Vivier a écrit :
Quoted 41 lines
Le 08/09/2019 à 08:15, Philippe Mathieu-Daudé a écrit :
Quoted 40 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Tested-by Guido Günther <[email protected]>Reviewed-by Laurent Vivier <[email protected]>--- linux-user/strace.c | 13 +++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-)linux-user/strace.c +13
-0@@ -1584,6 +1584,19 @@ print_futimesat(const struct syscallname *name, }#endif +#ifdef TARGET_NR_settimeofday +static void +print_settimeofday (const struct syscallname *name, +abi_long arg0,abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ +print_syscall_prologue (name); +print_timeval (arg0,0 ); +print_timezone (arg1,1 ); +print_syscall_epilogue (name); +} +#endif +#ifdef TARGET_NR_link static void print_link(const struct syscallname *name,linux-user/strace.list +0
-0@@ -1345,7 +1345,7 @@ { TARGET_NR_set_tid_address, "set_tid_address" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_settimeofday
Quoted 8 lines
linux-user/strace.list line 1351
Quoted 6 lines
linux-user/strace.list +1
-1-{ TARGET_NR_settimeofday, "settimeofday" , NULL, NULL, NULL }, +{ TARGET_NR_settimeofday, "settimeofday" , NULL, print_settimeofday, NULL }, #endif #ifdef TARGET_NR_setuid { TARGET_NR_setuid, "setuid" , NULL, NULL, NULL },Applied to my linux-user branch.
Unapplied as it depends on the previous one.
Thanks,
Laurent
PATCH v6 4/8 linux-user/syscall: Introduce target_sockaddr_nl
In reply to Philippe Mathieu-Daudé--- linux-user/syscall.c | 6 ++++-- linux-user/syscall_defs.h | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-)
linux-user/syscall.c +4 -2
@@ -1494,8 +1494,10 @@ static inline abi_long host_to_target_sockaddr(abi_ulong target_addr, sizeof(target_saddr->sa_family)) { target_saddr->sa_family =tswap16 (addr->sa_family); } -if (addr->sa_family ==AF_NETLINK && len >=sizeof (struct sockaddr_nl )) { -struct sockaddr_nl *target_nl = (struct sockaddr_nl *)target_saddr; +if (addr->sa_family ==AF_NETLINK && + len >=sizeof (struct target_sockaddr_nl )) { +struct target_sockaddr_nl *target_nl = + (struct target_sockaddr_nl *)target_saddr; target_nl->nl_pid =tswap32 (target_nl->nl_pid); target_nl->nl_groups =tswap32 (target_nl->nl_groups); }else if (addr->sa_family ==AF_PACKET ) {
linux-user/syscall_defs.h +7 -0
@@ -153,6 +153,13 @@ struct target_sockaddr_un {uint8_t sun_path[108 ]; }; +struct target_sockaddr_nl { +uint16_t nl_family;/* AF_NETLINK */ +uint16_t __pad; +uint32_t nl_pid; +uint32_t nl_groups; +}; +struct target_in_addr {uint32_t s_addr;/* big endian */ };
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v6 4/8] linux-user/syscall: Introduce target_sockaddr_nl
Le 08/09/2019 à 08:15, Philippe Mathieu-Daudé a écrit :
Quoted 29 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Tested-by Guido Günther <[email protected]>--- linux-user/syscall.c | 6 ++++-- linux-user/syscall_defs.h | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-)linux-user/syscall.c +4
-2@@ -1494,8 +1494,10 @@ static inline abi_long host_to_target_sockaddr(abi_ulong target_addr, sizeof(target_saddr->sa_family)) { target_saddr->sa_family =tswap16 (addr->sa_family); } -if (addr->sa_family ==AF_NETLINK && len >=sizeof (struct sockaddr_nl )) { -struct sockaddr_nl *target_nl = (struct sockaddr_nl *)target_saddr; +if (addr->sa_family ==AF_NETLINK && + len >=sizeof (struct target_sockaddr_nl )) { +struct target_sockaddr_nl *target_nl = + (struct target_sockaddr_nl *)target_saddr; target_nl->nl_pid =tswap32 (target_nl->nl_pid); target_nl->nl_groups =tswap32 (target_nl->nl_groups); }else if (addr->sa_family ==AF_PACKET ) {linux-user/syscall_defs.h +0
-0
linux-user/syscall_defs.h struct target_sockaddr_un { · line 161
Quoted 9 lines
linux-user/syscall_defs.h +6
-0@@ -153,6 +153,13 @@ struct target_sockaddr_un {uint8_t sun_path[108 ]; }; +struct target_sockaddr_nl { +uint16_t nl_family;/* AF_NETLINK */ +uint16_t __pad; +uint32_t nl_pid; +uint32_t nl_groups; +};
You should use abi_ushort and abi_uint to keep alignments good (for instance m68k aligns on 16bit whereas others on 32bit).
Thanks,
Laurent
Re: [Qemu-devel] [PATCH v6 4/8] linux-user/syscall: Introduce target_sockaddr_nl
Quoted 33 lines · Laurent Vivier
Quoted 32 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Tested-by Guido Günther <[email protected]>--- linux-user/syscall.c | 6 ++++-- linux-user/syscall_defs.h | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-)linux-user/syscall.c +4
-2@@ -1494,8 +1494,10 @@ static inline abi_long host_to_target_sockaddr(abi_ulong target_addr, sizeof(target_saddr->sa_family)) { target_saddr->sa_family =tswap16 (addr->sa_family); } -if (addr->sa_family ==AF_NETLINK && len >=sizeof (struct sockaddr_nl )) { -struct sockaddr_nl *target_nl = (struct sockaddr_nl *)target_saddr; +if (addr->sa_family ==AF_NETLINK && + len >=sizeof (struct target_sockaddr_nl )) { +struct target_sockaddr_nl *target_nl = + (struct target_sockaddr_nl *)target_saddr; target_nl->nl_pid =tswap32 (target_nl->nl_pid); target_nl->nl_groups =tswap32 (target_nl->nl_groups); }else if (addr->sa_family ==AF_PACKET ) {linux-user/syscall_defs.h +0
-0@@ -153,6 +153,13 @@ struct target_sockaddr_un {uint8_t sun_path[108 ]; };
Quoted 9 lines
linux-user/syscall_defs.h struct target_sockaddr_un { · line 161
Quoted 6 lines
linux-user/syscall_defs.h +6
-0+struct target_sockaddr_nl { +uint16_t nl_family;/* AF_NETLINK */ +uint16_t __pad; +uint32_t nl_pid; +uint32_t nl_groups; +};You should use
abi_ushortandabi_uintto keep alignments good (for instance m68k aligns on 16bit whereas others on 32bit).
Are you sure? The other target_sockaddr don't use that... Is this because netlink is a host-only structure? (while other are serialized over some interface).
Thanks,
Phil.
Re: [Qemu-devel] [PATCH v6 4/8] linux-user/syscall: Introduce target_sockaddr_nl
Le 11/09/2019 à 21:34, Philippe Mathieu-Daudé a écrit :
Quoted 44 lines · Laurent Vivier
Quoted 33 lines · Philippe Mathieu-Daudé
Quoted 32 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Tested-by Guido Günther <[email protected]>--- linux-user/syscall.c | 6 ++++-- linux-user/syscall_defs.h | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-)linux-user/syscall.c +4
-2@@ -1494,8 +1494,10 @@ static inline abi_long host_to_target_sockaddr(abi_ulong target_addr, sizeof(target_saddr->sa_family)) { target_saddr->sa_family =tswap16 (addr->sa_family); } -if (addr->sa_family ==AF_NETLINK && len >=sizeof (struct sockaddr_nl )) { -struct sockaddr_nl *target_nl = (struct sockaddr_nl *)target_saddr; +if (addr->sa_family ==AF_NETLINK && + len >=sizeof (struct target_sockaddr_nl )) { +struct target_sockaddr_nl *target_nl = + (struct target_sockaddr_nl *)target_saddr; target_nl->nl_pid =tswap32 (target_nl->nl_pid); target_nl->nl_groups =tswap32 (target_nl->nl_groups); }else if (addr->sa_family ==AF_PACKET ) {linux-user/syscall_defs.h +0
-0@@ -153,6 +153,13 @@ struct target_sockaddr_un {uint8_t sun_path[108 ]; };Quoted 9 lines
linux-user/syscall_defs.h struct target_sockaddr_un { · line 161
Quoted 6 lines
linux-user/syscall_defs.h +6
-0+struct target_sockaddr_nl { +uint16_t nl_family;/* AF_NETLINK */ +uint16_t __pad; +uint32_t nl_pid; +uint32_t nl_groups; +};You should use
abi_ushortandabi_uintto keep alignments good (for instance m68k aligns on 16bit whereas others on 32bit).
Quoted 3 lines
Are you sure? The other
target_sockaddrdon't use that... Is this because netlink is a host-only structure? (while other are serialized over some interface).
I think other target_sockaddr are wrong too. No one takes really care of alignment, and most of the time structures are by construction well aligned.
Thanks,
Laurent
PATCH v6 5/8 linux-user/strace: Dump AF_NETLINK sockaddr content
In reply to Philippe Mathieu-Daudé--- linux-user/strace.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
linux-user/strace.c +37 -0
@@ -8,6 +8,7 @@#include <arpa/inet.h> #include <netinet/tcp.h> #include <linux/if_packet.h> +#include <linux/netlink.h> #include <sched.h> #include "qemu.h"
@@ -398,6 +399,12 @@ print_sockaddr(abi_ulong addr, abi_long addrlen)gemu_log ("}" );break ; } +case AF_NETLINK : { +struct target_sockaddr_nl *nl = (struct target_sockaddr_nl *)sa; +gemu_log ("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}" , + nl->nl_pid, nl->nl_groups); +break ; + }default :gemu_log ("{sa_family=%d, sa_data={" , sa->sa_family);for (i =0 ; i <13 ; i++) {
@@ -424,6 +431,9 @@ print_socket_domain(int domain)case PF_INET :gemu_log ("PF_INET" );break ; +case PF_NETLINK : +gemu_log ("PF_NETLINK" ); +break ;case PF_PACKET :gemu_log ("PF_PACKET" );break ;
@@ -473,6 +483,33 @@ print_socket_protocol(int domain, int type, int protocol)return ; } +if (domain ==PF_NETLINK ) { +switch (protocol) { +case NETLINK_ROUTE : +gemu_log ("NETLINK_ROUTE" ); +break ; +case NETLINK_AUDIT : +gemu_log ("NETLINK_AUDIT" ); +break ; +case NETLINK_NETFILTER : +gemu_log ("NETLINK_NETFILTER" ); +break ; +case NETLINK_KOBJECT_UEVENT : +gemu_log ("NETLINK_KOBJECT_UEVENT" ); +break ; +case NETLINK_RDMA : +gemu_log ("NETLINK_RDMA" ); +break ; +case NETLINK_CRYPTO : +gemu_log ("NETLINK_CRYPTO" ); +break ; +default : +gemu_log ("%d" , protocol); +break ; + } +return ; + } +switch (protocol) {case IPPROTO_IP :gemu_log ("IPPROTO_IP" );
Signature · 1 line
2.20.1
PATCH v6 6/8 linux-user/strace: Add print_sockfd()
In reply to Philippe Mathieu-DaudéExtract common print_sockfd() from various socket related syscalls.
---
v6: use another ifdef TARGET_NR_socketcall
--- linux-user/strace.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
linux-user/strace.c +16 -7
@@ -1710,6 +1710,15 @@ print_socket(const struct syscallname *name,#if defined(TARGET_NR_socketcall) +static void print_sockfd (abi_long sockfd,int last) +{ +print_raw_param (TARGET_ABI_FMT_ld, sockfd, last); +} + +#endif + +#if defined(TARGET_NR_socketcall) +#define get_user_ualx (x, gaddr, idx) \ get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
@@ -1742,7 +1751,7 @@ static void do_print_sockaddr(const char *name, abi_long arg1)get_user_ualx (addrlen, arg1,2 );gemu_log ("%s(" , name); -print_raw_param (TARGET_ABI_FMT_ld, sockfd,0 ); +print_sockfd (sockfd,0 );print_sockaddr (addr, addrlen);gemu_log (")" ); }
@@ -1755,7 +1764,7 @@ static void do_print_listen(const char *name, abi_long arg1)get_user_ualx (backlog, arg1,1 );gemu_log ("%s(" , name); -print_raw_param (TARGET_ABI_FMT_ld, sockfd,0 ); +print_sockfd (sockfd,0 );print_raw_param (TARGET_ABI_FMT_ld, backlog,1 );gemu_log (")" ); }
@@ -1790,7 +1799,7 @@ static void do_print_sendrecv(const char *name, abi_long arg1)get_user_ualx (flags, arg1,3 );gemu_log ("%s(" , name); -print_raw_param (TARGET_ABI_FMT_ld, sockfd,0 ); +print_sockfd (sockfd,0 );print_buf (msg, len,0 );print_raw_param (TARGET_ABI_FMT_ld, len,0 );print_flags (msg_flags, flags,1 );
@@ -1809,7 +1818,7 @@ static void do_print_msgaddr(const char *name, abi_long arg1)get_user_ualx (addrlen, arg1,5 );gemu_log ("%s(" , name); -print_raw_param (TARGET_ABI_FMT_ld, sockfd,0 ); +print_sockfd (sockfd,0 );print_buf (msg, len,0 );print_raw_param (TARGET_ABI_FMT_ld, len,0 );print_flags (msg_flags, flags,0 );
@@ -1825,7 +1834,7 @@ static void do_print_shutdown(const char *name, abi_long arg1)get_user_ualx (how, arg1,1 );gemu_log ("shutdown(" ); -print_raw_param (TARGET_ABI_FMT_ld, sockfd,0 ); +print_sockfd (sockfd,0 );switch (how) {case SHUT_RD :gemu_log ("SHUT_RD" );
@@ -1852,7 +1861,7 @@ static void do_print_msg(const char *name, abi_long arg1)get_user_ualx (flags, arg1,2 );gemu_log ("%s(" , name); -print_raw_param (TARGET_ABI_FMT_ld, sockfd,0 ); +print_sockfd (sockfd,0 );print_pointer (msg,0 );print_flags (msg_flags, flags,1 );gemu_log (")" );
@@ -1869,7 +1878,7 @@ static void do_print_sockopt(const char *name, abi_long arg1)get_user_ualx (optlen, arg1,4 );gemu_log ("%s(" , name); -print_raw_param (TARGET_ABI_FMT_ld, sockfd,0 ); +print_sockfd (sockfd,0 );switch (level) {case SOL_TCP :gemu_log ("SOL_TCP," );
Signature · 1 line
2.20.1
PATCH v6 7/8 linux-user/strace: Improve bind() output
In reply to Philippe Mathieu-Daudé---
v6: use TARGET_NR_socketcall || TARGET_NR_bind (lvivier)
--- linux-user/strace.c | 15 ++++++++++++++- linux-user/strace.list | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-)
linux-user/strace.c +14 -1
@@ -1708,7 +1708,7 @@ print_socket(const struct syscallname *name,#endif -#if defined(TARGET_NR_socketcall) +#if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind)static void print_sockfd (abi_long sockfd,int last) {
@@ -2055,6 +2055,19 @@ print_socketcall(const struct syscallname *name, }#endif +#if defined(TARGET_NR_bind) +static void +print_bind (const struct syscallname *name, +abi_long arg0,abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ +print_syscall_prologue (name); +print_sockfd (arg0,0 ); +print_sockaddr (arg1, arg2,1 ); +print_syscall_epilogue (name); +} +#endif +#if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \ defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) static void
linux-user/strace.list +1 -1
@@ -41,7 +41,7 @@ { TARGET_NR_bdflush, "bdflush" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_bind -{ TARGET_NR_bind, "bind" , NULL, NULL, NULL }, +{ TARGET_NR_bind, "bind" , NULL, print_bind, NULL }, #endif #ifdef TARGET_NR_bpf { TARGET_NR_bpf, "bpf" , NULL, NULL, NULL },
Signature · 1 line
2.20.1
PATCH v6 8/8 linux-user/strace: Let print_sockaddr() have a 'last' argument
In reply to Philippe Mathieu-DaudéIf the format is not the syscall last argument, a comma is append.
---
checkpatch error:
ERROR: storage class should be at the beginning of the declaration
--- linux-user/strace.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
linux-user/strace.c +5 -5
@@ -67,7 +67,7 @@ UNUSED static void print_timeval(abi_ulong, int); UNUSED static void print_timezone(abi_ulong, int); UNUSED static void print_number(abi_long, int); UNUSED static void print_signal(abi_ulong, int); -UNUSED static void print_sockaddr(abi_ulong addr, abi_long addrlen); +UNUSED static void print_sockaddr(abi_ulong addr, abi_long addrlen, int); UNUSED static void print_socket_domain(int domain); UNUSED static void print_socket_type(int type); UNUSED static void print_socket_protocol(int domain, int type, int protocol);
@@ -336,7 +336,7 @@ static void print_siginfo(const target_siginfo_t *tinfo) }static void -print_sockaddr (abi_ulong addr,abi_long addrlen) +print_sockaddr (abi_ulong addr,abi_long addrlen,int last) {struct target_sockaddr *sa;int i;
@@ -418,7 +418,7 @@ print_sockaddr(abi_ulong addr, abi_long addrlen) }else {print_raw_param ("0x" TARGET_ABI_FMT_lx, addr,0 ); } -gemu_log (", " TARGET_ABI_FMT_ld, addrlen); +gemu_log (", " TARGET_ABI_FMT_ld"%s" , addrlen,get_comma (last)); } static void
@@ -1752,7 +1752,7 @@ static void do_print_sockaddr(const char *name, abi_long arg1)gemu_log ("%s(" , name);print_sockfd (sockfd,0 ); -print_sockaddr (addr, addrlen); +print_sockaddr (addr, addrlen,0 );gemu_log (")" ); }
@@ -1822,7 +1822,7 @@ static void do_print_msgaddr(const char *name, abi_long arg1)print_buf (msg, len,0 );print_raw_param (TARGET_ABI_FMT_ld, len,0 );print_flags (msg_flags, flags,0 ); -print_sockaddr (addr, addrlen); +print_sockaddr (addr, addrlen,0 );gemu_log (")" ); }
Signature · 1 line
2.20.1
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v6 0/8] linux-user: strace improvements
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
d2015e2 linux-user/strace: Let print_sockaddr() have a 'last' argument 4c7df4b linux-user/strace: Improve bind() output
6523a43 linux-user/strace: Add print_sockfd()
073f6fd linux-user/strace: Dump AF_NETLINK sockaddr content 2abd312 linux-user/syscall: Introduce target_sockaddr_nl 0f5e8ed linux-user/strace: Improve settimeofday()
19233df linux-user/strace: Add print_timezone()
be098a1 linux-user/strace: Display invalid pointer in print_timeval()
=== OUTPUT BEGIN ===
1/8 Checking commit be098a139807 (linux-user/strace: Display invalid pointer in print_timeval()) 2/8 Checking commit 19233df8c5da (linux-user/strace: Add print_timezone())
ERROR: storage class should be at the beginning of the declaration
#19: FILE: linux-user/strace.c:66:
+UNUSED static void print_timezone(abi_ulong, int);
total: 1 errors, 0 warnings, 33 lines checked
Patch 2/8 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
3/8 Checking commit 0f5e8ed953bf (linux-user/strace: Improve settimeofday())
4/8 Checking commit 2abd31260722 (linux-user/syscall: Introduce target_sockaddr_nl) 5/8 Checking commit 073f6fdfe338 (linux-user/strace: Dump AF_NETLINK sockaddr content) 6/8 Checking commit 6523a43281c4 (linux-user/strace: Add print_sockfd())
7/8 Checking commit 4c7df4b3b8c7 (linux-user/strace: Improve bind() output)
8/8 Checking commit d2015e24e08c (linux-user/strace: Let print_sockaddr() have a 'last' argument)
ERROR: storage class should be at the beginning of the declaration
#22: FILE: linux-user/strace.c:70:
+UNUSED static void print_sockaddr(abi_ulong addr, abi_long addrlen, int);
total: 1 errors, 0 warnings, 40 lines checked
Patch 8/8 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]