Commit Graph

1571 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
b3d691efe4 tests: improve setugid error diagnostics a bit
* tests/setugid.c (main): Print unexpected code returned by syscall.
2018-01-19 17:50:09 +00:00
Eugene Syromyatnikov
d9f6166f0c Add compat support for s390x
By very popular demand.

While we are here, let's refactor the condition for old_mmap_pgoff into
an arch-specific one, as it is used more than in one place.

* NEWS: Mention this.
* strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): Likewise.
* configure.ac (case "$host_cpu" in) <s390x>: Set arch_m32 to s390, set
cc_flags_m32 to -m31.
(st_MPERS([m32])): Add s390x.
* defs.h [S390X]: Define NEED_UID16_PARSERS.
* linux/s390/arch_sigreturn.c [!S390_FRAME_PTR] (S390_FRAME_PTR): New
macro, define to s390_frame_ptr.
[!SIGNAL_FRAMESIZE] (SIGNAL_FRAMESIZE): New macro, define to
__SIGNAL_FRAMESIZE.
[!PTR_TYPE] (PTR_TYPE): New macro, define to unsigned long.
(arch_sigreturn): Use S390_FRAME_PTR, SIGNAL_FRAMESIZE, and PTR_TYPE
instead of s390_frame_ptr, __SIGNAL_FRAMESIZE, and pointer-sized type,
respectively.
* linux/s390/get_error.c [!ARCH_REGSET] (ARCH_REGSET): New macro, define
* to s390_regset.
(get_error): Use it instead of s390_regset.
* linux/s390/get_scno.c (arch_get_scno): Likewise.
* linux/s390/get_syscall_args.c (get_syscall_args): Likewise.
* linux/s390/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/s390/set_scno.c (arch_set_scno): Likewise.
* linux/s390x/arch_regs.c (psw_compat_t, s390_compat_regs,
s390x_regs_union, s390_frame_ptr, s390x_frame_ptr, s390x_io): New
variables.
(s390_regset, s390x_regset, ARCH_REGS_FOR_GETREGSET,
ARCH_IOVEC_FOR_GETREGSET, ARCH_PC_REG, ARCH_PERSONALITY_0_IOV_SIZE,
ARCH_PERSONALITY_1_IOV_SIZE): New macros.
* linux/s390x/arch_regs.h (s390_frame_ptr, s390x_frame_ptr): New
prototypes.
* linux/s390x/arch_rt_sigframe.c: Conditionalize on tcp->currpers.
* linux/s390x/arch_sigreturn.c: Likewise.
* linux/s390x/get_error.c: Likewise.
* linux/s390x/get_scno.c: Likewise.
* linux/s390x/get_syscall_args.c: Likewise.
* linux/s390x/set_error.c: Likewise.
* linux/s390x/set_scno.c: Likewise.
* linux/s390x/errnoent1.h: New file.
* linux/s390x/ioctls_arch1.h: Likewise.
* linux/s390x/ioctls_inc1.h: Likewise.
* linux/s390x/signalent1.h: Likewise.
* linux/s390x/syscallent1.h: Likewise.
* Makefile.am (EXTRA_DIST): Add new files added to linux/s390x.
* supported_personalities.h [S390X] (SUPPORTED_PERSONALITIES): Define
to 2.
* tests/strace-V.test: Add s390 to the list of architectures that have
m32 personality.
* linux/s390/arch_defs.h (HAVE_ARCH_OLD_MMAP_PGOFF): New macro.
* linux/s390x/arch_defs.h: Likewise.
* mem.c: Replace #ifdef S390 with #ifdef HAVE_ARCH_OLD_MMAP_PGOFF.
* pathtrace.c: Likewise.
2018-01-19 02:04:37 +01:00
119b6a1a1d tests: check path tracing of ppoll syscall
* tests/ppoll.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/
is not available.  Add a test call that use PATH_TRACING_FD.
(main): Conditionalize expected output for those calls
that do not use PATH_TRACING_FD with [!PATH_TRACING_FD].
* tests/ppoll-P.c: New file.
* tests/pure_executables.list: Add ppoll-P.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (ppoll-P): New entry.
2018-01-17 21:31:07 +00:00
96dbdc342d tests: check path tracing of poll syscall
* tests/poll.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/
is not available.  Add tests calls that use PATH_TRACING_FD.
(main): Conditionalize expected output for those calls
that do not use PATH_TRACING_FD with [!PATH_TRACING_FD].
* tests/poll-P.c: New file.
* tests/pure_executables.list: Add poll-P.
* tests/.gitignore: Likewise.
* tests/poll-P.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add poll-P.test.
2018-01-17 21:31:07 +00:00
Eugene Syromyatnikov
89b39224fd tests: enable old_mmap-P.test on s390x
As s390x is the only 64-bit architecture that has old_mmap,
the test needs some adjustments there.

