summaryrefslogtreecommitdiff
path: root/tests/file_handle.c
Commit message (Collapse)AuthorAgeFilesLines
* Use loop initial declarationsDmitry V. Levin2021-11-051-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This make the code easier to read. * src/bpf.c (decode_attr_extra_data): Use "for" loop initial declarations. * src/count.c (call_summary): Likewise. * src/dm.c (dm_decode_dm_target_spec, dm_decode_dm_name_list, dm_decode_dm_target_versions): Likewise. * src/dyxlat.c (dyxlat_free, dyxlat_add_pair): Likewise. * src/filter_qualify.c (parse_poke_token): Likewise. * src/filter_seccomp.c (check_seccomp_order_tracer): Likewise. * src/ipc.c (SYS_FUNC(ipc)): Likewise. * src/kexec.c (print_seg): Likewise. * src/kvm.c (kvm_vcpu_info_free): Likewise. * src/linux/alpha/get_syscall_args.c (arch_get_syscall_args): Likewise. * src/linux/arc/get_syscall_args.c (arch_get_syscall_args): Likewise. * src/linux/bfin/get_syscall_args.c (arch_get_syscall_args): Likewise. * src/linux/ia64/get_syscall_args.c (arch_get_syscall_args): Likewise. * src/linux/metag/get_syscall_args.c (arch_get_syscall_args): Likewise. * src/linux/microblaze/get_syscall_args.c (arch_get_syscall_args): Likewise. * src/mmap_notify.c (mmap_notify_report): Likewise. * src/mmsghdr.c (dumpiov_in_mmsghdr): Likewise. * src/nlattr.c (decode_nlattr): Likewise. * src/number_set.c (clear_number_set_array, invert_number_set_array): Likewise. * src/pathtrace.c (pathmatch, pathtrace_match_set): Likewise. * src/poll.c (decode_poll_exiting): Likewise. * src/signal.c (sprintsigmask_n): Likewise. * src/sockaddr.c (print_sockaddr_data_ll): Likewise. * src/socketutils.c (unix_parse_response, get_proto_by_name, get_sockaddr_by_inode_uncached, genl_parse_families_response): Likewise. * src/strace.c (expand_tcbtab, alloctcb, droptcb, startup_attach, redirect_standard_fds, cleanup): Likewise. * src/syscall.c (decode_socket_subcall, decode_ipc_subcall): Likewise. * src/term.c (decode_termio): Likewise. * src/util.c (dumpiov_upto): Likewise. * src/v4l2.c (print_pixelformat): Likewise. * tests/add_key.c (main): Likewise. * tests/attach-f-p.c (main): Likewise. * tests/btrfs.c (max_flags_plus_one, btrfs_print_qgroup_inherit, btrfs_test_subvol_ioctls, btrfs_print_tree_search_buf, btrfs_test_space_info_ioctl, btrfs_test_ino_path_ioctls, btrfs_test_get_dev_stats_ioctl, btrfs_test_read_ioctls): Likewise. * tests/count-f.c (thread, process, main): Likewise. * tests/fanotify_init.c (main): Likewise. * tests/fanotify_mark.c (main): Likewise. * tests/file_handle.c (main): Likewise. * tests/fill_memory.c (fill_memory_ex, fill_memory16_ex, fill_memory32_ex): Likewise. * tests/filter-unavailable.c (process, main): Likewise. * tests/futex.c (invalid_op, main): Likewise. * tests/get_mempolicy.c (print_nodes): Likewise. * tests/group_req.c (main): Likewise. * tests/hexdump_strdup.c (hexdump_memdup): Likewise. * tests/hexquote_strndup.c (hexquote_strndup): Likewise. * tests/inet-cmsg.c (print_opts, main): Likewise. * tests/init_delete_module.h (print_str): Likewise. * tests/ioctl_block.c (main): Likewise. * tests/ioctl_dm.c (main): Likewise. * tests/ioctl_evdev.c (main): Likewise. * tests/ioctl_v4l2.c (init_v4l2_format, dprint_ioctl_v4l2): Likewise. * tests/ip_mreq.c (main): Likewise. * tests/ipc.c (main): Likewise. * tests/kcmp.c (main): Likewise. * tests/kexec_file_load.c (main): Likewise. * tests/kexec_load.c (main): Likewise. * tests/keyctl.c (do_keyctl, main): Likewise. * tests/ksysent.c (main): Likewise. * tests/list_sigaction_signum.c (main): Likewise. * tests/mincore.c (print_mincore): Likewise. * tests/mmsg_name.c (test_mmsg_name): Likewise. * tests/move_pages.c (print_page_array, print_node_array, print_status_array): Likewise. * tests/mq_sendrecv.c (printstr, dumpstr): Likewise. * tests/msg_control.c (print_fds, test_scm_rights3, test_sol_socket, print_ip_opts, test_ip_opts): Likewise. * tests/netlink_protocol.c (send_query): Likewise. * tests/nlattr.c (test_nlattr): Likewise. * tests/nlattr_ifla_linkinfo.c (TEST_UNKNOWN_TUNNELS): Likewise. * tests/nlattr_rtmsg.c (print_quoted_hex_ellipsis): Likewise. * tests/perf_event_open.c (main): Likewise. * tests/perf_event_open_nonverbose.c (main): Likewise. * tests/pkey_alloc.c (main): Likewise. * tests/pkey_free.c (main): Likewise. * tests/pkey_mprotect.c (main): Likewise. * tests/poll.c (print_pollfd_array_entering, print_pollfd_array_exiting): Likewise. * tests/prctl-arg2-intptr.c (main): Likewise. * tests/prctl-name.c (main): Likewise. * tests/pread64-pwrite64.c (dump_str, print_hex, test_dump, main): Likewise. * tests/preadv.c (print_iov, print_iovec): Likewise. * tests/print_quoted_string.c (print_quoted_memory_ex, print_quoted_hex): Likewise. * tests/process_vm_readv_writev.c (print_iov): Likewise. * tests/pwritev.c (print_iovec, main): Likewise. * tests/qual_fault.c (main): Likewise. * tests/qual_signal.c (main): Likewise. * tests/read-write.c (dump_str_ex, print_hex, test_dump, main): Likewise. * tests/readahead.c (main): Likewise. * tests/redirect-fds.c (main): Likewise. * tests/request_key.c (main): Likewise. * tests/rt_sigsuspend.c (iterate): Likewise. * tests/s390_pci_mmio_read_write.c (main): Likewise. * tests/s390_runtime_instr.c (main): Likewise. * tests/seccomp-filter-v.c (main): Likewise. * tests/seccomp_get_action_avail.c (main): Likewise. * tests/set_mempolicy.c (print_nodes): Likewise. * tests/setfsugid.c (main): Likewise. * tests/setns.c (main): Likewise. * tests/setresugid.c (main): Likewise. * tests/setreugid.c (main): Likewise. * tests/setugid.c (main): Likewise. * tests/socketcall.c (main): Likewise. * tests/sockopt-sol_netlink.c (main): Likewise. * tests/test_nlattr.h (print_sockfd): Likewise. * tests/test_printpath.c (test_printpath_at, test_printpath): Likewise. * tests/test_printstrn.c (test_printstrn_at, test_efault, test_printstrn): Likewise. * tests/unix-pair-send-recv.c (transpose): Likewise. * tests/unix-pair-sendto-recvfrom.c (transpose): Likewise. * tests/unshare.c (main): Likewise. * tests/xchownx.c (main): Likewise.
* tests/file_handle: fix -Wmissing-prototypes warningsDmitry V. Levin2021-06-041-3/+3
| | | | | * tests/file_handle.c (print_handle_data, do_name_to_handle_at, do_open_by_handle_at): Add static qualifier.
* tests: assume __NR_name_to_handle_at and __NR_open_by_handle_at are definedDmitry V. Levin2021-06-021-24/+16
| | | | | | | | name_to_handle_at and open_by_handle_at syscall entries are present in syscallent files for all supported architectures. * tests/file_handle.c: Assume __NR_name_to_handle_at and __NR_open_by_handle_at are defined.
* tests/file_handle.c: skip the test if the underlying fs can't do handlesAlyssa Ross2021-05-041-2/+7
| | | | | | | | | | | | | Quoting name_to_handle_at(2): > Some care is needed here as EOVERFLOW can also indicate that no file > handle is available for this particular name in a filesystem which > does normally support file-handle lookup. This case can be detected > when the EOVERFLOW error is returned without handle_bytes being > increased. This patch handles that case, resolving 20 failures for me on ZFS, and making `make check' able to run successfully.
* Implement --secontext[=full] option to display SELinux contextsldv/secontextRenaud Métrich2021-04-041-64/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is very useful when debugging SELinux issues, in particular, when a process runs in an unexpected context or didn't transition properly, or typically when a file being opened does not have the proper context. When --secontext=full is specified, strace will print the complete context (user, role, type and category) instead of just the type which is printed for --secontext option, as shown in the examples below: Without any "--secontext" options: ----------------------------------------------------------------------- 118104 16:52:11.141122 select(9, [4<TCP:[0.0.0.0:22]> 6<TCPv6:[[::]:22]>], NULL, NULL, NULL) = 1 (in [4]) <1.845416> 119820 16:52:13.133319 openat(AT_FDCWD, "/home/rmetrich/.ssh/authorized_keys", O_RDONLY|O_NONBLOCK) = 11</home/rmetrich/.ssh/authorized_keys> <0.000399> ----------------------------------------------------------------------- With "--secontext=full" option: ----------------------------------------------------------------------- 118104 [system_u:system_r:sshd_t:s0-s0:c0.c1023] 16:52:11.141122 select(9, [4<TCP:[0.0.0.0:22]> 6<TCPv6:[[::]:22]>], NULL, NULL, NULL) = 1 (in [4]) <1.845416> 119820 [system_u:system_r:sshd_t:s0-s0:c0.c1023] 16:52:13.133319 openat(AT_FDCWD, "/home/rmetrich/.ssh/authorized_keys" [system_u:object_r:nfs_t:s0], O_RDONLY|O_NONBLOCK) = 11</home/rmetrich/.ssh/authorized_keys> [system_u:object_r:nfs_t:s0] <0.000399> ----------------------------------------------------------------------- With "--secontext" option: ----------------------------------------------------------------------- 118104 [sshd_t] 16:52:11.141122 select(9, [4<TCP:[0.0.0.0:22]> 6<TCPv6:[[::]:22]>], NULL, NULL, NULL) = 1 (in [4]) <1.845416> 119820 [sshd_t] 16:52:13.133319 openat(AT_FDCWD, "/home/rmetrich/.ssh/authorized_keys" [nfs_t], O_RDONLY|O_NONBLOCK) = 11</home/rmetrich/.ssh/authorized_keys> [nfs_t] <0.000399> ----------------------------------------------------------------------- To implement this, a new "--with-libselinux" configure option has been introduced. It defaults to "check", which means automatic support on SELinux aware systems. Co-authored-by: Dmitry V. Levin <ldv@strace.io>
* file_handle: print f_handle as a hexadecimal stringDmitry V. Levin2021-03-071-15/+11
| | | | | | | | | | | Printing the sequence of bytes as a hexadecimal number is misleading because the latter depends on endianness. * src/file_handle.c (print_f_handle): New function. (SYS_FUNC(name_to_handle_at), SYS_FUNC(open_by_handle_at)): Use it to print struct file_handle.f_handle. * tests/file_handle.c (print_handle_data, do_open_by_handle_at, main): Update expected output.
* Update copyright headersDmitry V. Levin2021-02-161-1/+1
| | | | | Headers updated automatically using maint/update_copyright_years.sh script.
* Change my email addressDmitry V. Levin2020-12-311-1/+1
|
* Update copyright headersDmitry V. Levin2019-09-251-1/+1
| | | | | Headers updated automatically using maint/update_copyright_years.sh script.
* Consistently define __NR_* constantsDmitry V. Levin2019-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Include <asm/unistd.h> from "scno.h", include "scno.h" instead of <asm/unistd.h>, do not include <asm/unistd.h> where "scno.h" is already included. * scno.head: Include <asm/unistd.h>. * clone.c: Include "scno.h" instead of <asm/unistd.h>. * syscall.c: Likewise. * tests/_newselect.c: Likewise. * tests/accept.c: Likewise. * tests/accept_compat.h: Likewise. * tests/access.c: Likewise. * tests/acct.c: Likewise. * tests/aio.c: Likewise. * tests/alarm.c: Likewise. * tests/answer.c: Likewise. * tests/attach-f-p.c: Likewise. * tests/brk.c: Likewise. * tests/chmod.c: Likewise. * tests/chown.c: Likewise. * tests/chown32.c: Likewise. * tests/chroot.c: Likewise. * tests/clock_adjtime.c: Likewise. * tests/clock_nanosleep.c: Likewise. * tests/clock_xettime.c: Likewise. * tests/creat.c: Likewise. * tests/delay.c: Likewise. * tests/delete_module.c: Likewise. * tests/dev-yy.c: Likewise. * tests/dup2.c: Likewise. * tests/dup3.c: Likewise. * tests/epoll_create.c: Likewise. * tests/epoll_create1.c: Likewise. * tests/epoll_ctl.c: Likewise. * tests/epoll_pwait.c: Likewise. * tests/epoll_wait.c: Likewise. * tests/eventfd.c: Likewise. * tests/faccessat.c: Likewise. * tests/fadvise64.c: Likewise. * tests/fadvise64_64.c: Likewise. * tests/fallocate.c: Likewise. * tests/fanotify_init.c: Likewise. * tests/fanotify_mark.c: Likewise. * tests/fchdir.c: Likewise. * tests/fchmod.c: Likewise. * tests/fchmodat.c: Likewise. * tests/fchown.c: Likewise. * tests/fchown32.c: Likewise. * tests/fchownat.c: Likewise. * tests/fcntl.c: Likewise. * tests/fcntl64.c: Likewise. * tests/fdatasync.c: Likewise. * tests/file_handle.c: Likewise. * tests/flock.c: Likewise. * tests/fstat.c: Likewise. * tests/fstat64.c: Likewise. * tests/fstatat64.c: Likewise. * tests/fstatfs.c: Likewise. * tests/fstatfs64.c: Likewise. * tests/fsync.c: Likewise. * tests/ftruncate.c: Likewise. * tests/ftruncate64.c: Likewise. * tests/futex.c: Likewise. * tests/futimesat.c: Likewise. * tests/get_mempolicy.c: Likewise. * tests/get_sigset_size.c: Likewise. * tests/getcpu.c: Likewise. * tests/getcwd.c: Likewise. * tests/getdents.c: Likewise. * tests/getdents64.c: Likewise. * tests/getegid32.c: Likewise. * tests/geteuid32.c: Likewise. * tests/getgid.c: Likewise. * tests/getgid32.c: Likewise. * tests/getgroups.c: Likewise. * tests/getgroups32.c: Likewise. * tests/getpgrp.c: Likewise. * tests/getpid.c: Likewise. * tests/getrandom.c: Likewise. * tests/getresgid.c: Likewise. * tests/getresgid32.c: Likewise. * tests/getresuid.c: Likewise. * tests/getresuid32.c: Likewise. * tests/getrlimit.c: Likewise. * tests/getrusage.c: Likewise. * tests/gettid.c: Likewise. * tests/getuid.c: Likewise. * tests/getuid32.c: Likewise. * tests/getxxid.c: Likewise. * tests/init_module.c: Likewise. * tests/inject-nf.c: Likewise. * tests/inotify.c: Likewise. * tests/inotify_init1.c: Likewise. * tests/ioctl_inotify.c: Likewise. * tests/ioctl_loop.c: Likewise. * tests/ioctl_perf.c: Likewise. * tests/ioctl_uffdio.c: Likewise. * tests/ioperm.c: Likewise. * tests/iopl.c: Likewise. * tests/ioprio.c: Likewise. * tests/ipc.c: Likewise. * tests/ipc_msgbuf.c: Likewise. * tests/kexec_load.c: Likewise. * tests/keyctl.c: Likewise. * tests/kill.c: Likewise. * tests/ksysent.c: Likewise. * tests/lchown.c: Likewise. * tests/lchown32.c: Likewise. * tests/libmmsg.c: Likewise. * tests/libsocketcall.c: Likewise. * tests/link.c: Likewise. * tests/linkat.c: Likewise. * tests/llseek.c: Likewise. * tests/localtime.c: Likewise. * tests/lookup_dcookie.c: Likewise. * tests/lseek.c: Likewise. * tests/lstat.c: Likewise. * tests/lstat64.c: Likewise. * tests/madvise.c: Likewise. * tests/migrate_pages.c: Likewise. * tests/mkdir.c: Likewise. * tests/mkdirat.c: Likewise. * tests/mknod.c: Likewise. * tests/mknodat.c: Likewise. * tests/mlock.c: Likewise. * tests/modify_ldt.c: Likewise. * tests/move_pages.c: Likewise. * tests/mq_sendrecv.c: Likewise. * tests/newfstatat.c: Likewise. * tests/nsyscalls.c: Likewise. * tests/old_mmap.c: Likewise. * tests/oldfstat.c: Likewise. * tests/oldlstat.c: Likewise. * tests/oldselect-efault.c: Likewise. * tests/oldselect.c: Likewise. * tests/oldstat.c: Likewise. * tests/open.c: Likewise. * tests/openat.c: Likewise. * tests/osf_utimes.c: Likewise. * tests/pause.c: Likewise. * tests/perf_event_open.c: Likewise. * tests/perf_event_open_nonverbose.c: Likewise. * tests/pipe.c: Likewise. * tests/pipe2.c: Likewise. * tests/poll.c: Likewise. * tests/ppoll.c: Likewise. * tests/prctl-arg2-intptr.c: Likewise. * tests/prctl-dumpable.c: Likewise. * tests/prctl-no-args.c: Likewise. * tests/prctl-pdeathsig.c: Likewise. * tests/prctl-seccomp-filter-v.c: Likewise. * tests/prctl-seccomp-strict.c: Likewise. * tests/prctl-securebits.c: Likewise. * tests/prctl-spec-inject.c: Likewise. * tests/prctl-tid_address.c: Likewise. * tests/prctl-tsc.c: Likewise. * tests/prlimit64.c: Likewise. * tests/process_vm_readv.c: Likewise. * tests/process_vm_writev.c: Likewise. * tests/pselect6.c: Likewise. * tests/ptrace.c: Likewise. * tests/qual_inject-error-signal.c: Likewise. * tests/qual_inject-retval.c: Likewise. * tests/qual_inject-signal.c: Likewise. * tests/quotactl-xfs.c: Likewise. * tests/quotactl.c: Likewise. * tests/read-write.c: Likewise. * tests/readahead.c: Likewise. * tests/readdir.c: Likewise. * tests/readlink.c: Likewise. * tests/readlinkat.c: Likewise. * tests/reboot.c: Likewise. * tests/rename.c: Likewise. * tests/renameat.c: Likewise. * tests/request_key.c: Likewise. * tests/rmdir.c: Likewise. * tests/rt_sigpending.c: Likewise. * tests/rt_sigprocmask.c: Likewise. * tests/rt_sigsuspend.c: Likewise. * tests/rt_sigtimedwait.c: Likewise. * tests/rt_tgsigqueueinfo.c: Likewise. * tests/s390_guarded_storage.c: Likewise. * tests/s390_pci_mmio_read_write.c: Likewise. * tests/s390_runtime_instr.c: Likewise. * tests/s390_sthyi.c: Likewise. * tests/sched_get_priority_mxx.c: Likewise. * tests/sched_rr_get_interval.c: Likewise. * tests/sched_xetaffinity.c: Likewise. * tests/sched_xetattr.c: Likewise. * tests/sched_xetparam.c: Likewise. * tests/sched_xetscheduler.c: Likewise. * tests/sched_yield.c: Likewise. * tests/seccomp-filter-v.c: Likewise. * tests/seccomp-filter.c: Likewise. * tests/seccomp-strict.c: Likewise. * tests/seccomp_get_action_avail.c: Likewise. * tests/select.c: Likewise. * tests/sendfile.c: Likewise. * tests/sendfile64.c: Likewise. * tests/setdomainname.c: Likewise. * tests/setfsgid.c: Likewise. * tests/setfsgid32.c: Likewise. * tests/setfsuid.c: Likewise. * tests/setfsuid32.c: Likewise. * tests/setgid.c: Likewise. * tests/setgid32.c: Likewise. * tests/setgroups.c: Likewise. * tests/setgroups32.c: Likewise. * tests/sethostname.c: Likewise. * tests/setns.c: Likewise. * tests/setregid.c: Likewise. * tests/setregid32.c: Likewise. * tests/setresgid.c: Likewise. * tests/setresgid32.c: Likewise. * tests/setresuid.c: Likewise. * tests/setresuid32.c: Likewise. * tests/setreuid.c: Likewise. * tests/setreuid32.c: Likewise. * tests/setrlimit.c: Likewise. * tests/setuid.c: Likewise. * tests/setuid32.c: Likewise. * tests/sigaction.c: Likewise. * tests/signal.c: Likewise. * tests/signalfd4.c: Likewise. * tests/sigpending.c: Likewise. * tests/sigprocmask.c: Likewise. * tests/sigreturn.c: Likewise. * tests/sigsuspend.c: Likewise. * tests/socketcall.c: Likewise. * tests/splice.c: Likewise. * tests/stack-fcall-3.c: Likewise. * tests/stat.c: Likewise. * tests/stat64.c: Likewise. * tests/statfs.c: Likewise. * tests/statfs64.c: Likewise. * tests/status-none-threads.c: Likewise. * tests/status-unfinished-threads.c: Likewise. * tests/statx.c: Likewise. * tests/swap.c: Likewise. * tests/sxetmask.c: Likewise. * tests/symlink.c: Likewise. * tests/symlinkat.c: Likewise. * tests/sync.c: Likewise. * tests/sync_file_range.c: Likewise. * tests/sync_file_range2.c: Likewise. * tests/syslog.c: Likewise. * tests/tee.c: Likewise. * tests/threads-execve.c: Likewise. * tests/time.c: Likewise. * tests/timer_create.c: Likewise. * tests/timer_xettime.c: Likewise. * tests/timerfd_xettime.c: Likewise. * tests/times-fail.c: Likewise. * tests/times.c: Likewise. * tests/truncate.c: Likewise. * tests/truncate64.c: Likewise. * tests/ugetrlimit.c: Likewise. * tests/umount.c: Likewise. * tests/umount2.c: Likewise. * tests/umoven-illptr.c: Likewise. * tests/umovestr-illptr.c: Likewise. * tests/uname.c: Likewise. * tests/unix-pair-send-recv.c: Likewise. * tests/unlink.c: Likewise. * tests/unlinkat.c: Likewise. * tests/unshare.c: Likewise. * tests/ustat.c: Likewise. * tests/utime.c: Likewise. * tests/utimensat.c: Likewise. * tests/utimes.c: Likewise. * tests/vhangup.c: Likewise. * tests/vmsplice.c: Likewise. * tests/waitid.c: Likewise. * tests/waitpid.c: Likewise. * tests/xet_robust_list.c: Likewise. * tests/xet_thread_area_x86.c: Likewise. * tests/xetitimer.c: Likewise. * tests/xetpgid.c: Likewise. * tests/xetpriority.c: Likewise. * tests/xettimeofday.c: Likewise. * strace.c: Do not include <asm/unistd.h>. * ucopy.c: Likewise. * tests/add_key.c: Likewise. * tests/aio_pgetevents.c: Likewise. * tests/bpf-obj_get_info_by_fd.c: Likewise. * tests/bpf.c: Likewise. * tests/copy_file_range.c: Likewise. * tests/execveat.c: Likewise. * tests/finit_module.c: Likewise. * tests/fsconfig.c: Likewise. * tests/fsmount.c: Likewise. * tests/fsopen.c: Likewise. * tests/fspick.c: Likewise. * tests/getegid.c: Likewise. * tests/geteuid.c: Likewise. * tests/getppid.c: Likewise. * tests/inotify_init.c: Likewise. * tests/io_uring_enter.c: Likewise. * tests/io_uring_register.c: Likewise. * tests/io_uring_setup.c: Likewise. * tests/kcmp.c: Likewise. * tests/kern_features.c: Likewise. * tests/kernel_version.c: Likewise. * tests/kexec_file_load.c: Likewise. * tests/maybe_switch_current_tcp.c: Likewise. * tests/mbind.c: Likewise. * tests/membarrier.c: Likewise. * tests/memfd_create.c: Likewise. * tests/mlock2.c: Likewise. * tests/move_mount.c: Likewise. * tests/open_tree.c: Likewise. * tests/pidfd_send_signal.c: Likewise. * tests/pkey_alloc.c: Likewise. * tests/pkey_free.c: Likewise. * tests/pkey_mprotect.c: Likewise. * tests/preadv2-pwritev2.c: Likewise. * tests/ptrace_syscall_info.c: Likewise. * tests/remap_file_pages.c: Likewise. * tests/renameat2.c: Likewise. * tests/riscv_flush_icache.c: Likewise. * tests/set_mempolicy.c: Likewise. * tests/test_printstrn.c: Likewise. * tests/test_ucopy.c: Likewise. * tests/userfaultfd.c: Likewise.
* Fix preprocessor indentationDmitry V. Levin2018-12-301-2/+2
| | | | | | | | | Indent the C preprocessor directives to reflect their nesting using the following script: $ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' |grep -v '\.sh$') |while read f; do cppi < "$f" > "$f".cppi; mv "$f".cppi "$f" done
* tests: change the license to GPL-2.0-or-laterDmitry V. Levin2018-12-101-21/+1
| | | | | strace test suite is now provided under the terms of the GNU General Public License version 2 or later, see tests/COPYING for more details.
* Update copyright headersDmitry V. Levin2018-04-051-1/+1
| | | | | Headers updated automatically using maint/update_copyright_years.sh script.
* tests: do not include <stdbool.h> in files that include "tests.h"Dmitry V. Levin2018-03-011-1/+0
| | | | | | | | | | | | | | | | | | | | Starting with commit v4.21-37-g4f63bc70ca95012d72e288fc3c1eeb3ba26068a4, <stdbool.h> is included by tests.h, so all tests that already include "tests.h" do not need to include <stdbool.h>. * tests/btrfs.c: Do not include <stdbool.h>. * tests/file_handle.c: Likewise. * tests/futex.c: Likewise. * tests/ioctl_dm.c: Likewise. * tests/ioctl_loop.c: Likewise. * tests/ioctl_sock_gifconf.c: Likewise. * tests/keyctl.c: Likewise. * tests/mq_sendrecv.c: Likewise. * tests/perf_event_open.c: Likewise. * tests/s390_guarded_storage.c: Likewise. * tests/s390_pci_mmio_read_write.c: Likewise. * tests/s390_sthyi.c: Likewise. * tests/xet_thread_area_x86.c: Likewise.
* Add copyright headersEugene Syromyatnikov2017-05-221-0/+1
|
* tests: use TAIL_ALLOC_OBJECT_CONST_PTRDmitry V. Levin2017-03-161-1/+1
| | | | | | | | | Automatically convert tests to use TAIL_ALLOC_OBJECT_CONST_PTR macro with the following sed expression: sed -ri \ 's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*( *const )?([^ =]+) = tail_alloc\(sizeof\((\2|\*\6)\)\);/\1TAIL_ALLOC_OBJECT_CONST_PTR(\2, \6);/' \ tests/*.c
* tests: replace casts of 0xffffffff00000000ULL with F8ILL_KULONG_MASKDmitry V. Levin2017-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * tests/init_delete_module.h (bogus_zero): Remove. * tests/delete_module.c (main): Replace bogus_zero and (kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK. * tests/finit_module.c (main): Replace bogus_zero with F8ILL_KULONG_MASK. * tests/init_module.c (main): Likewise. * tests/pipe2.c (main): Likewise. * tests/epoll_ctl.c (invoke_syscall): Replace (unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK. * tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Likewise. * tests/fanotify_init.c (main): Likewise. * tests/xetpgid.c (main): Likewise. * tests/xetpriority.c (main): Likewise. (kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK. * tests/fanotify_mark.c (main): Likewise. * tests/file_handle.c (main): Likewise. * tests/kexec_load.c (main): Likewise. * tests/setfsugid.c (main): Likewise. * tests/getgroups.c (main): Replace (long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK. * tests/setgroups.c (main): Replace (long) 0xffffffff00000000ULL and (unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* Include "kernel_types.h" in defs.h and tests/tests.hDmitry V. Levin2016-12-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As kernel_ulong_t type is going to be used in the definition of struct tcb and in many function prototypes, make it readily available for every source file by including "kernel_types.h" in defs.h and tests/tests.h files. * defs.h: Include "kernel_types.h". * tests/tests.h: Likewise. * desc.c: Do not include "kernel_types.h". * dirent.c: Likewise. * keyctl.c: Likewise. * syscall.c: Likewise. * linux/asm_stat.h: Likewise. * tests/answer.c: Likewise. * tests/epoll_pwait.c: Likewise. * tests/fanotify_init.c: Likewise. * tests/fanotify_mark.c: Likewise. * tests/file_handle.c: Likewise. * tests/ftruncate.c: Likewise. * tests/getdents.c: Likewise. * tests/init_delete_module.h: Likewise. * tests/inotify.c: Likewise. * tests/inotify_init1.c: Likewise. * tests/ioprio.c: Likewise. * tests/ipc_msgbuf.c: Likewise. * tests/kcmp.c: Likewise. * tests/kexec_file_load.c: Likewise. * tests/kexec_load.c: Likewise. * tests/keyctl.c: Likewise. * tests/lookup_dcookie.c: Likewise. * tests/lseek.c: Likewise. * tests/mq_sendrecv.c: Likewise. * tests/nsyscalls.c: Likewise. * tests/pkey_alloc.c: Likewise. * tests/pkey_free.c: Likewise. * tests/pkey_mprotect.c: Likewise. * tests/prctl-pdeathsig.c: Likewise. * tests/prctl-tsc.c: Likewise. * tests/preadv2-pwritev2.c: Likewise. * tests/process_vm_readv_writev.c: Likewise. * tests/read-write.c: Likewise. * tests/setfsugid.c: Likewise. * tests/setns.c: Likewise. * tests/truncate.c: Likewise. * tests/unshare.c: Likewise. * tests/xgetrlimit.c: Likewise.
* tests: additional name_to_handle_at/open_by_handle_at checksEugene Syromyatnikov2016-10-291-7/+260
| | | | | * tests/file_handle.c: Additional name_to_handle_at/open_by_handle_at checks.
* tests: require only presence of __NR_* macros for file_handle testEugene Syromyatnikov2016-10-291-7/+26
| | | | | | | | | * tests/file_handle.c: replace fcntl.h include with asm/unistd.h. [MAX_HANDLE_SZ]: change to defined __NR_name_to_handle_at && defined __NR_open_by_handle_at, add fcntl.h include [!MAX_HANDLE_SZ]: Add definition of MAX_HANDLE_SZ and struct file_handle. (main): Change name_to_handle_at and open_by_handle_at calls to syscall.
* tests/file_handle.c: use errno2nameDmitry V. Levin2016-04-211-14/+2
|
* tests/file_handle.c: use libtestsDmitry V. Levin2016-01-061-30/+30
| | | | | * tests/file_handle.c: Use SKIP_MAIN_UNDEFINED. (main): Use assert and perror_msg_and_skip.
* tests: include tests.h instead of config.hDmitry V. Levin2016-01-051-4/+1
| | | | | | | | Automatically edit tests/*.c files using the following perl one-liner: perl -0777 -pi -e \ 's/#ifdef HAVE_CONFIG_H\n# include "config\.h"\n#endif\n*/#include "tests.h"\n/' \ tests/*.c
* tests/file_handle: fix expected outputDmitry V. Levin2015-11-261-2/+2
| | | | | * tests/file_handle.c (main): Parametrize handle_type in open_by_handle_at parser output.
* Implement name_to_handle_at and open_by_handle_at syscalls decodingDmitry V. Levin2015-11-221-0/+101
* file_handle.c: New file. * Makefile.am (strace_SOURCES): Add it. * linux/dummy.h (sys_name_to_handle_at, sys_open_by_handle_at): Remove stub aliases. * pathtrace.c (pathtrace_match): Add SEN_name_to_handle_at. * tests/file_handle.c: New file. * tests/file_handle.test: New test. * tests/Makefile.am (check_PROGRAMS): Add file_handle. (TESTS): Add file_handle.test. * tests/.gitignore: Add file_handle.