Commit Graph

18 Commits

Author SHA1 Message Date
4ba39820f1 mmsghdr.c: use xsprintf instead of snprintf
* mmsghdr.c: Include "xstring.h".
(SYS_FUNC(recvmmsg)): Replace snprintf with xsprintf.
2018-01-07 00:05:42 +00:00
89636759d7 Automatically replace PRI_kr[dux] with PRI_kl[dux]
Remove temporary macros created for transition from long
to kernel_ulong_t.

Automatically replace PRI_kr[dux] with PRI_kl[dux] using
$ git grep -l 'PRI_kr[dux]' | xargs sed -ri 's/PRI_kr([dux])/PRI_kl\1/g'

* defs.h (PRI_krd, PRI_kru, PRI_krx): Remove.  All users updated.
2016-12-26 10:43:34 +00:00
7fa3d78319 Automatically replace kernel_(scno|ureg)_t with kernel_ulong_t
Remove temporary types created for transition from long
to kernel_ulong_t.

Automatically replace kernel_scno_t and kernel_ureg_t with
kernel_ulong_t using
$ git grep -El 'kernel_(scno|ureg)_t' |
  xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g'

* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
All users updated.
2016-12-26 10:43:34 +00:00
1d5bb61c49 Print kernel_ureg_t and kernel_scno_t using dedicated format strings
Prepare for the change of kernel_ureg_t and kernel_scno_t from
unsigned long to kernel_ulong_t.

* defs.h (PRI_krd, PRI_kru, PRI_krx): New temporary macros.
All users updated.
2016-12-26 10:43:04 +00:00
9050affe7c Use ptr_to_kulong instead of explicit casts of pointers to kernel_ureg_t
Direct casts to kernel_ureg_t will not work after the change
of kernel_ureg_t from unsigned long to kernel_ulong_t.

* defs.h (ptr_to_kulong): New macro.
* block.c (print_blkpg_req): Use it instead of explicit casts
to kernel_ureg_t.
* btrfs.c (btrfs_ioctl): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
* msghdr.c (print_struct_msghdr, dumpiov_in_msghdr): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Likewise.
* sigaltstack.c (print_stack_t): Likewise.
* sock.c (decode_ifconf): Likewise.
* sysctl.c (SYS_FUNC(sysctl)): Likewise.
* util.c (dumpiov_upto): Likewise.
* v4l2.c (print_v4l2_framebuffer, print_v4l2_ext_control,
print_v4l2_ext_controls): Likewise.
2016-12-26 01:59:08 +00:00
121e148978 msghdr: change register based size types from unsigned long to kernel_ureg_t
* defs.h (dumpiov_in_msghdr): Change data_size argument type
from unsigned long to kernel_ureg_t.
* msghdr.h (print_struct_msghdr): Likewise.
* msghdr.c (print_struct_msghdr): Likewise.  Cast msghdr.msg_iovlen
and msghdr.msg_controllen to kernel_ureg_t instead of unsigned long.
(decode_msghdr, dumpiov_in_msghdr): Change data_size argument type
from unsigned long to kernel_ureg_t.
(SYS_FUNC(sendmsg)): Pass -1 instead of -1UL as data_size argument
to decode_msghdr.
* mmsghdr.c (print_struct_mmsghdr): Pass (kernel_ureg_t) -1 instead
of -1UL as data_size argument to print_struct_msghdr.
(dumpiov_in_mmsghdr): Cast msghdr.msg_iovlen to kernel_ureg_t instead
of unsigned long.
* syscall.c (dumpio): Pass -1 instead of -1UL as data_size argument
to dumpiov_in_msghdr
2016-12-25 11:32:45 +00:00
cdf05fb392 dump*: change address argument type from long to kernel_ureg_t
* defs.h (dumpiov_in_msghdr, dumpiov_in_mmsghdr, dumpiov_upto, dumpstr):
Change address argument type from long to kernel_ureg_t.
* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
* msghdr.c (fetch_msghdr_namelen, decode_msghdr, dumpiov_in_msghdr):
Likewise.
* util.c (dumpiov_upto, dumpstr): Likewise.
2016-12-25 11:32:44 +00:00
956e3a34a3 umove*: change tracee address argument type from long to kernel_ureg_t
* defs.h (umovestr, umoven, umoven_or_printaddr,
umoven_or_printaddr_ignore_syserror): Change tracee address argument
type from long to kernel_ureg_t.
(print_array): Change the type of tracee address argument of umoven_func
from long to kernel_ureg_t.
* util.c (vm_read_mem, umovestr, umoven, umoven_or_printaddr,
umoven_or_printaddr_ignore_syserror): Change tracee address argument
type from long to kernel_ureg_t.
(print_array): Change the type of tracee address argument of umoven_func
from long to kernel_ureg_t.
* desc.c (umove_kulong_array_or_printaddr): Change tracee address
argument type from long to kernel_ureg_t.
* mmsghdr.c (fetch_struct_mmsghdr_or_printaddr): Likewise.
2016-12-25 11:32:43 +00:00
4d9a785bfd mmsghdr: cast pointers to kernel_ureg_t instead of long
* mmsghdr.c (dumpiov_in_mmsghdr): Cast msghdr.msg_iov pointer
to kernel_ureg_t instead of long.
2016-12-24 14:58:41 +00:00
8bb5c14488 mmsghdr: change address argument type from unsigned long to kernel_ureg_t
* mmsghdr.c (save_mmsgvec_namelen, decode_mmsgvec): Change
address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
0d88d99da2 Print unsent messages of failed sendmmsg syscall
* mmsghdr.c (decode_mmsgvec): Clear syserror for the time of printing
struct mmsghdr array in !use_msg_len case.
(SYS_FUNC(sendmmsg)): As failed sendmmsg syscall does not
set msg_len fields, tell this to decode_mmsgvec.
* tests/mmsg_name.c (test_mmsg_name): Check it.
2016-07-19 17:46:33 +00:00
3a161d1902 Print unsent messages of sendmmsg syscall
* defs.h (decode_mmsgvec): Add int argument.
* mmsghdr.c (print_struct_mmsghdr_config): Add msg_len_vlen field.
(print_struct_mmsghdr): Print struct mmsghdr.msg_len only for
msg_len_vlen first elements of struct mmsghdr array.
(decode_mmsgvec): Add msg_len_vlen argument.
(SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg)): Pass to decode_mmsgvec
the number of elements of struct mmsghdr array that contain meaningful
struct mmsghdr.msg_len.
* tests/mmsg_name.c (test_mmsg_name): Check it.
2016-07-19 17:46:33 +00:00
b42f6b3903 Fix decoding of msg_name* fields of recvmmsg syscall's msghdr array argument
As msg_namelen fields of recvmmsg syscall's struct msghdr array have
the same read-write semantics as struct msghdr argument of recvmsg
syscall, parser of recvmmsg syscall needs a similar fix.