* tests/old_mmap.c: Update condition.
(main): Change int types to long, extend numerals to 64 bit, change
printing format qualifiers to corresponding long types.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-01-17 04:34:49 +00:00
Eugene Syromyatnikov
afd9e5e801 tests: check path tracing of old mmap syscall
* tests/old_mmap.c [!TEST_FD]: Define TEST_FD.
(main) <args1_c>: Replace 5th argument with TEST_FD.
(main): Wrap the output for the calls that do not use TEST_FD
with #ifndef PATH_TRACING.
* tests/old_mmap-P.c: New file.
* tests/pure_executables.list: Add old_mmap-P.
* tests/.gitignore: Likewise.
* tests/gen_tests.in: Add old_mmap-P test.
2018-01-17 04:34:49 +00:00
Eugene Syromyatnikov
4c34c65d97 Test non-verbose old_mmap output
* tests/old_mmap-v-none.c: New file.  Include old_mmap.c.
* tests/pure_executables.list: Add old_mmap-v-none.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (old_mmap-v-none): New entry.
2018-01-17 04:34:49 +00:00
16046f7773 tests: improve descriptor set syntax testing
* tests/filtering_fd-syntax.test: New file.
* tests/options-syntax.test: Move descriptor set syntax testing
to filtering_fd-syntax.test.
* tests/Makefile.am (MISC_TESTS): Add filtering_fd-syntax.test.

Co-authored-by: Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
2018-01-17 03:22:07 +00:00
Eugene Syromyatnikov
558ece68c8 Add support for specifying compiler options for mpers builds
Because some architectures are very, very special.

* configure.ac (cc_flags_m32, cc_flags_mx32): New variables. AC_SUBST
them.
* m4/mpers.m4 (MPERS_CFLAGS): Use instead of CFLAG, pushdef as
$cc_flags_$1.
Use mpers_name instead of CFLAG in AC_CACHE_CHECK messages.
Pass MPERS_CFLAGS as the second argument to mpers_test.sh
* mpers.sh: Add CC_ARCH_FLAGS as the second argument (PARSER_FILE
is moved to the third one). Do not expect leading dash in ARCH_FLAG
anymore.
* mpers_test.sh (mpers_cc_flags): New variable, initialise to the second
command line argument.
Pass $mpers_name without leading dash to mpers.sh.
Pass $mpers_cc_flags as the second argument to mpers.sh ($sample is
the third argument now).
* Makefile.am (mpers-m%.stamp:): Pass $(mpers_CC_FLAGS) as the second
argument to mpers.sh ($$f is now the third argument).
($(mpers_m32_targets)): Define target variable mpers_CC_FLAGS with the
value of @cc_flags_m32@
($(mpers_mx32_targets)): Define target variable mpers_CC_FLAGS with the
value of @cc_flags_mx32@
* tests/Makefile.am (MERS_CC_FLAGS): New variable.
* bootstrap: Append @cc_flags_$1@ to MPERS_CC_FLAGS. Append
$(MPERS_CC_FLAGS) to ARCH_MFLAGS.
2018-01-16 23:02:35 +01:00
114c7d3e80 tests: improve syscall set syntax testing
* tests/filtering_syscall-syntax.test: New file.
* tests/options-syntax.test: Move syscall set syntax testing
to filtering_syscall-syntax.test.
* tests/qual_fault-syntax.test: Likewise.
* tests/qual_inject-syntax.test: Likewise.
* tests/Makefile.am (MISC_TESTS): Add filtering_syscall-syntax.test.

Co-authored-by: Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
2018-01-16 04:34:25 +00:00
69bd90eb80 Enhance error diagnostics about invalid syscalls in fault injection syntax
Validate syscall set before the whole fault injection syntax.

