Commit Graph

5031 Commits

Author SHA1 Message Date
0601cf5939 dumpiov_upto: change size types from unsigned long to kernel_ureg_t
* defs.h (dumpiov_upto): Change data_size argument type
from unsigned long to kernel_ureg_t.
* util.c (dumpiov_upto): Change the type of data_size argument
and iov_len variable from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
27cc81d61f msghdr: change cmsghdr size types from size_t to unsigned int
As the kernel does not accept control messages longer than the value
of int sysctl_optmem_max kernel variable exported as
/proc/sys/net/core/optmem_max, we do not print them either.

Since unsigned int has enough room to contain any valid control message
size, change all internal cmsghdr size types from size_t
to unsigned int.

* msghdr.c (print_scm_rights, print_scm_creds, print_scm_security,
print_cmsg_ip_pktinfo, print_cmsg_uint, print_cmsg_uint8_t,
print_cmsg_ip_opts, print_cmsg_ip_recverr, print_cmsg_ip_origdstaddr,
cmsg_printer, print_cmsg_type_data): Change data_len argument type
from size_t to unsigned int.
(cmsg_socket_printers): Change min_len type from size_t to unsigned int.
(decode_msg_control): Change the type of in_control_len argument,
cmsg_len, and len variables from size_t to kernel_ureg_t.
Change the type of cmsg_size, control_len, and buf_len variables
from size_t to unsigned int.
2016-12-25 11:32:45 +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
1049a1dae9 mq: remove redundant u_rval check
* mq.c (SYS_FUNC(mq_timedreceive)): Do not check for tcp->u_rval < 0,
syserror(tcp) is enough, and printstrn can handle len < 0 anyway.
2016-12-25 11:32:45 +00:00
3ccde53d7f io: change size types from unsigned long to kernel_ureg_t
* defs.h (tprint_iov_upto): Change the type of len and data_size
arguments from unsigned long to kernel_ureg_t.
(tprint_iov): Change the type of len argument from unsigned long
to kernel_ureg_t.
* io.c (print_iovec_config): Change data_size type from unsigned long
to kernel_ureg_t.
(print_iovec): Change the type of *iov, iov_buf, and len variables
from unsigned long to kernel_ureg_t.
(tprint_iov_upto): Change the type of len and data_size arguments, and
the type of iov variable from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
570314dd90 mount: change flags type from unsigned long to kernel_ureg_t
* mount.c (SYS_FUNC(mount)): Change the type of flags from unsigned long
to kernel_ureg_t, use printflags64 instead of printflags_long
to print it.
2016-12-25 11:32:45 +00:00
697ca3e41f mem: change mmap arguments type from unsigned long to kernel_ureg_t
* mem.c (print_mmap): Change the type of len, prot, and flags
from unsigned long to kernel_ureg_t.  Use printflags64 instead
of printflags_long.  Use printxval64 instead of printxval_long.
(SYS_FUNC(old_mmap)): Check for current_klongsize instead
of [AARCH64 || X86_64] to take X32 into account.
(SYS_FUNC(mremap)): Use printflags64 instead of printflags_long.
(SYS_FUNC(remap_file_pages)): Change the type of size, prot, pgoff, and
flags from unsigned long to kernel_ureg_t.  Use printflags64 instead
of printflags_long.  Use printxval64 instead of printxval_long.
[POWERPC] (SYS_FUNC(subpage_prot)): Change the type of len and nmemb
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
f8b6389263 numa: change size arguments type from unsigned long to kernel_ureg_t
* numa.c (print_node, print_addr): Add kernel_ureg_t support.
(print_nodemask): Change type of maxnodes argument from unsigned long
to kernel_ureg_t.
(SYS_FUNC(move_pages)): Change npages type from unsigned long
to kernel_ureg_t.  Change buf type from long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
a8bf674039 print_sigset_addr_len: change len argument type from long to kernel_ureg_t
* defs.h (print_sigset_addr_len): Change len argument type from long
to kernel_ureg_t.
* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len): Likewise.
2016-12-25 11:32:45 +00:00
569dc792d5 process_vm: change size arguments type from unsigned long to kernel_ureg_t
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Change the type of local_iovcnt,
remote_iovcnt, and flags from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
00785bf73a printstr*: change len argument type from long to kernel_ureg_t
* defs.h (printstr_ex, printstrn): Change len argument type from long
to kernel_ureg_t.
* util.c (printstr_ex): Likewise.
2016-12-25 11:32:45 +00:00
9ec1fb02ef xattr: change size arguments type from unsigned long to kernel_ureg_t
* xattr.c (print_xattr_val): Change type of insize and size arguments
from unsigned long to kernel_ureg_t.
(print_xattr_list): Change type of size argument from unsigned long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
a3c2e4e20b printstr_ex: fix decoding of non-NUL-terminated strings when len == -1
Do not treat len == -1 in any special way.  All users who need the
string to be handled as a NUL-terminated string set QUOTE_0_TERMINATED
bit in user_style flags already.

