Commit Graph

15 Commits

Author SHA1 Message Date
031fc80059 Rename widen_to_ull to zero_extend_signed_to_ull
* defs.h (widen_to_ull): Rename to zero_extend_signed_to_ull.
All callers changed.
* tests/tests.h: Likewise.
2016-08-23 00:24:10 +00:00
484326dbd8 Consistently use printaddr for printing addresses
* bjm.c (SYS_FUNC(init_module)): Use printaddr.
* clone.c (SYS_FUNC(clone)): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* net.c (SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg), SYS_FUNC(getsockopt)):
Likewise.
* print_sigevent.c (print_sigevent): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* signal.c (decode_new_sigaction): Likewise.
* sysmips.c (SYS_FUNC(sysmips)): Likewise.
* util.c (printpathn, printstr, umoven_or_printaddr): Likewise.
* v4l2.c (print_v4l2_buffer, print_v4l2_framebuffer,
umoven_or_printaddr_ignore_syserror): Likewise.
* tests/net-icmp_filter.c (main): Update.

Based on patch by Eugene Syromyatnikov <evgsyr@gmail.com>.
2016-06-11 09:26:49 +00:00
84a979c9ee Fix explicit casts of signed integer types to unsigned long long
* defs.h (widen_to_ull): New macro.
* dirent.c (print_old_dirent, SYS_FUNC(getdents)): Use it in place
of explicit casts to unsigned long long.
* io.c (print_lld_from_low_high_val): Likewise.
* lseek.c (SYS_FUNC(llseek)): Likewise.
* printsiginfo.c (print_si_info): Likewise.
* printstat.h (DO_PRINTSTAT): Likewise.
* sysinfo.c (SYS_FUNC(sysinfo)): Likewise.
* times.c (SYS_FUNC(times)): Likewise.
* fetch_struct_statfs.c (ASSIGN_NUMBER): Remove.
(fetch_struct_statfs, fetch_struct_statfs64): Replace ASSIGN_NUMBER
with widen_to_ull.
2016-05-26 14:44:13 +00:00
a8fce09e34 mpers: add support of conditionally compiled printers
We used to declare and define all printers marked with
MPERS_PRINTER_DECL, including ifdef'ed ones.  That approach left us
no way to conditionally compile mpersified printers, which was not
a problem until btrfs ioctls appeared on the horizon.

With this change, those mpersified printers that are not going
to be compiled are also won't be declared and won't be added to
struct_printers.

This is implemented by filtering all source files containing
MPERS_PRINTER_DECL markers through CPP.  As a nice side effect, this
also lifts an ugly requirement of writing all MPERS_PRINTER_DECL
declarations in a single line.

