Commit Graph

351 Commits

Author SHA1 Message Date
17935497e2 Replace struct timeval with struct timespec in time measurements
This is required to implement more precise time measurements.

* Makefile.am (strace_LDADD): Add $(clock_LIBS).
* defs.h (struct tcb): Change the type of stime, dtime, and etime fields
from struct timeval to struct timespec, all users updated.
(syscall_exiting_decode, syscall_exiting_trace, count_syscall): Change
the type of "struct timeval *" argument to "struct timespec *", all
users updated.
(tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul): Rename to
ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul.  Change
the type of all "struct timeval *" arguments to "struct timespec *",
all users updated.
* util.c (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul):
Rename to ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul.
Change the type of all "struct timeval *" arguments to "struct timespec *".
* count.c (struct call_counts): Change the type of "time" field
from struct timeval to struct timespec, all users updated.
(overhead): Change type from struct timeval to struct timespec, all
users updated.
(count_syscall): Change the type of "struct timeval *" argument to
"struct timespec *".
* strace.c (printleader): Change the type of struct timeval variables
to struct timespec, call clock_gettime instead of gettimeofday.
(next_event, trace_syscall): Change the type of struct timeval variables
to struct timespec.
* syscall.c (syscall_entering_finish, syscall_exiting_decode): Call
clock_gettime instead of gettimeofday.
2018-03-20 02:30:24 +00:00
Eugene Syromyatnikov
84c03b20b4 util.c: introduce printaddr64
Sometimes, 64-bit value is expected to be interpreted as an address
(in BTRFS ioctl interface, for example).

* defs.h (printaddr64): New declaration.
* util.c (printaddr64): Rename from printaddr, change argument type
to uint64_t.
(printaddr): Turn into a thin wrapper around printaddr64.
(printnum_addr_int, printnum_addr_int64): Use printaddr64 instead of
printaddr.  printnum_addr_int64 is not used outside the cases where
kernel_long is less or equal than 64 bit currently, so this change
should be safe.
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
48feeb3723 printfd: print character/block device number in -yy mode
* util.c: Include <sys/stat.h>, <sys/sysmacros.h>,
and "largefile_wrappers.h".
(printsocket, printdev): New functions.
(printfd): Move socket matching/printing logic to printsocket.  Check
also for printdev.  Escape opening angle bracket in addition to closing angle
bracket as it can show up as a separator in printdev.
* tests/fsync-y.c: Update expected output.
* strace.1.in: Mention this.
* NEWS: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
6d36a70868 util.c: escape closing angle bracket in printfd
* util.c (printfd): Use print_quoted_string_ex instead of
print_quoted_string, specify ">" as escape_chars argument.
* tests/fsync-y.c (main): Update expected output.
* NEWS: Mention it.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
0b732f7e9d util.c: add support for additional escape characters in string_quote
Quotes are not always used to denote string limits; printfd uses angle
brackets for that, for example.  As result, mechanism for supplying
set of additional characters in order to avoid ambiguities regarding
the end of the quoted string is needed.

* defs.h (string_quote): Add escape_chars parameter.
(print_quoted_string_ex): New function prototype.
* util.c (string_quote): Add escape_chars parameter.
(print_quoted_string_ex): Rename from print_quoted_string, add
escape_chars parameter, pass it to string_quote call.
(print_quoted_string): Turn into a thin wrapper around
print_quoted_string_ex.
(printstr_ex): Pass NULL as escape_chars argument of string_quote call.
* socketutils.c (unix_parse_response): Pass NULL as escape_chars
argument of string_quote call.
* tests/print_quoted_string.c (print_octal): New function.
print_quoted_memory_ex): Use it.  Add escape_chars parameter.
(print_quoted_memory): Pass NULL as escape_chars argument
of print_quoted_memory_ex call.
* tests/tests.h (print_quoted_string_ex, print_quoted_memory_ex): Add
escape_chars parameter.
* tests/fsync-y.c: Pass NULL as escape_chars argument of
print_quoted_string_ex call.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
f6f7b82d4b Do not go full octal if the next char is '8' or '9'
* util.c (string_quote): Change the upper limit for the next character
in unabbreviated octal printing from '9' to '7'.
* tests/print_quoted_string.c (print_quoted_memory): Likewise.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
1f64f75320 util.c: reduce indentation in non-hexadecimal case in string_quote
As it is already too deep there.

