mbox series

[v2,00/12] linux-user: strace improvements

Message ID 20180628034652.24152-1-f4bug@amsat.org
Headers show
Series linux-user: strace improvements | expand

Message

Philippe Mathieu-Daudé June 28, 2018, 3:46 a.m. UTC
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 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

$ git backport-diff
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/12:[0010] [FC] 'linux-user/strace: Dump AF_NETLINK sockaddr content'
002/12:[down] 'linux-user/strace: Let print_sockaddr() have a 'last' argument'
003/12:[0002] [FC] 'linux-user/strace: Improve sendto() output'
004/12:[0036] [FC] 'linux-user/strace: Add print_sockaddr_ptr() to handle plain/pointer addrlen'
005/12:[0002] [FC] 'linux-user/strace: Improve recvfrom() output'
006/12:[0002] [FC] 'linux-user/strace: Improve getsockname() output'
007/12:[----] [--] 'linux-user/strace: Improve recvmsg() output'
008/12:[0002] [FC] 'linux-user/strace: Improve bind() output'
009/12:[down] 'linux-user/strace: Add print_timezone()'
010/12:[0016] [FC] 'linux-user/strace: Improve gettimeofday() and settimeofday() output'
011/12:[----] [--] 'linux-user/strace: Improve capget()/capset() output'
012/12:[----] [--] 'linux-user/syscall: Verify recvfrom(addr) is user-writable'

Philippe Mathieu-Daudé (12):
  linux-user/syscall: Verify recvfrom(addr) is user-writable
  linux-user/strace: Improve capget()/capset() output
  linux-user/strace: Add print_timezone()
  linux-user/strace: Improve gettimeofday() and settimeofday() output
  linux-user/strace: Dump AF_NETLINK sockaddr content
  linux-user/strace: Improve recvmsg() output
  linux-user/strace: Improve bind() output
  linux-user/strace: improve sendto() output
  linux-user/strace: Let print_sockaddr() have a 'last' argument
  linux-user/strace: Add print_sockaddr_ptr() to handle plain/pointer addrlen
  linux-user/strace: Improve getsockname() output
  linux-user/strace: Improve recvfrom() output

 linux-user/syscall_defs.h |   7 ++
 linux-user/strace.c       | 159 ++++++++++++++++++++++++++++++++++++--
 linux-user/syscall.c      |  11 ++-
 linux-user/strace.list    |  18 ++---
 4 files changed, 179 insertions(+), 16 deletions(-)

Comments

Laurent Vivier July 1, 2018, 7:44 p.m. UTC | #1
Le 28/06/2018 à 05:46, Philippe Mathieu-Daudé a écrit :
> Suggested-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  linux-user/strace.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index bd897a3f20..b43a21f48b 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -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);
> @@ -1182,6 +1183,25 @@ 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) {

you should use print_pointer(tz_addr, last) instead of ignoring the value.

Thanks,
Laurent
Philippe Mathieu-Daudé July 2, 2018, 5:37 p.m. UTC | #2
On 07/01/2018 04:44 PM, Laurent Vivier wrote:
> Le 28/06/2018 à 05:46, Philippe Mathieu-Daudé a écrit :
>> Suggested-by: Laurent Vivier <laurent@vivier.eu>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  linux-user/strace.c | 20 ++++++++++++++++++++
>>  1 file changed, 20 insertions(+)
>>
>> diff --git a/linux-user/strace.c b/linux-user/strace.c
>> index bd897a3f20..b43a21f48b 100644
>> --- a/linux-user/strace.c
>> +++ b/linux-user/strace.c
>> @@ -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);
>> @@ -1182,6 +1183,25 @@ 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) {
> 
> you should use print_pointer(tz_addr, last) instead of ignoring the value.

I copied print_timeval(). Same applies there then. I'll update both.

Thanks,

Phil.