* README-mpers: Update description of MPERS_PRINTER_DECL syntax.
* defs.h [IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into
a recursive variadic macro.
[!IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into a variadic macro.
All callers changed.
* Makefile.am (mpers_preproc_files, mpers_printer_decl_pattern):
New variables.
(CLEANFILES): Add $(mpers_preproc_files).
(%.c.mpers.i): New rule.
(printers.h, %_printer_decls.h, %_printer_defs.h): Use
mpers_preproc_files instead of srcdir_mpers_source_files,
use mpers_printer_decl_pattern.
* .gitignore: Add /*.mpers.i.
2016-05-21 22:53:06 +00:00
9134aab407 Prepare for transition from xlookup64 to xlookup
* fcntl.c (print_fcntl, SYS_FUNC(fcntl), SYS_FUNC(fcntl64)):
Cast 2nd argument of xlookup to unsigned long.
* prctl.c (SYS_FUNC(prctl)): Likewise.
* sched.c (SYS_FUNC(sched_getscheduler)): Likewise.
* time.c (do_adjtimex): Likewise.
* ioprio.c (sprint_ioprio): Change type of the argument
and local variables from int to unsigned int.
* keyctl.c (print_keyring_serial_number): Cast 2nd argument
of xlookup to unsigned int.
* net.c (tprint_sock_type): Change type of the argument to unsigned int.
* printmode.c (sprintmode): Likewise.
* printsiginfo.c (printsigval):  Change type of si_code argument
to unsigned int.
2016-05-14 22:05:06 +00:00
f9199ab081 printsiginfo: remove "verbose" argument
Remove erroneous use of verbose(tcp) as a printing limit
for already fetched members of siginfo_t structure.

* printsiginfo.h (printsiginfo): Remove boolean argument.
* printsiginfo.c (printsigval): Remove boolean argument, print
si_int and si_ptr members unconditionally.  All callers changed.
(print_si_info): Remove boolean argument, print si_utime and si_stime
members unconditionally.  All callers changed.
(printsiginfo): Remove boolean argument.  All callers changed.
2016-05-13 22:09:07 +00:00
76b4c33c7f ptrace: decode data argument of PTRACE_PEEKSIGINFO request
The data argument of PTRACE_PEEKSIGINFO request is a pointer
to siginfo_t array.

* printsiginfo.c (print_siginfo_t): New function.
(print_siginfo_array): New mpers printer.
* process.c (SYS_FUNC(ptrace)): Print data argument of
PTRACE_PEEKSIGINFO request using print_siginfo_array.
2016-05-13 02:36:14 +00:00
49955948fb Do not sign-extend siginfo_t.si_syscall
* printsiginfo.c (print_si_info): Explicitly cast si_syscall member
of siginfo_t that has type "int" to "unsigned int", to avoid sign
extension when passed to syscall_name function.
2016-05-12 14:35:02 +00:00
38a34c9349 Add copyright headers to some files which lack them
Before this change, all files that exist since 20th century had
copyright headers, while most files that appeared later didn't.  This
change fixes the inconsistency by adding missing copyright headers.

It doesn't mean that copyright headers became maintained.  In my view,
git history provides much better information on this subject and is much
more accurate than copyright headers.
2015-12-17 17:56:48 +00:00
Elvira Khabirova
a0b62498fd Mpersify printsiginfo_at printer
Fix multiple personalities support in parsers of ptrace,
rt_sigqueueinfo, rt_tgsigqueueinfo, rt_sigtimedwait and waitid syscalls
by converting printsiginfo_at into a mpersified printer.

* printsiginfo.c (siginfo_t): Mpersify.
(printsiginfo_at): Wrap function name into MPERS_PRINTER_DECL.
* defs.h (printsiginfo_at): Remove.
* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Use mpersified
printsiginfo_at.
* process.c (sys_ptrace): Likewise.
* wait.c (sys_waitid): Likewise.
2015-08-28 08:46:23 +00:00
Elvira Khabirova
3595f4ae15 printsiginfo.c: fix integer conversions
* printsiginfo.c (printsigsource): Print si_pid and si_uid as unsigned
integers.
(printsigval): Print si_int as signed int.
2015-08-21 21:08:30 +03:00
Mike Frysinger
d2eaf67486 signal: SIGSYS: decode si_syscall & si_arch fields
When receiving SIGSYS, the si_syscall & si_arch fields are set to known
values, so make sure we decode their values into the symbol settings.
This makes stracing seccomp failures much easier.

* defs.h (syscall_name): New prototype.
* printsiginfo.c: Include linux/audit.h and xlat/audit_arch.h.
(print_si_info): Decode si_syscall & si_arch for SIGSYS.
* syscall.c (undefined_scno_name): Delete.
(syscall_name): New function.
(trace_syscall_entering): Change undefined_scno_name to syscall_name.
(trace_syscall_exiting): Likewise.
* xlat/audit_arch.in: New file.
2015-08-18 07:51:54 +00:00
0e946ab2c2 defs.h: do not include <signal.h>
* printsiginfo.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h: Do not include <signal.h>.
(printsiginfo): Remove.
* printsiginfo.c: Include <signal.h> and "printsiginfo.h".
* strace.c: Likewise.
* sigaltstack.c: Include <signal.h>.
* signal.c: Likewise.
* sigreturn.c: Likewise.
* time.c: Likewise.
2015-07-18 00:01:40 +00:00
a528eb5b49 printsiginfo.c: use umove_or_printaddr
* printsiginfo.c (printsiginfo_at): Use umove_or_printaddr.
2015-07-18 00:01:40 +00:00
537c964fe9 signal.c: move siginfo_t parsers to a separate file
* printsiginfo.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (printsiginfo): Change second argument's type from int to bool.
* signal.c: Stop defining siginfo_t related constants.
Move inclusion of xlat/sig*_codes.h files to printsiginfo.c
(printsigsource, printsigval, printsiginfo_at): Move to printsiginfo.c.
(printsiginfo): Change second argument's type from int to bool,
split, and move to printsiginfo.c.
2015-03-27 23:41:00 +00:00