* util.c (string_quote): Add string_ended label, jump there
after the loop in "if (usehex)" case.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
3c0be8d36d util.c: fix switch statement indentation in string_quote
While we are here, let's also remove unnecessary break statement
in the default case.
2018-03-01 01:00:24 +00:00
daaf8ab7fe Update copyright headers
Headers updated automatically using maint/update_copyright_years.sh
script.
2018-02-13 22:00:00 +00:00
f2bb704a92 Include <limits.h> instead of <sys/param.h>
Do not include <sys/param.h> unnecessarily as it includes <signal.h>.

* pathtrace.c: Include <limits.h> instead of <sys/param.h>.
* strace.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
* tests/getcwd.c: Likewise.
* tests/group_req.c: Likewise.
* tests/inode_of_sockfd.c: Likewise.
* tests/ip_mreq.c: Likewise.
* tests/printpath-umovestr.c: Likewise.
* tests/qual_fault.c: Likewise.
* tests/test_printpath.c: Likewise.
* tests/umovestr3.c: Likewise.
* tests/net-y-unix.c: Do not include <sys/param.h>.
* tests/net-yy-unix.c: Likewise.
2018-02-11 00:26:09 +00:00
Eugene Syromyatnikov
501611115f Add print_quoted_string flag to generate comment
Because there are never enough print_quoted_string flags.

* defs.h (QUOTE_EMIT_COMMENT): New quoting flag macro constant.
* util.c (string_quote): Emit " /* " in the beginning and " */" in the
end if QUOTE_EMIT_COMMENT is passed.
(print_quoted_string): Increase alloc_size by 7 if QUOTE_EMIT_COMMENT is
passed.
2018-01-29 14:10:10 +01:00
Eugene Syromyatnikov
b96c599af8 util: return string size in printstr
As umovestr now returns something useful, let's propagate it further.

* defs.h (printstr_ex, printpathn, printpath): Change return type from
void to int.
(printstrn, printstr): Change return type from void to int, return
printstr_ex result.
* util.c (printpathn): Return -1 on NULL addr, nul_seen (exit code of
umovestr) on success.
(printpath): Return printpathn result.
(printstr_ex): Return -1 on NULL addr, umoven/umovestr result otherwise.
2018-01-19 22:45:34 +00:00
Eugene Syromiatnikov
bf2e6250bb Pass tcp argument to get_optmem_max/read_int_from_file
In preparation to passing tcp to all tracee-related syscalls.

* defs.h (read_int_from_file): Add "struct tcb *" as the first argument.
* util.c (read_int_from_file): Likewise.
* msghdr.c (get_optmem_max): Add "struct tcb *tcp" as the first
argument, pass it to read_int_from_file call.
(decode_msg_control): Pass tcp to get_optmem_max.
2018-01-07 16:46:32 +00:00
ed22f8e219 util.c: use x*sprintf instead of s*printf
* util.c: Include "xstring.h".
(sprinttime_ex): Replace snprintf with xsnprintf.
(getfdproto): Replace sprintf with xsprintf.
2018-01-07 00:05:42 +00:00
Edgar Kaziakhmedov
b1fab45b47 Move string_to_uint* functions to a separate file
Make string_to_uint* functions available to other binaries
included in the strace package.

* string_to_uint.h: New file.
* defs.h: Include it.
(string_to_uint_ex, string_to_uint_upto, string_to_uint): Move
to string_to_uint.h.
* util.c (string_to_uint_ex, string_to_uint): Move ...
* string_to_uint.c: ... to the new file.
* Makefile.am (strace_SOURCES): Add string_to_uint.h and string_to_uint.c.

Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-22 15:24:05 +00:00
d7a45f8dcc printpath: do not fetch more than PATH_MAX bytes from tracee's memory
The kernel does not copy more than PATH_MAX bytes from userspace
pathnames, treating non-NUL-terminated pathnames as ENAMETOOLONG.

* util.c (printpathn): Decrease buffer size to PATH_MAX.
(printpath): Specify PATH_MAX - 1 as the maximum pathname length
to match the kernel behaviour.  The underlying umovestr call will fetch
up to PATH_MAX bytes from tracee's memory, but no more than first
PATH_MAX - 1 bytes will be printed.
2017-08-01 20:59:48 +00:00
429c08130b util: move umoven and umovestr to a separate file
These functions are more kernel-specific compared to all other functions
defined in util.c.