* filter_qualify.c (parse_inject_expression): Add const qualifier to
return type.  Return an empty string when no syscall set is specified.
(qualify_inject_common): Add const qualifier to "name".  Move
qualify_syscall_tokens invocation right after parse_inject_expression.
* tests/qual_fault-syntax.test: Update expected output.
* tests/qual_inject-syntax.test: Likewise.
2018-01-16 04:34:25 +00:00
24d48dde06 Enhance error diagnostics about invalid syscalls in fault injection syntax
* basic_filters.c (qualify_syscall_tokens): Remove "name" argument,
assume its value is "system call".
* filter.h (qualify_syscall_tokens): Remove "name" argument.
All callers updated.
* tests/qual_fault-syntax.test: Update expected output.
2018-01-15 18:16:31 +00:00
Eugene Syromyatnikov
671f2ffcdc tests: add more checks of reboot syscall decoding
In particular, check for the recent fixes in reboot syscall decoder.

* tests/gen_tests.in (reboot): Provide -s 256 option.
* tests/reboot.c (STR32, STR128): New macros.
(main): Add more checks.
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
ce98c7b297 tests: use sprintrc in reboot.test
* test/reboot.c (main): Use sprintrc instead of old-style manual
printing of return code.
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
7dbc3780a6 Add indication of mpers support to strace -V output
* strace.c (print_version): Append information about m32 and mx32
decoding support.
* tests/strace-V.test: Update expected output.
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
5c3d4b631d Provide strace's native arch to the test framework
* configure.ac (arch_native): New variable, set to arch.
* tests/Makefile.am (NATIVE_ARCH): New variable, set to @arch_native@.
(AM_TEST_LOG_FLAGS): Pass NATIVE_ARCH as STRACE_NATIVE_ARCH environment
variable.
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
8cea0b917a Add indication of optional demangle feature strace -V output
* strace.c (print_version) [USE_DEMANGLE]: Append " stack-demangle"
to the features string.
* tests/strace-V.test: Update expected output.
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
3b871d948f Update perf-related flags
- PERF_SAMPLE_BRANCH_TYPE_SAVE, added in v4.14-rc1~173^2~33^2~6
 - PERF_SAMPLE_PHYS_ADDR, added in v4.14-rc1~173^2~2

* xlat/perf_branch_sample_type.in (PERF_SAMPLE_BRANCH_TYPE_SAVE): New
flag.
* xlat/perf_event_sample_format.in (PERF_SAMPLE_PHYS_ADDR): Likewise.
* tests/perf_event_open.c: Update expected output.
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
7527de8263 perf.c: add support for struct perf_event_attr.namespaces
This field was introduced by linux kernel commit v4.12-rc1~152^2~42^2~10.

* configure.ac (AC_CHECK_MEMBERS): Add  perf_event_attr.namespaces.
* perf_event_struct.h (struct perf_event_attr): Add namespaces field.
* perf.c (print_perf_event_attr): Print namespaces field.
Update comment for __reserved_1 field.
* tests/perf_event_open.c (struct pea_flags): Add namespaces field.
(print_event_attr): Update expected output.
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
fd334b39b0 tests: check decoding of [gs]et_thread_area syscalls on x86
* tests/xet_thread_area_x86.c: New file.
* tests/xet_thread_area_x86.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/.gitignore: Add xet_thread_area_x86.
* tests/pure_executables.list: Likewise.
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
692d8a6e54 tests: check decoding of modify_ldt with for 4-byte-available user_desc
Since there is possibility now that strace read only entry_number field
of the user_desc struct, let's check that it doesn't do it with
modify_ldt syscall.

* tests/modify_ldt.c (main): Add 4-byte-sized tail_alloc'ed variable.
Try to provide it as an argument to modify_ldt.
2018-01-10 01:57:53 +00:00
Eugene Syromyatnikov
1e23e9aab8 tests: move struct user_desc printing function into a separate file
As part of preparation for the introduction of [gs]et_thread_area test.