* util.c (printstr_ex): Remove (len == -1) check.
* tests/printstr.c: New file.
* tests/printstr.test: New test.
* tests/.gitignore: Add printstr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add printstr.test.
2016-12-25 11:32:45 +00:00
9af28a4d13 Fix decoding of sethostname syscall
The second argument of sethostname syscall is not an unsigned long but
unsigned int.  The kernel does not look at the string argument when
the length argument is too long.

* hostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
(SYS_FUNC(sethostname)): Treat the second argument as unsigned int.
Print the first argument as a pointer when the second argument exceeds
__NEW_UTS_LEN.
* tests/sethostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
(main): Use it.  Check that the second argument of sethostname
is handled as unsigned int.  Check that the first argument is printed
as a pointer when the second argument exceeds __NEW_UTS_LEN.
2016-12-25 11:32:45 +00:00
bd43e0954b tests: add F8ILL_KULONG_* and f8ill_ptr_to_kulong to tests.h
* tests/tests.h (F8ILL_KULONG_SUPPORTED, F8ILL_KULONG_MASK): New macros.
(f8ill_ptr_to_kulong): New static inline function.
2016-12-25 11:32:45 +00:00
a940d1a60f printstr: rename to printstrn, add printstr as a thin wrapper
As about half of all printstr uses cases are invocations with the last
argument set to -1, create a dedicated function for this use case.