* ucopy.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* util.c (umoven, umovestr): Move to ucopy.c.
2017-07-28 10:24:35 +00:00
de484eced5 Introduce print_quoted_cstring
In many places where kernel expects a NUL-terminated string of length
up to a known fixed limit, e.g. when a NUL-terminated string is
a fixed-size field of a structure, strace does not print the last byte
assuming it is NUL, which is not always the case.

Change output format for such strings to distinguish NUL-terminated
strings from non-NUL-terminated ones: append ellipsis to the output
when the string is not NUL-terminated.

* defs.h (print_quoted_cstring): New prototype.
* util.c (print_quoted_cstring): New function.
(printpathn): Use it instead of print_quoted_string with
QUOTE_0_TERMINATED argument.
* print_fields.h (PRINT_FIELD_CSTRING): Likewise.
* btrfs.c (btrfs_ioctl): Likewise.
* dirent.c (SYS_FUNC(getdents)): Likewise.
* dirent64.c (SYS_FUNC(getdents64)): Likewise.
* print_ifindex.c (print_ifindex): Likewise.
* sysmips.c (SYS_FUNC(sysmips)): Likewise.
* ubi.c (ubi_ioctl): Likewise.
* tests/tests.h (print_quoted_cstring): New prototype.
* tests/print_quoted_string.c (print_quoted_cstring): New function.
* tests/ioctl_block.c (main): Update expected output.
* tests/ioctl_dm.c (main): Likewise.
* tests/ioctl_loop.c (print_loop_info, print_loop_info64): Likewise.
* tests/netlink_crypto.c (test_crypto_msg_newalg): Likewise.
2017-07-24 12:10:54 +00:00
11621507fb Check -s argument early
* util.c (printstr_ex): Move the check that -s argument
does not exceed -1U / 4 ...
* strace.c (init): ... here.
* tests/options-syntax.test: Check it.
2017-06-26 22:30:19 +00:00
184e94ba05 Fix a few spacing style issues
Reported by kernel's checkpatch.pl script.
2017-06-17 22:54:08 +00:00
3baf7ef953 Fix a few initialization style issues
Do not initialise statics and globals to 0, NULL, or false.

Reported by kernel's checkpatch.pl script.
2017-06-17 20:49:09 +00:00
a74c084611 Fix a few sizeof style issues
Reported by kernel's checkpatch.pl script.
2017-06-17 18:49:58 +00:00
88a34fa6da Move xlat related functions to a separate file
* util.c (xlookup, xlat_bsearch_compare, xlat_search, printxvals,
printxval_searchn, addflags, sprintflags, printflags_ex): Move ...
* xlat.c: ... to this new file.
* Makefile.am (strace_SOURCES): Add it.
2017-06-12 16:44:45 +00:00
127962f217 Introduce printflags_ex function
Add printflags_ex extension over printflags64 that, similar
to printxvals, takes a NULL-terminated sequence of xlat pointers.

* defs.h (printflags_ex): New prototype.
(printflags64): Turn into a thin wrapper around printflags_ex.
* netlink.c (decode_nlmsg_flags): Use printflags_ex.
* util.c (printflags_ex): New function.
(printflags64): Remove.
* xlat/netlink_get_flags.in: Remove entries listed
in xlat/netlink_flags.in file.
* xlat/netlink_new_flags.in: Likewise.
2017-06-08 22:26:46 +00:00
Fabien Siron
f26c22d8b2 Introduce getfdinode to obtain inode from fd
* defs.h (getfdinode): New prototype.
* utils.c (getfdinode): New function.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-05 11:52:11 +00:00
e16bdb1bb9 Unexport print_sockaddr_by_inode_cached
Change print_sockaddr_by_inode to be the only function exposed,
hide print_sockaddr_by_inode_cached as a part of implementation.

* defs.h (print_sockaddr_by_inode_cached): Remove prototype.
(print_sockaddr_by_inode): Add struct tcb * and descriptor arguments.
* socketutils.c (print_sockaddr_by_inode_cached): Make static.
(print_sockaddr_by_inode): Rename to print_sockaddr_by_inode_uncached,
make static.
(print_sockaddr_by_inode): New function.
* util.c (printfd): Update to use new print_sockaddr_by_inode.
2017-06-03 17:52:24 +00:00
1459d07f94 Introduce str_strip_prefix_len function and STR_STRIP_PREFIX macro
Address proliferation of string prefix check implementations.

