summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Use call via structure only when multiple tracing backends are availableesyr/gdbserver-prep--rebasedEugene Syromiatnikov2019-05-216-4/+103
| | | | | | | | | | | | | | | | | | | | | | | | Since dispatching function calls via the tracing backend structure definitely imposes some overhead, let's try to minimise it for the (pretty common) case of having only one tracing backend available. * configure.ac (additional_tracing_backends): New m4 variable. (ADDITIONAL_TRACING_BACKENDS): New AC_DEFINE, equal to additional_tracing_backends. * ptrace_backend.c: Put ptrace_backend definition under "#if ADDITIONAL_TRACING_PACKENDS". * ptrace_backend.h: Put ptrace_backend declaration under "#if ADDITIONAL_TRACING_PACKENDS". * tcb_wait_data.h [!ADDITIONAL_TRACING_PACKENDS]: Provide macros for aliasing trace_wait_data_size, init_trace_wait_data, copy_trace_wait_data, and free_trace_wait_data to ptrace-based tracing backend definitions. * tracing_backend.c: Put the contents, except local_open, under #if ADDITIONAL_TRACING_PACKENDS. * tracing_backend.h: Put the contents (except local_open) under #if ADDITIONAL_TRACING_PACKENDS, provide macros for all the inline functions that alias them to the respective functions in the ptrace-based tracing backend in the opposite case.
* Introduce tracing backend abstraction layer (TraBAL, for short)Eugene Syromiatnikov2019-05-2117-116/+973
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So, all the ptrace-specific routines are now getting "ptrace_" prefix. Wrappers for the old routines are provided, that call appropriate method based on current tracing backend selection. Some auxiliary functions are provided for getting backend name and selecting backend. Based on "Implement gdbserver using backend dispatch table." and "Add defaults for all backend methods." commits by Stanford Cox. * Makefile.am (strace_SOURCES): Add ptrace_backend.c, ptrace_backend.h, ptrace_wait_data.h, tcb_wait_data.h, tracing_backend.c, tracing_backend.h. * defs.h: Add struct tcb_wait_data forward declaration; include tracing_backend.h. (generic_get_instruction_pointer): Rename from get_instruction_pointer, the latter is now defined in tracing_backend.h. (generic_get_stack_pointer): Rename from get_stack_pointer, the latter is now defained in tracing_dackend.h. (clear_regs, get_scno, umoven, umovestr, upeek, upoke): Remove declarations, they are now defined in tracing_backend.h. * pathtrace.c (getfdpath): Change readlink call to tracee_readlink. (pathtrace_select_set): Change realpath call to tracee_realpath. * ptrace_backend.c: New file. * ptrace_backend.h: Likewise. * ptrace_wait_data.h: Likewise. * tcb_wait_data.h: Likewise. * tracing_backend.c: Likewise. * tracing_backend.h: Likewise. * strace.c: Include "tcb_wait_data.h", "ptrace_wait_data.h". (struct tcb_wait_data): Move to tcb_wait_data.h. (struct ptrace_wait_data, to_ptrace_wait_data): Move to ptrace_wait_data.h. (detach, cleanup): Remove declarations (they are a part of tracing_backend.h now). (detach, attach_tcb, startup_child, init_trace_wait_data, copy_trace_wait_data, free_trace_wait_data, next_event, handle_group_stop, handle_exec, restart_process): Add "ptrace_" prefix. Remove static qualifier. (tracing_backend_init): Rename to ptrace_init. (tracing_backend_name): Remove. (trace_wait_data_size): Remove, it is now defined in tracing_backend.h. (init): Call tracing_backend_post_init() at the end of the routine. * syscall.c (get_regs, get_syscall_args, get_syscall_result. get_error, set_scno, set_error, set_success): Remove declarations (they are part of tracing_backend.h now). (clear_regs, get_regs, get_scno, set_scno, set_error, set_success, get_syscall_args, get_syscall_result, get_syscall_regs, ): Add "ptrace_" prefix, remove static qualifier. (get_instruction_pointer): Split into ptrace_get_instruction_pointer and generic_get_instruction_pointer. (get_stack_pointer): Split into ptrace_get_stack_pointer and generic_get_stack_pointer. * ucopy.c (umoven, umovestr): Add "ptrace_" prefix. * upeek.c (upeek): Likewise. * upoke.c (upoke): Likewise. * socketutils.c (send_query): Replace sendmsg call with tracee_sendmsg. (receive_responses): Replace recvmsg call with tracee_recvmsg. (get_sockaddr_by_inode_uncached, genl_families_xlat): Replace socket call with tracee_socket. * util.c (getfdproto): Replace getxattr call with tracee_getxattr. (open_file): Move to is part of ptrace_backend.c. (read_int_from_file): Replace open_file call with tracee_open. Replace read call with tracee_pread. Replace close call with tracee_close. Co-Authored-by: Stan Cox <scox@redhat.com>
* tests: add additional tests for strace's -E behaviourEugene Syromyatnikov2019-05-214-0/+36
| | | | | | | | | * tests/Makefile.am (MISC_TESTS): Add strace-E-override.test, strace-E-unset.test. (EXTRA_DIST): Add strace-E-unset.expected. * tests/strace-E-override.test: New test. * tests/strace-E-unset.test: Likewise. * tests/strace-E-unset.expected: New file.
* strace.c: construct and pass environment to startup_childEugene Syromyatnikov2019-05-211-5/+138
| | | | | | | | | | | | | | | | | | | | | The current approach with putenv() during parsing has two problems: - it changes tracer's own environment which may affect its behaviour and may be undesirable; - it's specific to ptrace tracing backend. As a solution, let's apply an approach similar to path tracing option parsing: collect the provided optarg's in an array and then pass it to tracing-backend-specific routines. * strace.c (struct exec_params): Add env field. (exec_or_die): Call execve() instead of execv(); pass params->env as the third argument. (startup_child): Add env parameter, set params_for_tracee.env to it. (add_to_env, make_env): New functions. (init): Add env_changes, env_change_size, env_change_count local variables; store optarg in env_changes array on -E option occurrence; construct new environment using make_env and pass it to startup_child in the second argument.
* tests: add support for negative match patterns to match_grepEugene Syromyatnikov2019-05-211-2/+15
| | | | | | | | | For the cases when we want that some patterns do not appear in the output. * tests/init.sh (match_grep): Add res and negated local variables; set negated to 1 if pattern starts with "!", otherwise to 0; fail if negated pattern has been matched.
* Use xzalloc(sz) instead of xcalloc(1, sz)Eugene Syromyatnikov2019-05-215-5/+5
| | | | | | | | | * aux_children.c (register_aux_child_ex): Use xzalloc instead of xcalloc of one-item-sized array. * bpf.c (BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Likewise. * kvm.c (vcpu_alloc): Likewise. * perf.c (fetch_perf_event_attr): Likewise. * syscall.c (ptrace_get_scno): Likewise.
* xmalloc: add zero-initialisation counterparts for xmalloc and xcallocEugene Syromyatnikov2019-05-212-1/+36
| | | | | | | | | | Specifically, array allocation without zero memory initialisation and xmalloc with zero memory initialisation. * xmalloc.c (xallocarray): New function. * xmalloc.h (xcalloc): Document the function. (xallocarray): New function declaration. (xzalloc): New function, wrapper for xcalloc with xmalloc interface.
* strace.c: print resolved path name when startup child's stat has failedEugene Syromyatnikov2019-05-211-1/+2
| | | | | * strace.c (ptrace_startup_child): Print resolved pathname in the stat error message.
* syscall.c: wrap arch_set_scno in TraBAL-specific wrapperEugene Syromiatnikov2019-05-211-1/+9
| | | | | | * syscall.c (tamper_with_syscall_entering): Change arch_set_scno call to set_scno. (set_scno): New function.
* Pass tcp argument to pathtrace_select_setEugene Syromiatnikov2019-05-213-5/+5
| | | | | | | | As it will pass tcp to tracee-related syscalls. * defs.h (pathtrace_select_set, pathtrace_select): Add tcp argument. * pathtrace.c (pathtrace_select_set): Likewise. * strace.c (init): Pass current_tcp to pathtrace_select call.
* strace.c: move ptrace-specific parts out of dispatch_eventEugene Syromyatnikov2019-05-211-132/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dispatch_event is mostly neutral to a tracing backends, except for some parts. Let's move them into separate functions and call them from it. Also, while we are here, let's pass an opaque pointer to next_event and these new functions, so a tracing backend is able to carry some tracing loop state (like siginfo and restart_op, in case of ptrace) there. * strace.c (struct tcb_wait_data): Remove msg and status fields (as those are specific to tracing backend), ass sig, exit, and core_dumped fields. (struct ptrace_wait_data): New type. (to_ptrace_wait_data): New macro. (tcb_wait_tab): Change type to struct ptrace_wait_data *. (maybe_switch_tcbs): Change the second argument to struct tcb_wait_data *wd, use to_ptrace_wait_data(wd)->msg to obtain previously stored PTRACE_GETEVENTMSG result, use tcp->pid instead of pid, avoid tcp = execve_thread assignment. (print_signalled): Change the third argument to struct tcb_wait_data *wd, use wd->sig instead of WTERMSIG(status). (print_exited): Rename second argument to exit, use it directly instead of WEXITSTATUS(status). (trace_wait_data_size): Return sizeof(struct ptrace_wait_data) instead of sizeof(struct tcb_wait_data). (init_trace_wait_data): Initialise struct ptrace_wait_data: set ptrace_wd->restart_op to PTRACE_SYSCALL; return pointer to the wd field. (copy_trace_wait_data): Copy containing struct ptrace_wait_data instead of struct tcb_wait_data. (free_trace_wait_data): Free containing struct ptrace_wait_data. (next_event): Change type of wd to struct ptrace_wait_data; initialise wd->wd.sig and wd->wd.core_dumped on WIFSIGNALED(status); initialise wd->wd.exit on WIFEXITED(status); initialise wd->wd.sig on ptrace event being 0 or PTRACE_EVENT_STOP with signal being one of SIGSTOP, SIGTSTP, SIGTTIN, or SIGTTOU. (classify_ptrace_stop, handle_exec, restart_process): New functions. (dispatch_event): Remove restart_op, restart_sig, status; use wd->sig instead of restart_sig; pass wd to print_signalled. (dispatch_event) <case TE_GROUP_STOP>: Move ptrace-specific code to classify_group_stop, call it from next_event instead. (dispatch_event) <case TE_STOP_BEFORE_EXECVE>: Move ptrace-specific code to handle_exec. (dispatch_event): Replace ptrace_restart call with restart_process call.
* strace.c: move argc+daemonized check to tracing_backend_initEugene Syromiatnikov2019-05-211-4/+3
| | | | | | | This check is also specific to the ptrace tracing backend. * strace.c (init): Mave !argc && daemonized_tracer check... (tracing_backend_init): ...here.
* strace.c: move argc/nprocs check to the tracing_backend_init routineEugene Syromiatnikov2019-05-212-5/+7
| | | | | | | | | | | | It is deemed that for some tracing backends it is possible to run strace without providing either program to run or PIDs to attach (attaching to already running GDB server with existing inferiors is an example). Thus, let's move this check to tracing_backend_init. * strace.c (tracing_backend_init): Add (!nprocs && !argc) check. (init): Remove (!nprocs && !argc) check, update error message for (argc < 0) check. * tests/options-syntax.test: Update expected output.
* strace.c: move ptrace backend initialisation into a separate routineEugene Syromiatnikov2019-05-211-10/+24
| | | | | | | | | In a preparation to TraBAL introduction. * strace.c (tracing_backend_init): New function. (tracing_backend_name): New macro. (init): Move OS release detection, ptrace_setoptions initialisation, and PTRACE_SEIZE/PTRACE_GET_SYSCALL_INFO tests to tracing_backend_init.
* strace.c: move pathtrace_select calls to a later initialisation stageEugene Syromiatnikov2019-05-211-1/+22
| | | | | | | | | | | | | Since pathtrace initialisation (more speicifically, path name resolution) is specific to the tracing backend (especially in case tracees are remote), let's first collect the list of paths to trace in a temporary array and add it later during the initialisation. * strace.c (init): Add pathtrace_paths temporary array, with its element count stored in pathtrace_count and size in pathtrace_size. (init) <case 'P'>: Store argument in pathtrace_paths, grow it if needed. (init): Iterate over pathtrace_paths and call pathtrace_select for each element. Free the array.
* strace.c: use aux_children interface for handling strace_popen'ed childEugene Syromiatnikov2019-05-211-14/+22
| | | | | | | | | | | | | | | | Now, when we have generic auxiliary children handling interface, we can implement it once and then add additional children with register_aux_child call, without disturbing main strace code. * strace.c: Include "aux_children.h" (popen_pid): Remove. (strace_popen): Provide resulting PID as an argument to register_aux_child instead of storing it in popen_pid. (next_event): Check for the presence of additional children with have_aux_children. Handle stops of auxiliary children with aux_children_signal. (terminate): Use aux_children_exit_notify and aux_children_exit_wait instead of manually waiting on popen_pid.
* Introduce an API for handling spawned auxiliary childrenEugene Syromiatnikov2019-05-213-0/+274
| | | | | | | | | | One of gdbserver backend features is to spawn a GDB server. The handling of this child process is more or less similar to strace_popen'ed child, so let's generalise it. * aux_children.c: New file. * aux_children.h: Likewise. * Makefile.am (strace_SOURCES): Add them.
* strace.c: implement a routine for creating a child connected with a pipeEugene Syromiatnikov2019-05-211-28/+100
| | | | | | | | | | | | | | | This routine also utilises posix_spawn_* calls in an attempt to avoid common pitfalls associated with vfork execution on no-MMU systems. The implementation is based on a part of original gdbserver backend support code by Josh Stone (commit "Add -G support for files and piped commands"). * strace.c (ZERO_OR_DIE): New macro. (strace_pipe_exec): New function. (strace_popen): Rewrite as a wrapper for strace_pipe_exec. Co-Authored-by: Josh Stone <jistone@redhat.com>
* Introduce next_setqual_scno (needed for gdbserver backend)Eugene Syromiatnikov2019-05-214-0/+78
| | | | | | | | | | | | | During initialisation, gdbserver backend enumerates all the syscall numbers enabled for tracing and asks GDB server to stop only on the specified syscall numbers. Since number_set interface is now opaque, we provide an ability to enumerate all the syscall numbers that are enabled. * defs.h (next_set_qual_scno): New declaration. * number_set.h (next_set_bit_in_set_array): Likewise. * filter_qualify.c (next_set_qual_scno): Implement it. * number_set.c (next_set_bit_in_set_array): Likewise.
* strace.c: pre-allocate tcb on PTRACE_EVENT_{FORK,VFORK,CLONE}Eugene Syromyatnikov2019-05-212-12/+59
| | | | | | | | | | | | | | In an attempt to resolve a race between the first stop of a new child and the death of the last process. * defs.h (TCB_PREALLOCATED): New constant. * strace.c (pid2tcb): Add skip_preallocated parameter. (maybe_allocate_tcb): Add tcp parameter, use it instead of allocating a new tcp if it is not NULL. (maybe_switch_tcbs): Pass true as a second argument to pid2tcb. (next_event): Pass tcp to maybe_switch_tcbs if it is pre-allocated, pre-allocate a tcb on PTRACE_EVENT_{FORK,VFORK,CLONE} if followfork is enabled and we successfully retrieved the new pid.
* Rename the stat struct used internally by strace to strace_stat_tEugene Syromyatnikov2019-05-213-4/+4
|
* Move open_file to largefile_wrappers.hEugene Syromyatnikov2019-05-212-6/+6
| | | | | * util.c (open_file): Move it... * largefile_wrappers.h (open_file): ...here.
* xmalloc: add ability to specify desired minimum size for xgrowarrayEugene Syromyatnikov2019-05-212-5/+17
| | | | | | | | | * xmalloc.h (xgrowarray_ex): Rename from xgrowarray, add min_memb parameter. (xgrowarray): New static inline function, wrapper for xgrowarray_ex. * xmalloc.c: Include "macros.h". (xgrowarray_ex): Rename from xgrowarray, add min_memb, increase array size to the maximum of min_memb and old size + grow_memb.
* Update copyright headersDmitry V. Levin2019-05-2140-40/+40
| | | | | Headers updated automatically using maint/update_copyright_years.sh script.
* tests: robustify bpf-obj_get_info_by_fd test against future kernelsDmitry V. Levin2019-05-211-2/+2
| | | | | | * tests/bpf-obj_get_info_by_fd.c (print_prog_load, main): Change log_level from 42 to 7, to placate Linux kernels containing commit v5.2-rc1~133^2~193^2~18^2~9.
* bpf: add support for new fields in struct bpf_prog_infoDmitry V. Levin2019-05-214-1/+22
| | | | | | | | | * bpf_attr.h (struct bpf_prog_info_struct): Add run_time_ns and run_cnt fields. * bpf.c (print_bpf_prog_info): Decode run_time_ns and run_cnt fields introduced by Linux kernel commit v5.1-rc1~178^2~17^2~15^2~2. * NEWS: Mention it. * tests/bpf-obj_get_info_by_fd.c (main): Update expected output.
* xlat: update FAN_* constantsDmitry V. Levin2019-05-212-7/+9
| | | | | | * xlat/fan_mark_flags.in (FAN_MARK_FILESYSTEM): New constant introduced by Linux kernel commit v4.20-rc1~75^2~10. * tests/fanotify_mark.c (main): Update expected output.
* xlat: update IPV6_* constantsDmitry V. Levin2019-05-212-1/+3
| | | | | | | | * xlat/sock_ipv6_options.in (IPV6_MULTICAST_ALL): New constant introduced by Linux kernel commit v4.20-rc1~14^2~384. (IPV6_ROUTER_ALERT_ISOLATE): New constant introduced by Linux kernel commit v5.1-rc1~178^2~22. * NEWS: Mention this.
* xlat: update F_SEAL_* constantsDmitry V. Levin2019-05-212-1/+3
| | | | | | * xlat/f_seals.in (F_SEAL_FUTURE_WRITE): New constant introduced by Linux kernel commit v5.1-rc1~152^2~49. * NEWS: Mention this.
* btrfs: implement decoding of BTRFS_IOC_FORGET_DEV argumentDmitry V. Levin2019-05-212-0/+14
| | | | | | | | | ... introduced by Linux kernel commit v5.1-rc1~47^2~47. * btrfs.c (btrfs_ioctl) [BTRFS_IOC_FORGET_DEV]: Handle BTRFS_IOC_FORGET_DEV. * tests/btrfs.c (btrfs_test_device_ioctls) [BTRFS_IOC_FORGET_DEV]: Check it.
* Update ioctl entries from linux v5.1Gleb Fotengauer-Malinovskiy2019-05-217-1/+88
| | | | | | | | | | | | | * linux/32/ioctls_inc_align16.h: Update from linux v5.1 using ioctls_gen.sh. * linux/32/ioctls_inc_align32.h: Likewise. * linux/32/ioctls_inc_align64.h: Likewise. * linux/64/ioctls_inc.h: Likewise. * linux/x32/ioctls_inc0.h: Likewise. * NEWS: Mention this. * tests/ioctl_random.c (main): Update expected output. Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
* xlat: update FAN_* constantsDmitry V. Levin2019-05-205-20/+46
| | | | | | | | | | | * xlat/fan_init_flags.in (FAN_REPORT_FID): New constant introduced by Linux kernel commit v5.1-rc1~139^2~18. * xlat/fan_event_flags.in (FAN_ATTRIB, FAN_MOVED_FROM, FAN_MOVED_TO, FAN_CREATE, FAN_DELETE, FAN_DELETE_SELF, FAN_MOVE_SELF): New constants introduced by Linux kernel commit v5.1-rc1~139^2~9. * NEWS: Mention this. * tests/fanotify_init.c (main): Update expected output. * tests/fanotify_mark.c (main): Likewise.
* xlat: update PR_SPEC_* constantsDmitry V. Levin2019-05-204-3/+7
| | | | | | | | * xlat/pr_spec_get_store_bypass_flags.in (PR_SPEC_DISABLE_NOEXEC): New constant introduced by Linux kernel commit v5.1-rc1~168^2. * xlat/pr_spec_set_store_bypass_flags.in: Likewise. * NEWS: Mention this. * tests/prctl-spec-inject.c (get_strs, set_strs): Update.
* xlat: update BPF_* constantsDmitry V. Levin2019-05-203-1/+3
| | | | | | | | * xlat/ebpf_class.in (BPF_JMP32): New constant introduced by Linux kernel commit v5.1-rc1~178^2~404^2~4^2~15. * xlat/bpf_map_update_elem_flags.in (BPF_F_LOCK): New constant introduced by Linux kernel commit v5.1-rc1~178^2~375^2~4^2~3. * NEWS: Mention this.
* xlat: update V4L2_* constantsDmitry V. Levin2019-05-203-1/+7
| | | | | | | | | | | | * xlat/v4l2_control_ids.in (V4L2_CID_MPEG_VIDEO_H264_CONSTRAINED_INTRA_PREDICTION): New constant introduced by Linux kernel commit v5.1-rc1~88^2~261. (V4L2_CID_MPEG_VIDEO_H264_CHROMA_QP_INDEX_OFFSET): New constant introduced by Linux kernel commit v5.1-rc1~88^2~260. * xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_AYUV32, V4L2_PIX_FMT_XYUV32, V4L2_PIX_FMT_VUYA32, V4L2_PIX_FMT_VUYX32): New constants introduced by Linux kernel commit v5.1-rc1~88^2~90. * NEWS: Mention this.
* xlat: update NT_* constantsDmitry V. Levin2019-05-202-0/+3
| | | | | | * xlat/nt_descriptor_types.in (NT_ARM_PACA_KEYS, NT_ARM_PACG_KEYS): New constants introduced by Linux kernel commit v5.1-rc1~82^2~44. * NEWS: Mention this.
* Implement decoding of io_uring_* syscallsDmitry V. Levin2019-05-1937-1/+515
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... introduced by Linux kernel commits v5.1-rc1~99^2~14, v5.1-rc1~99^2~7, and v5.1-rc7~24^2. * configure.ac (AC_CHECK_HEADERS): Add linux/io_uring.h. * io_uring.c: New file. * Makefile.am (strace_SOURCES): Add it. * pathtrace.c (pathtrace_match_set): Add SEN_io_uring_enter, SEN_io_uring_register, and SEN_io_uring_setup. * xlat/uring_enter_flags.in: New file. * xlat/uring_register_opcodes.in: Likewise. * linux/32/syscallent.h [425, 426, 427]: Wire up io_uring_setup, io_uring_enter, and io_uring_register. * linux/64/syscallent.h: Likewise. * linux/arm/syscallent.h: Likewise. * linux/hppa/syscallent.h: Likewise. * linux/i386/syscallent.h: Likewise. * linux/m68k/syscallent.h: Likewise. * linux/microblaze/syscallent.h: Likewise. * linux/powerpc/syscallent.h: Likewise. * linux/powerpc64/syscallent.h: Likewise. * linux/s390/syscallent.h: Likewise. * linux/s390x/syscallent.h: Likewise. * linux/sh/syscallent.h: Likewise. * linux/sh64/syscallent.h: Likewise. * linux/sparc/syscallent.h: Likewise. * linux/sparc64/syscallent.h: Likewise. * linux/x32/syscallent.h: Likewise. * linux/x86_64/syscallent.h: Likewise. * linux/xtensa/syscallent.h: Likewise. * linux/alpha/syscallent.h [535, 536, 537]: Likewise. * linux/ia64/syscallent.h [1024 + 425, 1024 + 426, 1024 + 427]: Likewise. * linux/mips/syscallent-n32.h [6425, 6426, 6427]: Likewise. * linux/mips/syscallent-n64.h [5425, 5426, 5427]: Likewise. * linux/mips/syscallent-o32.h [4425, 4426, 4427]: Likewise. * NEWS: Mention this change. * tests/io_uring_enter.c: New file. * tests/io_uring_register.c: Likewise. * tests/io_uring_setup.c: Likewise. * tests/gen_tests.in (io_uring_enter, io_uring_register, io_uring_setup): New entries. * tests/pure_executables.list: Add io_uring_enter, io_uring_register, and io_uring_setup. * tests/.gitignore: Likewise.
* Implement decoding of pidfd_send_signal syscallDmitry V. Levin2019-05-1829-3/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... introduced by Linux kernel commit v5.1-rc1~6^2~1. * signal.c (SYS_FUNC(pidfd_send_signal)): New function. * linux/32/syscallent.h [424]: Wire up pidfd_send_signal. * linux/64/syscallent.h: Likewise. * linux/arm/syscallent.h: Likewise. * linux/hppa/syscallent.h: Likewise. * linux/i386/syscallent.h: Likewise. * linux/m68k/syscallent.h: Likewise. * linux/microblaze/syscallent.h: Likewise. * linux/powerpc/syscallent.h: Likewise. * linux/powerpc64/syscallent.h: Likewise. * linux/s390/syscallent.h: Likewise. * linux/s390x/syscallent.h: Likewise. * linux/sh/syscallent.h: Likewise. * linux/sh64/syscallent.h: Likewise. * linux/sparc/syscallent.h: Likewise. * linux/sparc64/syscallent.h: Likewise. * linux/x32/syscallent.h: Likewise. * linux/x86_64/syscallent.h: Likewise. * linux/xtensa/syscallent.h: Likewise. * linux/alpha/syscallent.h [534]: Likewise. * linux/ia64/syscallent.h [1024 + 424]: Likewise. * linux/mips/syscallent-n32.h [6424]: Likewise. * linux/mips/syscallent-n64.h [5424]: Likewise. * linux/mips/syscallent-o32.h [4424]: Likewise. * NEWS: Mention this change. * tests/pidfd_send_signal.c: New file. * tests/gen_tests.in (pidfd_send_signal): New entry. * tests/pure_executables.list: Add pidfd_send_signal. * tests/.gitignore: Likewise.
* tests: check decoding of SO_TIMESTAMP*_NEW control messagesDmitry V. Levin2019-05-173-16/+226
| | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (AC_CHECK_TYPES): Check for struct __kernel_timespec and struct __kernel_sock_timeval. * tests/msg_control.c [HAVE_STRUCT___KERNEL_SOCK_TIMEVAL || HAVE_STRUCT___KERNEL_TIMESPEC]: Include <linux/time_types.h>. (test_scm_timestamp): Rename to test_scm_timestamp_old. (test_scm_timestampns): Rename to test_scm_timestampns_old. (test_scm_timestamping): Rename to test_scm_timestamping_old. [HAVE_STRUCT___KERNEL_SOCK_TIMEVAL] (test_scm_timestamp_new): New function. [HAVE_STRUCT___KERNEL_TIMESPEC] (test_scm_timestampns_new, test_scm_timestamping_new): New functions. (test_sol_socket): Use them. * tests/sockopt-timestamp.c [HAVE_STRUCT___KERNEL_SOCK_TIMEVAL || HAVE_STRUCT___KERNEL_TIMESPEC]: Include <linux/time_types.h>. Include "xlat/sock_options.h" in XLAT_MACROS_ONLY mode. (print_timestampns_old): Define unconditionally. [HAVE_STRUCT___KERNEL_SOCK_TIMEVAL] (print_timestamp_new): New function. [HAVE_STRUCT___KERNEL_TIMESPEC] (print_timestampns_new): Likewise. (main): Test SO_TIMESTAMPNS_OLD unconditionally. [HAVE_STRUCT___KERNEL_SOCK_TIMEVAL]: Test SO_TIMESTAMP_NEW. [HAVE_STRUCT___KERNEL_TIMESPEC]: Test SO_TIMESTAMPNS_NEW.
* Implement decoding of SO_TIMESTAMP*_NEW control messagesDmitry V. Levin2019-05-175-1/+45
| | | | | | | | | | | * print_timeval64.c: New file. * Makefile.am (strace_SOURCES): Add it. * defs.h (print_timeval64_data_size): New prototype. * msghdr.c (print_scm_timestamp_new, print_scm_timestampns_new, print_scm_timestamping_new): New functions. (cmsg_socket_printers): Add SO_TIMESTAMP_NEW, SO_TIMESTAMPNS_NEW, and SO_TIMESTAMPING_NEW. * NEWS: Mention this change.
* print_timespec.h: parametrize TIMESPEC_T.tv_nsecDmitry V. Levin2019-05-171-4/+10
| | | | | | | | | This is going to be used to implement a parser of SO_TIMESTAMP_NEW control message. * print_timespec.h [!TIMESPEC_NSEC] (TIMESPEC_NSEC): Define to tv_sec. (TIMESPEC_TO_SEC_NSEC, timespec_fmt, print_timespec_t_utime): Use TIMESPEC_NSEC instead of tv_sec.
* print_timespec.h: conditionalize printersDmitry V. Levin2019-05-171-22/+34
| | | | | | | | | This allows to implement a parser of SO_TIMESTAMP_NEW control message without implementing extra unused printers. * print_timespec.h (PRINT_TIMESPEC_DATA_SIZE, PRINT_TIMESPEC_ARRAY_DATA_SIZE, PRINT_TIMESPEC, SPRINT_TIMESPEC, PRINT_TIMESPEC_UTIME_PAIR, PRINT_ITIMERSPEC): Conditionalize.
* xlat: add SO_TIMESTAMP*_NEW constantsDmitry V. Levin2019-05-172-0/+25
| | | | | | | * xlat/sock_options.in (SO_TIMESTAMP_NEW, SO_TIMESTAMPNS_NEW, SO_TIMESTAMPING_NEW): New constants introduced by Linux commits v5.1-rc1~178^2~363^2~4 and v5.1-rc1~178^2~363^2~3. * xlat/scmvals.in: Likewise.
* Use kernel_timeval64_t in definition of kernel_timex64_tDmitry V. Levin2019-05-161-4/+3
| | | | | | * kernel_timex.h: Include "kernel_timeval.h". (kernel_timex64_t): Change the type of "time" field from a locally defined structure to its equivalent kernel_timeval64_t.
* Introduce kernel_timeval64_t typeDmitry V. Levin2019-05-162-0/+17
| | | | | | | | This type is going to be used to implement parsers of SO_TIMESTAMP*_NEW control messages. * kernel_timeval.h: New file. * Makefile.am (strace_SOURCES): Add it.
* xlat: add _OLD suffixes to SO_RCVTIMEO and SO_SNDTIMEODmitry V. Levin2019-05-151-10/+10
| | | | | | | | Follow the Linux kernel commit v5.1-rc1~178^2~363^2~1 and rename these constants. * xlat/sock_options.in (SO_RCVTIMEO): Rename to SO_RCVTIMEO_OLD. (SO_SNDTIMEO): Rename to SO_SNDTIMEO_OLD.
* Rename SO_TIMESTAMP* to SO_TIMESTAMP*_OLDDmitry V. Levin2019-05-156-36/+36
| | | | | | | | | | | | | | | | | | | | | Follow the Linux kernel commit v5.1-rc1~178^2~363^2~8 and rename these constants everywhere. * xlat/scmvals.in (SO_TIMESTAMP): Rename to SO_TIMESTAMP_OLD. (SO_TIMESTAMPNS): Rename to SO_TIMESTAMPNS_OLD. (SO_TIMESTAMPING): Rename to SO_TIMESTAMPING_OLD. * xlat/sock_options.in: Likewise. * xlat/sock_rds_options.in: Likewise. * msghdr.c (cmsg_socket_printers): Likewise. (print_scm_timestamp): Rename to print_scm_timestamp_old. (print_scm_timestampns): Rename to print_scm_timestampns_old. (print_scm_timestamping): Rename to print_scm_timestamping_old. * tests/msg_control.c (test_scm_timestamp): Rename SO_TIMESTAMP to SO_TIMESTAMP_OLD. (test_scm_timestampns): Rename SO_TIMESTAMPNS to SO_TIMESTAMPNS_OLD. (test_scm_timestamping): Rename SO_TIMESTAMPING to SO_TIMESTAMPING_OLD. * tests/sockopt-timestamp.c (main): Rename SO_TIMESTAMP and SO_TIMESTAMPNS to SO_TIMESTAMP_OLD and SO_TIMESTAMPNS_OLD, respectively.
* Replace SCM_TIMESTAMP* constants with SO_TIMESTAMP*Dmitry V. Levin2019-05-154-84/+42
| | | | | | | | | | | | | | | | | | | | | | Besides the fact that SO_TIMESTAMP* constants appear to be more standardized than SCM_TIMESTAMP*, new SO_TIMESTAMP*_OLD and SO_TIMESTAMP*_NEW constants introduced in Linux 5.1 have no SCM_TIMESTAMP*_OLD and SCM_TIMESTAMP*_NEW analogues. * xlat/scmvals.in: Replace SCM_WIFI_STATUS, SCM_TXTIME, SCM_TIMESTAMP, SCM_TIMESTAMPNS, and SCM_TIMESTAMPING with SO_WIFI_STATUS, SO_TXTIME, SO_TIMESTAMP, SO_TIMESTAMPNS, and SO_TIMESTAMPING, respectively. * msghdr.c: Include "xlat/sock_options.h" in XLAT_MACROS_ONLY mode. (cmsg_socket_printers): Replace SCM_TIMESTAMP, SCM_TIMESTAMPNS, and SCM_TIMESTAMPING with SO_TIMESTAMP, SO_TIMESTAMPNS, and SO_TIMESTAMPING, respectively. * tests/msg_control.c: Include "xlat/sock_options.h" in XLAT_MACROS_ONLY mode. (test_scm_timestamp): Replace SCM_TIMESTAMP with SO_TIMESTAMP. (test_scm_timestampns): Replace SCM_TIMESTAMPNS with SO_TIMESTAMPNS. (test_scm_timestamping): Replace SCM_TIMESTAMPING with SO_TIMESTAMPING. * tests/sockopt-timestamp.c (main): Replace SCM_TIMESTAMP and SCM_TIMESTAMPNS with SO_TIMESTAMP and SO_TIMESTAMPNS, respectively.
* tests: add another test of SO_TIMESTAMP and SO_TIMESTAMPNS decodingDmitry V. Levin2019-05-154-0/+161
| | | | | | | | | | Unlike msg_control test, this new test makes the kernel generate SO_TIMESTAMP and SO_TIMESTAMPNS messages. * tests/sockopt-timestamp.c: New file. * tests/gen_tests.in (sockopt-timestamp): New entry. * tests/pure_executables.list: Add sockopt-timestamp. * tests/.gitignore: Likewise.
* print_timespec.c: remove unused printersDmitry V. Levin2019-05-121-32/+0
| | | | | | | * print_timespec.c (PRINT_TIMESPEC, SPRINT_TIMESPEC, PRINT_TIMESPEC_UTIME_PAIR, PRINT_ITIMERSPEC): Remove. (print_timespec, sprint_timespec, print_timespec_utime_pair, print_itimerspec): Remove.