* defs.h (printstr): Rename to printstrn.  All callers updated.
(printstr): New static inline function.  All callers updated.
2016-12-25 11:32:45 +00:00
1cb75579e1 process: change ptrace arguments type from unsigned long to kernel_ureg_t
(SYS_FUNC(ptrace)): Change type of request and data arguments
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
50cba466e5 process: change tracee address type from unsigned long to kernel_ureg_t
* process.c (print_user_offset_addr): Change address argument type
from unsigned long to kernel_ureg_t.
(SYS_FUNC(ptrace)): Change addr variable type from unsigned long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
405279fa77 net: change address argument type from long to kernel_ureg_t
* net.c (decode_sockbuf, decode_pair_fd, print_linger, print_ucred,
print_tpacket_stats, print_icmp_filter, print_getsockopt, print_mreq,
print_mreq6, print_group_req, print_tpacket_req, print_packet_mreq,
print_setsockopt): Change address argument type from long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
aff8528b22 print_mq_attr: change address argument type from long to kernel_ureg_t
* print_mq_attr.c (printmqattr): Change address argument type from long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
91b63a91ae ipc_*: change address argument type from long to kernel_ureg_t
* ipc_msg.c (tprint_msgsnd, tprint_msgrcv, fetch_msgrcv_args): Change
address argument type from long to kernel_ureg_t.
* ipc_msgctl.c (print_msqid_ds): Likewise.
* ipc_sem.c (tprint_sembuf_array): Likewise.
* ipc_shmctl.c (print_shmid_ds): Likewise.
2016-12-25 11:32:45 +00:00
fdcaa2fa42 print_msgbuf: change address argument type from long to kernel_ureg_t
* print_msgbuf.c (tprint_msgbuf): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
d4e4e873ee desc: change tracee address type from long to kernel_ureg_t
* desc.c (decode_select): Rename arg to addr, change its type
from long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
fae76db73b uid: change address argument type from long to kernel_ureg_t
* uid.c (get_print_uid): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
93e2dfe0e5 time: change address argument type from long to kernel_ureg_t
* time.c (print_timezone, do_adjtimex): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
4f486f8207 sched: change address argument type from long to kernel_ureg_t
* sched.c (print_sched_attr): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
1575c3115a printsiginfo: change address argument type from long to kernel_ureg_t
* printsiginfo.c (printsiginfo_at): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
38392acb35 print_timex: change address argument type from long to kernel_ureg_t
* print_timex.c (print_timex): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
7f83dba279 print_sigevent: change address argument type from long to kernel_ureg_t
* print_sigevent.c (print_sigevent): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
1c3c1ae44e poll: change address argument type from long to kernel_ureg_t
* poll.c (decode_poll_exiting): Change tracee address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
3f8d42d94f printrusage*: change tracee address argument type from long to kernel_ureg_t
* defs.h [ALPHA] (printrusage32): Change address argument type
from long to kernel_ureg_t.
* printrusage.c (printrusage): Likewise.
[ALPHA] (printrusage32): Likewise.
* wait.c (printwaitn): Change the type of tracee address argument
of print_rusage from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
61b2e2199f print_time*: change tracee address argument type from long to kernel_ureg_t
* defs.h [ALPHA] (sprint_timeval32, print_timeval32,
print_timeval32_pair, print_itimerval32): Change address argument type
from long to kernel_ureg_t.
* desc.c (decode_select): Change the type of tracee address argument
of print_tv_ts and sprint_tv_ts from long to kernel_ureg_t.
* print_timespec.c (print_timespec, sprint_timespec,
print_timespec_utime_pair, print_itimerspec): Change address argument
type from long to kernel_ureg_t.
* print_timeval.c (print_timeval, print_timeval_pair, sprint_timeval,
print_itimerval, print_timeval32, print_timeval32_pair,
print_itimerval32, sprint_timeval32): Likewise.
2016-12-25 11:32:44 +00:00
033c9cfc13 rtc: change type of ioctl 3rd argument from long to kernel_ureg_t
* rtc.c (decode_rtc_time, decode_rtc_wkalrm, decode_rtc_pll_info):
Change addr type from long to kernel_ureg_t.
(rtc_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
16300524f2 mtd: change type of ioctl 3rd argument from long to kernel_ureg_t
* mtd.c (decode_erase_info_user, decode_erase_info_user64,
decode_mtd_oob_buf, decode_mtd_oob_buf64, decode_otp_info,
decode_otp_select, decode_mtd_write_req, decode_mtd_info_user,
decode_nand_oobinfo, decode_nand_ecclayout_user, decode_mtd_ecc_stats):
Change addr type from long to kernel_ureg_t.
(mtd_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
e86ff37e3f hdio: change type of ioctl 3rd argument from long to kernel_ureg_t
* hdio.c (hdio_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
66834ea9a7 v4l2: change type of ioctl 3rd argument from long to kernel_ureg_t
* v4l2.c (print_v4l2_capability, print_v4l2_fmtdesc, print_v4l2_format,
print_v4l2_requestbuffers, print_v4l2_buffer, print_v4l2_framebuffer,
print_v4l2_buf_type, print_v4l2_streamparm, print_v4l2_standard,
print_v4l2_input, print_v4l2_control, print_v4l2_queryctrl,
print_v4l2_cropcap, print_v4l2_crop, print_v4l2_ext_controls,
print_v4l2_frmsizeenum, print_v4l2_frmivalenum,
print_v4l2_create_buffers, v4l2_ioctl): Change arg type from long
to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
7f1742631f evdev: change type of ioctl 3rd argument from long to kernel_ureg_t
* evdev.c (ff_effect_ioctl, abs_ioctl, keycode_ioctl, keycode_V2_ioctl,
getid_ioctl, decode_bitset, mtslots_ioctl, repeat_ioctl, bit_ioctl,
evdev_read_ioctl, evdev_write_ioctl, evdev_ioctl): Change arg type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
7ac5286986 btrfs: change type of ioctl 3rd argument from long to kernel_ureg_t
* btrfs.c (btrfs_print_balance, btrfs_ioctl): Change arg type from long
to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
c322fba197 block: change type of ioctl 3rd argument from long to kernel_ureg_t
* block.c (block_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
10350d5eb0 Change type of ioctl 3rd argument from long to kernel_ureg_t
* defs.h (DECL_IOCTL): Change arg type from long to kernel_ureg_t.
* dm.c (dm_known_ioctl, dm_ioctl): Likewise.
* file_ioctl.c (file_ioctl): Likewise.
* fs_x_ioctl.c (fs_x_ioctl): Likewise.
* ioctl.c (ioctl_decode): Likewise.
* loop.c (decode_loop_info, decode_loop_info64): Change addr type
from long to kernel_ureg_t.
(loop_ioctl): Change arg type from long to kernel_ureg_t.
* ptp.c (ptp_ioctl): Likewise.
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
print_sg_io_v4_res, scsi_ioctl): Likewise.
* sock.c (print_ifreq, sock_ioctl): Likewise.
(decode_ifconf): Change addr type from long to kernel_ureg_t.
* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
decode_modem_flags): Likewise.
(term_ioctl): Change arg type from long to kernel_ureg_t.
* ubi.c (ubi_ioctl): Likewise.
* userfaultfd.c (uffdio_ioctl): Likewise.
2016-12-25 11:32:44 +00:00
98f8b95b0f ldt: change address argument type from long to kernel_ureg_t
* defs.h [HAVE_STRUCT_USER_DESC] (print_user_desc): Change address
argument type from long to kernel_ureg_t.
* ldt.c [HAVE_STRUCT_USER_DESC] (print_user_desc): Likewise.
2016-12-25 11:32:44 +00:00
1007f7a276 fcntl: change address argument type from long to kernel_ureg_t
* fcntl.c (printflock64, printflock, print_f_owner_ex): Change
address argument type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
ef54d3d838 execve: change address argument type from long to kernel_ureg_t
* execve.c (printargv, printargc): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
96512c4d78 dirent: change address argument type from long to kernel_ureg_t
* dirent.c (print_old_dirent): Change address argument type from long
to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
c96d9f17b1 bpf: change address argument type from long to kernel_ureg_t
* bpf.c (bpf_map_create, bpf_map_update_elem, bpf_map_delete_elem,
bpf_map_io, bpf_prog_load, SYS_FUNC(bpf)): Change address argument
type from long to kernel_ureg_t.
2016-12-25 11:32:44 +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
0aa9cf807e print_sigset_addr_len: change address argument type from long to kernel_ureg_t
* defs.h (print_sigset_addr_len) Change address argument type from long
to kernel_ureg_t.
* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len,
decode_old_sigaction, decode_new_sigaction): Likewise.
2016-12-25 11:32:44 +00:00
3106adf4af decode_sockaddr: change address argument type from long to kernel_ureg_t
* defs.h (decode_sockaddr) Change tracee address argument type from long
to kernel_ureg_t.
* sockaddr.c (decode_sockaddr): Likewise.
2016-12-25 11:32:43 +00:00
4e80a2087d print_struct_statfs*: change address argument type from long to kernel_ureg_t
* defs.h (print_struct_statfs, print_struct_statfs64): Change address
argument type from long to kernel_ureg_t.
* print_statfs.c (print_struct_statfs, print_struct_statfs64): Likewise.
* fetch_struct_statfs.c (fetch_struct_statfs, fetch_struct_statfs64):
Likewise.
2016-12-25 11:32:43 +00:00
ce27e2acf4 fetch_struct_flock: change address argument type from long to kernel_ureg_t
* fetch_struct_flock.c (fetch_struct_flock, fetch_struct_flock64):
Change address argument type from long to kernel_ureg_t.
2016-12-25 11:32:43 +00:00