* defs.h (str_strip_prefix_len): New inline function.
(STR_STRIP_PREFIX): New macro.
* qualify.c (strip_prefix): Remove.
(parse_inject_token): Use STR_STRIP_PREFIX instead of strip_prefix.
(qualify): Use str_strip_prefix_len.
* socketutils.c (netlink_parse_response): Likewise.
* util.c (printfd): Likewise.
2017-06-03 16:55:12 +00:00
Eugene Syromyatnikov
9d095c7860 Add copyright headers 2017-05-22 17:33:51 +00:00
Eugene Syromyatnikov
3277a2370a Always print raw values of time data fields
Refactor sprinttime: implement sprinttime_nsec and sprinttime_usec
that handle nanoseconds and microseconds, respectively.
Always print raw values of time data fields, format string
representations of time as comments.

* defs.h (sprinttime): Change argument type from time_t to long long.
(sprinttime_nsec, sprinttime_usec): New prototypes.
* util.c (sprinttime_ex, sprinttime_nsec, sprinttime_usec): New
functions.
(sprinttime): Turn into a thin wrapper around sprinttime_ex.
* stat.h (struct strace_stat): Add has_nsec field.
* fetch_struct_stat.c (HAVE_NSEC): New macro.
(fetch_struct_stat): Initialize has_nsec field with HAVE_NSEC.
* fetch_struct_stat64.c (HAVE_NSEC): New macro.
(fetch_struct_stat64): Initialize has_nsec field with HAVE_NSEC.
* print_struct_stat.c (print_struct_stat) <PRINT_ST_TIME>:
Print raw values of time fields, use sprinttime_nsec to format a string
representation of time, use tprints_comment to print it as a comment.
* statx.c (SYS_FUNC(statx)) <PRINT_FIELD_TIME>: Likewise.
* utime.c (SYS_FUNC(utime)): Print raw values of struct utimbuf.actime
and struct utimbuf.modtime fields, use sprinttime to format a string
representation of time, use tprints_comment to print it as a comment.
* tests/tests.h (print_time_t_nsec): Add int argument.
* tests/print_time.c (print_time_t_ex): New function.
(print_time_t_nsec): Add int argument, turn into a thin wrapper around
print_time_t_ex.
* tests/utime.c (main): Update expected output.
* tests/xstatx.c [!IS_STATX] (HAVE_NSEC): New macro.
[!IS_STATX] (PRINT_ST_TIME), [IS_STATX] (PRINT_FIELD_TIME): Update
expected output.
* NEWS: Mention this timestamps representation improvement.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-04-24 23:14:57 +00:00
c34952709d Introduce tprintf_comment and tprints_comment functions
* defs.h (tprintf_comment, tprints_comment): New prototypes.
* strace.c (tvprintf): New function.
(tprintf): Use it.
(tprintf_comment, tprints_comment): New functions.
* aio.c (tprint_lio_opcode): Use tprints_comment.
* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
dm_decode_dm_name_list, dm_decode_dm_target_versions,
dm_decode_dm_target_msg, dm_decode_string, dm_known_ioctl): Likewise.
* futex.c (SYS_FUNC(futex)): Likewise.
* perf.c (print_perf_event_attr): Likewise.
* seccomp.c (decode_bpf_code): Likewise.
* util.c (printxvals, printxval_searchn, printflags64): Likewise.
* btrfs.c (print_u64, btrfs_print_key_type, btrfs_print_objectid,
print_key_value_internal): Likewise.
(btrfs_ioctl): Use tprints_comment and tprintf_comment.
* dirent.c (SYS_FUNC(getdents)): Likewise.
* dirent64.c (SYS_FUNC(getdents64)): Likewise.
* execve.c (printargc): Use tprintf_comment.
* tests/btrfs.c (btrfs_test_get_dev_stats_ioctl,
btrfs_test_features_ioctls): Update expected output.
2017-04-24 19:31:54 +00:00
Eugene Syromyatnikov
0f07b184c8 util: return pointer to string literal directly in sprinttime
There is no sense to copy it to static buffer first.