* tests/modify_ldt.c (print_user_desc): Move it ...
* tests/print_user_desc.c: ... to new file.
* tests/Makefile.am (EXTRA_DIST): Add print_user_desc.c.
2018-01-10 01:57:53 +00:00
Eugene Syromyatnikov
ede97886b8 tests: check decoding of modify_ldt syscall
* tests/modify_ldt.c: New file.
* tests/gen_tests.in: Add modify_ldt test.
* tests/pure_executables.list: Add modify_ldt.
* tests/.gitignore: Likewise.
2018-01-08 00:40:22 +00:00
9cbb505f9f Lift artificial limit on output file names in -ff mode
Starting with commit v4.5.19~88 strace imposed an artificial limit
on output file names in -ff mode, leading to the following absurd
behaviour:

$ strace -ff -o"$(perl -e 'print "/" x 510')/$PWD/log" /bin/true
strace: Can't fopen '////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////.12345': Permission denied

* strace.c (newoutf): Raise buffer size to PATH_MAX.
(init) <followfork >= 2>: Check output file name prefix length.
* tests/options-syntax.test: Check it.
2018-01-04 10:52:07 +00:00
8e959c4db9 unwind: demangle function arguments
* unwind.c (print_stack_frame): Specify demangling style.
* tests/strace-k.test (result): Update regexp.
* tests/strace-k-demangle.test (expected): Update expected output.
2017-12-29 17:59:29 +00:00
51a8225407 tests: check strace -k symbol names demangling
* tests/strace-k-demangle.test: New test.
* tests/stack-fcall-mangled.c: New file.
* tests/stack-fcall-mangled-0.c: Likewise.
* tests/stack-fcall-mangled-1.c: Likewise.
* tests/stack-fcall-mangled-2.c: Likewise.
* tests/stack-fcall-mangled-3.c: Likewise.
* tests/stack-fcall.h [MANGLE] (f0, f1, f2, f3): New macros.
* tests/.gitignore: Add stack-fcall-mangled.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(stack_fcall_mangled_SOURCES): New variable.
(EXTRA_DIST): Add strace-k-demangle.test.
[USE_LIBUNWIND && USE_DEMANGLE] (LIBUNWIND_TESTS): Likewise.
2017-12-29 15:20:21 +00:00
23af76cc12 tests: parametrize strace-k.test
Prepare for the check of strace -k symbol names demangling.

* tests/strace-k.test: Parametrize $test_prog and $expected.
* tests/stack-fcall.h: New file.
* tests/stack-fcall.c: Include "stack-fcall.h"
* tests/stack-fcall-0.c: Likewise.
* tests/stack-fcall-1.c: Likewise.
* tests/stack-fcall-2.c: Likewise.
* tests/stack-fcall-3.c: Likewise.
* tests/Makefile.am (EXTRA_DIST): Add stack-fcall.h.
2017-12-29 15:20:21 +00:00
Harsha Sharma
5453c146dc tests: enhance run.sh usage error diagnostics
* tests/run.sh: Execute timeout command only when invoked with
an argument, otherwise print an error message.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
2017-12-24 12:40:00 +00:00
67c934bf57 tests: skip nsyscalls-d.test on mips o32
On mips o32, nsyscalls test is implemented using syscall #4000,
so nsyscalls-d cannot work there.

* tests/nsyscalls-d.test: Skip on mips o32.
2017-12-23 14:12:18 +00:00
a8e20500ca Remove linux/mtd-abi.h
As linux kernel provides a compatible mtd/mtd-abi.h header since
commit v3.2-rc1~14^2~33, there is no need for a local copy.