* mmsghdr.c (print_struct_mmsghdr): Increment p_user_msg_namelen field.
(mmsgvec_data): New structure.
(free_mmsgvec_data, save_mmsgvec_namelen): New functions.
(decode_mmsgvec): Take into account the data saved
by save_mmsgvec_namelen function.
(SYS_FUNC(recvmmsg)): Use save_mmsgvec_namelen.
2016-07-19 17:46:33 +00:00
0485ab5e23 mmsghdr.c: rewrite decode_mmsgvec using print_array
* fetch_struct_mmsghdr.c (sizeof_struct_mmsghdr): New mpers printer.
* mmsghdr.c: Include <limits.h>.
(print_struct_mmsghdr_config): New structure.
(fetch_struct_mmsghdr_or_printaddr, print_struct_mmsghdr): New functions.
(decode_mmsgvec): Rewrite using them and print_array.
2016-07-19 17:46:32 +00:00
3e3b7f6403 Fix printing of remaining timeout of recvmmsg syscall
* mmsghdr.c (SYS_FUNC(recvmmsg)): Do not print remaining timeout
when the 5th syscall argument is NULL.
* tests/mmsg.c (main): Update expected output.
2016-07-19 17:45:06 +00:00
7f8ece11c8 Fix race condition in decoding timeout argument of recvmmsg syscall
As the value returned by sprint_timespec points to a static area and may
be overwritten by subsequent calls to sprint_timespec, it is not safe to
save this value on entering syscall and use it later on exiting.

* mmsghdr.c (SYS_FUNC(recvmmsg)): On entering syscall, copy the value
returned by sprint_timespec to a dynamically allocated memory, and save
the pointer using set_tcb_priv_data.  On exiting, restore it using
get_tcb_priv_data.
2016-07-18 22:12:45 +00:00
4de8de50d2 net.c: move parsers of sendmmsg and recvmmsg syscalls to mmsghdr.c
* defs.h (decode_mmsgvec): Remove.
* net.c: Do not include "msghdr.h".
(SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg)): Move ...
* mmsghdr.c: ... here.
(decode_mmsgvec): Add static qualifier.
2016-07-18 22:12:44 +00:00
7c37ce4055 msghdr.c: move all mmsghdr parsers to a separate file
* msghdr.h (print_struct_msghdr): New prototype.
* msghdr.c (print_msghdr): Rename to print_struct_msghdr, remove
static qualifier, all callers changed.
(decode_mmsghdr, decode_mmsgvec, dumpiov_in_mmsghdr): Move to ...
* mmsghdr.c: ... new file.
* Makefile.am (strace_SOURCES): Add it.
2016-07-18 22:12:19 +00:00