* util.c (sprinttime): Just return "0", do not copy it to internal
buffer first.
2017-04-21 21:57:56 +00:00
a8d2417e97 aarch64: workaround gcc+kernel bug
Due to a subtle gcc bug that leads to miscompiled aarch64 kernels,
the 3rd argument of sched_getattr syscall is not quite 32-bit
on aarch64 as on other architectures.  For more details see
https://sourceforge.net/p/strace/mailman/message/35721703/

* defs.h (print_abnormal_hi): New prototype.
* util.c (print_abnormal_hi): New function.
* sched.c (SYS_FUNC(sched_getattr)) [AARCH64]: Use it.
* tests/sched_xetattr.c (main) [__arm64__ || __aarch64__]: Test it.
2017-03-29 18:27:14 +00:00
Victor Krapivensky
c9731a0dbe util.c: remove a wrong comment
4924dbd6d7 modified the return type, but
not the comment.
2017-03-13 15:19:22 +00:00
Eugene Syromyatnikov
34a920baad util: add support for forcing printing string as hex-escaped
This could be useful in cases when some binary data should not be
interpreted as an ASCII string, but rather as an array of byte values.

* defs.h (QUOTE_FORCE_HEX): New macro constant.
* util.c (quote_string): Enable use_hex when QUOTE_FORCE_HEX is set
in user_style parameter.
2017-01-06 11:39:54 +00:00
b58f75c5d4 Remove checks of __NR_* availability from strace source code
* strace.c: Remove __NR_tkill checks, assume it is always defined.
* util.c: Remove __NR_process_vm_readv checks and fallback definitions,
assume it is always defined.
2017-01-03 13:46:26 +00:00
2dd365f912 Include "scno.h" in files that check __NR_* constants
* strace.c: Include "scno.h".
* util.c: Likewise.
2017-01-03 11:27:35 +00:00
326b98927a defs.h: stop including <asm/unistd.h>
Limit the number of files where <asm/unistd.h> is included
to only those few that need it.

* defs.h: Do not include <asm/unistd.h>.
* clone.c: Include <asm/unistd.h>.
* strace.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
2016-12-31 22:12:08 +00:00
f91679316b Introduce ANY_WORDSIZE_LESS_THAN_KERNEL_LONG macro
* defs.h (ANY_WORDSIZE_LESS_THAN_KERNEL_LONG): New macro.
(truncate_klong_to_current_wordsize,
truncate_kulong_to_current_wordsize): Use it.
* mem.c (SYS_FUNC(old_mmap)): Likewise.
* util.c (umoven, umovestr, dumpiov_upto): Likewise.
* syscall.c (trace_syscall_exiting): Likewise.
2016-12-27 01:08:58 +00:00
4e29ada846 Simplify getllval ifdefery
The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
implementation.

* util.c (getllval): Merge [SIZEOF_LONG > 4
&& SIZEOF_LONG == SIZEOF_LONG_LONG]
and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
into a single [SIZEOF_KERNEL_LONG_T > 4] case.
2016-12-26 16:54:31 +00:00
Eugene Syromyatnikov
c9000d43bd Add functions for printing pointers of kernel_ulong_t size
In cases where no compat for x32/n32 is implemented, pointer is of
kernel's long size, so it should be printed appropriately.

* defs.h [!current_klongsize] (printnum_addr_klong_int): New prototype.
(printnum_kptr): New macro.
* util.c [!current_klongsize] (printnum_addr_klong_int): New function.
2016-12-26 15:32:48 +00:00
Eugene Syromyatnikov
3b4612b3ac Print indirect pointers as pointers
Originally, printnum_long_int was used, but it prints NULL incorrectly.