* linux/mtd-abi.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* configure.ac (AC_CHECK_TYPES): Check for struct mtd_write_req
in <mtd/mtd-abi.h>.
* ioctl.c (ioctl_decode) <case 'M'>: Conditionalize
on [HAVE_STRUCT_MTD_WRITE_REQ].
* mtd.c: Likewise.
* tests/ioctl_mtd.c: Likewise.
* tests/ioctl.c (main): Likewise.
2017-12-23 02:10:13 +00:00
f236478750 tests: consistently use $STRACE_EXE instead of local alternatives
* tests/get_regs.test: Replace "${STRACE##* }" with "$STRACE_EXE".
* tests/options-syntax.test: Replace "$strace_exp" with "$STRACE_EXE".
* tests/syntax.sh: Likewise.
2017-12-20 22:58:42 +00:00
Eugene Syromyatnikov
51e1f187f0 tests: check (some) debugging output generated during nsyscalls test
* tests/nsyscalls-d.c: New file.
* tests/.gitignore: Add it.
* tests/nsyscalls-d.test: New test, variant of nsyscalls.test with debug
output check.
* tests/nsyscalls-nd.test: Likewise.
* tests/nsyscalls.c: Add expected debug output.
* tests/Makefile.am (check_PROGRAMS): Add nsyscalls-d.
(DECODER_TESTS): Add nsyscalls-d.test and nsyscalls-nd.test.
2017-12-20 22:58:42 +00:00
d55a53c758 tests: check error diagnostics when exec file name is too long
* tests/options-syntax.test: Check error diagnostics when
exec file name length equals to PATH_MAX.
2017-12-14 00:05:04 +00:00
Masatake YAMATO
4f47c43ce7 tests: check decoding of KVM ioctl commands
* tests/ioctl_kvm_run.c: New file.
* tests/ioctl_kvm_run.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add ioctl_kvm_run.test.
* tests/pure_executables.list: Add ioctl_kvm_run.
* tests/.gitignore: Likewise.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-12-04 18:29:38 +00:00
a33747a902 tests: robustify attach-p-cmd.test against buggy kernels
From time to time various kernels, old and new, just go nuts
and fail attach-p-cmd.test with the following diagnostics:

 12345 --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
-12345 chdir("attach-p-cmd.test -p") = -1 ENOENT (No such file or directory)
+12345 syscall_4294967295(0xffe60934, 0x1c0, 0xffe60934, 0x1, 0xffe609b4, 0xffe60a58) = -1 (errno 38)
+12345 chdir("attach-p-cmd.test -p") = -1 ENOSYS (Function not implemented)

Let's workaround this kernel madness by rewriting the test
without use of SIGALRM.

* tests/attach-p-cmd.h: New file.
* tests/Makefile.am (EXTRA_DIST): Add attach-p-cmd.h.
* tests/attach-p-cmd-cmd.c: Include "attach-p-cmd.h".
(write_pidfile, wait_for_peer_invocation): New functions.
(main): Use them.
* tests/attach-p-cmd-p.c: Include <time.h> and "attach-p-cmd.h".
(wait_for_peer_invocation, wait_for_peer_termination): New functions.
(main): Use them.  Do not raise SIGALRM, use nanosleep after peer
termination.
2017-12-03 00:25:43 +00:00
a6e30c11d2 tests: robustify ipc_msgbuf.test against broken libc
glibc between commits glibc-2.25~130 and glibc-2.26~740 had broken
msgctl(IPC_RMID) on hppa: this operation always failed with EINVAL
because of inappropriate use of IPC_64 flag.  Similar issues were
fixed on other niche architectures.  Let's workaround these issues
by skipping the test in case of msgctl(IPC_RMID) failure.