* defs.h (DECL_PRINTNUM_ADDR): New macro.
(DECL_PRINTNUM_ADDR(int), DECL_PRINTNUM_ADDR(int64)): New prototypes.
[!current_wordsize] (printnum_addr_long_int): New prototype.
[!current_wordsize] (printnum_ptr): Use it.
[current_wordsize > 4] (printnum_ptr): Use printnum_addr_int64.
[current_wordsize == 4] (printnum_ptr) Use printnum_addr_int.
* util.c (DEF_PRINTNUM_ADDR): New macro.
(DEF_PRINTNUM_ADDR(int, unsigned int),
DEF_PRINTNUM_ADDR(int64, uint64_t)): New macro instantiations that
provide printnum_addr_int and printnum_addr_int64, accordingly.
[!current_wordsize] (printnum_addr_long_int): New function.
* xet_robust_list.c (sprintaddr): New function.
(main): Use it, update expected output.
* tests/ipc_sem.c (main): Update expected output.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-26 15:29:06 +00:00
3fb2f299d2 Do not define printnum_long_int on systems with constant current_wordsize
* defs.h: Check [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to select
definitions of printnum_slong, printnum_ulong, and printnum_ptr.
* util.c: Check [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to decide
whether to compile printnum_long_int.
2016-12-26 13:50:14 +00:00
825acc827e umoven: detect invalid addresses
Do not silently truncate tracee addresses to current_wordsize.
After transition from long to kernel_ulong_t there should be no sign
extension issues with tracee addresses, and invalid addresses should
be printed properly.

* util.c (umoven): Check [SIZEOF_KERNEL_LONG_T > 4] instead
of [SIZEOF_LONG > 4], reject addresses that do not fit into
current_wordsize.
* tests/umoven-illptr.c: New file.
* tests/umoven-illptr.test: New test.
* tests/.gitignore: Add umoven-illptr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add umoven-illptr.test.
2016-12-26 13:18:00 +00:00
ac300dd2d9 umovestr: detect invalid addresses
Do not silently truncate tracee addresses to current_wordsize.
After transition from long to kernel_ulong_t there should be no sign
extension issues with tracee addresses, and invalid addresses should
be printed properly.

* util.c (umovestr): Check [SIZEOF_KERNEL_LONG_T > 4] instead
of [SIZEOF_LONG > 4], reject addresses that do not fit into
current_wordsize.
* tests/umovestr-illptr.c: New file.
* tests/umovestr-illptr.test: New test.
* tests/.gitignore: Add umovestr-illptr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add umovestr-illptr.test.
2016-12-26 12:16:38 +00:00
a1e94e9c7a Remove HAVE_STRUCT_TCB_EXT_ARG, ext_arg, and u_lrval
After transition from long to kernel_ulong_t these fields
are no longer needed.

* defs.h (HAVE_STRUCT_TCB_EXT_ARG): Remove.
(struct tcb) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
[HAVE_STRUCT_TCB_EXT_ARG]: Remove.
(RVAL_MASK): Update.
* io.c (print_lld_from_low_high_val): Check
[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].
Use u_arg instead of ext_arg.
* linux/mips/get_error.c (get_error) [LINUX_MIPSN32]: Remove.
* linux/mips/get_syscall_args.c (get_syscall_args) [LINUX_MIPSN32]:
Remove.
[LINUX_MIPSN64]: Extend to [LINUX_MIPSN32].
* linux/x86_64/get_error.c (get_error) [X32]: Remove.
* linux/x86_64/get_syscall_args.c (get_syscall_args) [X32]: Remove.
* lseek.c: Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].
[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] (SYS_FUNC(lseek)): Use u_arg
instead of ext_arg.  Use RVAL_UDECIMAL instead of RVAL_LUDECIMAL.
* mem.c (SYS_FUNC(mmap)): Pass offset syscall argument directly
to print_mmap.
* syscall.c (trace_syscall_exiting) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
* times.c (SYS_FUNC(times)): Use RVAL_UDECIMAL instead
of RVAL_LUDECIMAL.
* util.c (getllval): Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].  Use u_arg instead of ext_arg.
2016-12-26 10:43:35 +00:00
50b50e78f6 Remove getarg_klu
After transition from long to kernel_ulong_t we no longer need
tcp->ext_arg, and therefore a function to access it is also no longer
needed.

* defs.h (getarg_klu): Remove prototype.
* util.c (getarg_klu): Remove.
(printargs): Access tcp->u_arg directly
* bjm.c (SYS_FUNC(init_module)): Likewise.
* clone.c (SYS_FUNC(unshare)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Likewise.
* kexec.c (SYS_FUNC(kexec_file_load)): Likewise.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mem.c (do_mprotect): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Likewise.
2016-12-26 10:43:35 +00:00
8aab60e8d3 Remove printaddr_klu
After transition from long to kernel_ulong_t we no longer need
two versions of printaddr function.

* defs.h (printaddr): Remove.
(printaddr_klu): Rename to printaddr.
* util.c (printaddr_klu): Likewise.
* bjm.c (SYS_FUNC(init_module)): Replace printaddr_klu with printaddr.
* mem.c (do_mprotect): Likewise.
2016-12-26 10:43:35 +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