* tests/ipc_msgbuf.c (cleanup): Change return type to int,
return 77 in case of msgctl(IPC_RMID) failure.
(main): Explicitly invoke cleanup() at the end.
2017-12-03 00:25:43 +00:00
3d2a5884ce tests: fix llseek test
* tests/llseek.test: Fix typo.
2017-11-22 00:38:03 +00:00
3e8b3ccd98 tests: simplify bpf test a bit
* tests/bpf.c (DEF_BPF_INIT_FIRST): New macro.
(init_BPF_MAP_CREATE_first, init_BPF_MAP_LOOKUP_ELEM_first,
init_BPF_PROG_LOAD_first, init_BPF_OBJ_PIN_first,
init_BPF_PROG_ATTACH_first, init_BPF_PROG_TEST_RUN_first,
init_BPF_PROG_GET_NEXT_ID_first, init_BPF_OBJ_GET_INFO_BY_FD_first):
Use it.
2017-11-22 00:14:52 +00:00
5c51173830 Implement decoding of BPF_OBJ_GET_INFO_BY_FD command of bpf syscall
* configure.ac (AC_CHECK_MEMBERS): Add union bpf_attr.info.info.
* bpf.c (decode_BPF_OBJ_GET_INFO_BY_FD): New function.
(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use it.
* NEWS: Mention this.
* tests/bpf.c: Add macro guard for BPF_OBJ_GET_INFO_BY_FD decoder test.
[HAVE_UNION_BPF_ATTR_INFO_INFO] (sample_BPF_OBJ_GET_INFO_BY_FD_attr):
New variable.
[HAVE_UNION_BPF_ATTR_INFO_INFO] (init_BPF_OBJ_GET_INFO_BY_FD_first,
print_BPF_OBJ_GET_INFO_BY_FD_first, init_BPF_OBJ_GET_INFO_BY_FD_attr,
print_BPF_OBJ_GET_INFO_BY_FD_attr): New functions.
(main) [HAVE_UNION_BPF_ATTR_INFO_INFO]: Use them.
2017-11-21 23:12:04 +00:00
3a43ce3c07 Implement decoding of BPF_*_GET_*_ID commands of bpf syscall
* configure.ac: Check for union bpf_attr.next_id.
* bpf.c (decode_BPF_PROG_GET_NEXT_ID, decode_BPF_PROG_GET_FD_BY_ID,
* decode_BPF_MAP_GET_FD_BY_ID): New functions.
(decode_BPF_MAP_GET_NEXT_ID): New macro.
(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use them.
* NEWS: Mention this.
* tests/bpf.c: Add macro guard for BPF_*_GET_*_ID decoder tests.
[HAVE_UNION_BPF_ATTR_NEXT_ID] (init_BPF_PROG_GET_NEXT_ID_first,
print_BPF_PROG_GET_NEXT_ID_first, init_BPF_PROG_GET_NEXT_ID_attr,
print_BPF_PROG_GET_NEXT_ID_attr, print_BPF_PROG_GET_FD_BY_ID_first,
print_BPF_PROG_GET_FD_BY_ID_attr, print_BPF_MAP_GET_NEXT_ID_first,
print_BPF_MAP_GET_NEXT_ID_attr): New functions.
(init_BPF_MAP_GET_NEXT_ID_first, print_BPF_MAP_GET_NEXT_ID_first,
init_BPF_MAP_GET_NEXT_ID_attr, print_BPF_MAP_GET_NEXT_ID_attr,
init_BPF_PROG_GET_FD_BY_ID_first, init_BPF_PROG_GET_FD_BY_ID_attr,
init_BPF_MAP_GET_FD_BY_ID_first, init_BPF_MAP_GET_FD_BY_ID_attr):
New macros.
(main) [HAVE_UNION_BPF_ATTR_NEXT_ID]: Use them.
2017-11-21 21:08:19 +00:00
875115da2d Implement decoding of BPF_PROG_TEST_RUN command of bpf syscall
* configure.ac: Check for union bpf_attr.test.duration.
* bpf.c (decode_BPF_PROG_TEST_RUN): New function.
(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use it.
* NEWS: Mention this.
* tests/bpf.c: Include "print_fields.h".
Add macro guard for BPF_PROG_TEST_RUN decoder test.
[HAVE_UNION_BPF_ATTR_TEST_DURATION] (sample_BPF_PROG_TEST_RUN_attr):
New variable.
[HAVE_UNION_BPF_ATTR_TEST_DURATION] (init_BPF_PROG_TEST_RUN_first,
print_BPF_PROG_TEST_RUN_first, init_BPF_PROG_TEST_RUN_attr,
print_BPF_PROG_TEST_RUN_attr): New functions.
(main) [HAVE_UNION_BPF_ATTR_TEST_DURATION]: Use them.
2017-11-20 21:39:59 +00:00
2d95b53db4 bpf: update BPF_MAP_CREATE decoding
Implement decoding of union bpf_attr.numa_node field for BPF_MAP_CREATE
command introduced by linux kernel commit v4.14-rc1~130^2~196^2~1.

* configure.ac: Check for numa_node member of union bpf_attr
instead of inner_map_fd.
(decode_BPF_MAP_CREATE): Add numa_node field to the structure, print it.
* NEWS: Mention this.
* tests/bpf.c: Update macro guards of BPF_MAP_CREATE decoder test.
(init_BPF_MAP_CREATE_first, print_BPF_MAP_CREATE_attr): Update expected
output.
(init_BPF_MAP_CREATE_attr): Initialize numa_node field, update offset.
2017-11-20 21:39:59 +00:00
f340453262 ipc_shm: decode hugetlb page size in shmget flags
Decode alternative hugetlb page sizes introduced by kernel commit
v3.8-rc1~175^2~36.

* ipc_shm.c [!SHM_HUGE_SHIFT] (SHM_HUGE_SHIFT): New macro.
[!SHM_HUGE_MASK] (SHM_HUGE_MASK): Likewise.
(SYS_FUNC(shmget)): Print hugetlb page size.
* tests/ipc_shm.c: Check it.
2017-11-18 01:35:20 +00:00
1898689dbf memfd_create: decode hugetlb page size
Decode alternative hugetlb page sizes introduced by kernel commit
v4.14-rc1~126^2~17.

* configure.ac (AC_CHECK_HEADERS): Add linux/memfd.h.
* memfd_create.c [HAVE_LINUX_MEMFD_H]: Include it.
[!MFD_HUGE_SHIFT] (MFD_HUGE_SHIFT): New macro.
[!MFD_HUGE_MASK] (MFD_HUGE_MASK): Likewise.
(SYS_FUNC(memfd_create)): Print hugetlb page size.
* tests/memfd_create.c: Check it.
2017-11-18 00:19:31 +00:00
c75392f67a Print the first argument of memfd_create syscall as a path
The limit imposed by the kernel on the length of memfd_create first
argument is NAME_MAX - strlen("memfd:").

* memfd_create.c (SYS_FUNC(memfd_create)): Print the first argument
using printpathn.
* tests/memfd_create.c: Check it.
2017-11-18 00:19:31 +00:00
596662a61d mem: decode hugetlb page size in mmap flags
Decode alternative hugetlb page sizes introduced by kernel commit
v3.8-rc1~175^2~36.

* mem.c [!MAP_HUGE_SHIFT] (MAP_HUGE_SHIFT): New macro.
[!MAP_HUGE_MASK] (MAP_HUGE_MASK): Likewise.
(print_mmap_flags): Print hugetlb page size.
* NEWS: Mention it.
* tests/remap_file_pages.c: Check it.
2017-11-17 18:35:06 +00:00
1abb9ffd20 Provide fallback definitions for SHM_EXEC constant
Although SHM_EXEC is available in <linux/shm.h> since kernel commit
v2.6.9-rc2~23^2~93^2~78, the glibc version of <sys/shm.h> did not
provide SHM_EXEC until commit glibc-2.10~238.

* xlat/shm_flags.in (SHM_EXEC): Add fallback definition.
* tests/shmxt.c (SHM_EXEC): Likewise.
2017-11-17 11:26:55 +00:00
bdc500a563 Update SHM_* constants
* xlat/shm_flags.in: Add SHM_EXEC introduced by kernel commit
v2.6.9-rc2~23^2~93^2~78.
* xlat/shm_resource_flags.in: Add SHM_NORESERVE introduced by kernel
commit v2.6.15-rc1~622.
* NEWS: Mention this.
* tests/ipc_shm.c (main): Update expected output.
* tests/shmxt.c (main): Update expected output, check SHM_EXEC decoding.
2017-11-17 00:24:41 +00:00
ba41dc8a70 net: fix SOL_NETLINK NETLINK_LIST_MEMBERSHIPS decoding
NETLINK_LIST_MEMBERSHIPS, unlike all other SOL_NETLINK options, requests
not just a single integer but an array of integers.  The kernel also
supports a zero optlen NETLINK_LIST_MEMBERSHIPS request.

* net.c (print_uint32): New function.
(print_getsockopt): Add ulen argument, rename len argument to rlen,
<SOL_NETLINK> Handle NETLINK_LIST_MEMBERSHIPS using print_array
and print_uint32.
(SYS_FUNC(getsockopt)): Pass ulen to print_getsockopt.
* tests/sockopt-sol_netlink.c (main): Check NETLINK_LIST_MEMBERSHIPS
decoding.
2017-11-16 02:27:40 +00:00
8d481bf4c2 tests: check [gs]etsockopt SOL_NETLINK decoding
* tests/sockopt-sol_netlink.c: New file.
* tests/gen_tests.in (sockopt-sol_netlink): New entry.
* tests/pure_executables.list: Add sockopt-sol_netlink.
* tests/.gitignore: Likewise.
2017-11-16 00:12:46 +00:00