Eugene Syromyatnikov [Wed, 20 Feb 2019 13:52:59 +0000 (14:52 +0100)]
tests: add checks for dumpstr output into read-write test
util.c:dumpstr() now aligns offsets in accordance with the total length
of the dump and also may perform only partial dump, so let's add checks
for these cases.
* tests/fill_memory.c (fill_memory_ex): Change the type of the period
argument from unsigned char to unsigned int.
* tests/tests.h (fill_memory_ex): Likewise.
* tests/read-write.c (dump_str_ex): Rename from dump_str, add idx_w
argument, support len greater than 240 bytes.
(dump_str): New function, wrapper for dump_str_ex with the default index
width.
(print_hex): Add checks for dumpstr output, close fd 1 later.
Eugene Syromyatnikov [Tue, 19 Feb 2019 02:10:11 +0000 (03:10 +0100)]
util: update dumpstr
Use a buffer of a limited size, use proper type for dump amount, avoid
hard-coding of byte counts, calculate output buffer size more accurately
and minimise its rewriting, pad offset with zeros in accordance
with expected output amount.
* defs.h (dumpstr): Change the type of len argument from int to
kernel_ulong_t.
* macros.h (ROUNDUP_DIV): New macro.
(ROUNDUP): Rewrite using ROUNDUP_DIV.
* util.c (ILOG2_ITER_): New macro.
(ilog2_64, ilog2_32): New functions.
(ilog2_klong): New macro, wrapper around ilog2_32/ilog2_64, so (potentially
more expensive) ilog2_64 is not used for ilog2 calculation
of a kernel_ulong_t-typed variable on architectures with 32-bit kernel long.
(dumpstr): Update.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Tue, 19 Feb 2019 01:50:53 +0000 (02:50 +0100)]
Generalise UUID printing
It was open-coded (using yet another open-coded hexadecimal character
printing) in btrfs.c and can be used in other places (like dm.c or
rtnl_link.c).
* defs.h (print_uuid): New declaration.
* print_fields.h (PRINT_FIELD_UUID): New macro.
* util.c (print_uuid): New function.
* btrfs.c (prnibble, UUID_STRING_SIZE, btrfs_unparse_uuid): Remove.
(btrfs_ioctl): Use PRINT_FIELD_UUID for UUID printing.
Eugene Syromyatnikov [Tue, 19 Feb 2019 01:46:58 +0000 (02:46 +0100)]
Generalise some printing primitives
Character class checks and hexadecimal number formatting are open-coded
all over the place, let's try to de-duplicate them a bit.
* print_utils.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* util.c: Include "print_utils.h".
(string_quote, dumpstr): Use sprint_byte_hex and is_print.
* v4l2.c: Include "print_utils.h".
(print_pixelformat): Use is_print and BYTE_HEX_CHARS_PRINTF_QUOTED,
add a note that the routine is rather generic.
Eugene Syromyatnikov [Tue, 19 Feb 2019 02:57:34 +0000 (03:57 +0100)]
Move call_summary() from cleanup() to terminate()
cleanup() has exactly two call sites, die() and terminate(), and the
first one resets cflag in order to prevent call_summary() invocation.
Move the call to terminate() in order to avoid bogus cflag reset.
* strace.c (die): Remove cflag reset.
(cleanup): Move call_summary() call ...
(terminate): ... here.
Eugene Syromyatnikov [Tue, 19 Feb 2019 02:50:25 +0000 (03:50 +0100)]
defs.h: define stack_trace_enabled to 0 is stack tracing is not enabled
This allows avoiding ifdefs sometimes.
* defs.h [!ENABLE_STACKTRACE] (stack_trace_enabled): Define as 0.
* strace.c (init): Remove #ifdef ENABLE_STACKTRACE around -c/-k check.
Dmitry V. Levin [Tue, 19 Feb 2019 01:39:32 +0000 (01:39 +0000)]
build: fix --with-libiberty
* m4/st_demangle.m4 (st_DEMANGLE): Move the check for cplus_demangle
out of AC_CHECK_HEADERS because the latter checks for demangle.h in two
different places and an absence of demangle.h in one of these places
would cause a build error in --with-libiberty=yes mode.
* NEWS: Mention this fix.
Resolves: https://github.com/strace/strace/issues/92
Shankara Pailoor [Sat, 12 Jan 2019 04:59:00 +0000 (20:59 -0800)]
Honor xlat styles when decoding ioprio_get and ioprio_set
* ioprio.c (SYS_FUNC(ioprio_get), SYS_FUNC(ioprio_set)): Add xlat_style
support.
* tests/ioprio-Xabbrev.c: New file.
* tests/ioprio-Xraw.c: Likewise.
* tests/ioprio-Xverbose.c: Likewise.
* tests/ioprio.c: Handle XLAT_RAW, XLAT_ABBREV, and XLAT_VERBOSE macros.
* tests/gen_tests.in (ioprio-Xabbrev, ioprio-Xraw, ioprio-Xverbose): New
tests.
* tests/pure_executables.list: Add ioprio-Xabbrev, ioprio-Xraw, and
ioprio-Xverbose.
* tests/.gitignore: Likewise.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Shankara Pailoor [Sun, 13 Jan 2019 19:37:49 +0000 (11:37 -0800)]
move_pages: honor xlat styles
* numa.c (print_status): Add xlat_style support for status argument.
* tests/move_pages-Xabbrev.c: New file.
* tests/move_pages-Xraw.c: Likewise.
* tests/move_pages-Xverbose.c: Likewise.
* tests/move_pages.c: Handle XLAT_RAW, XLAT_ABBREV, and XLAT_VERBOSE
macros.
* tests/gen_tests.in (move_pages-Xabbrev, move_pages-Xraw,
move_pages-Xverbose): New tests.
* tests/pure_executables.list: Add move_pages-Xabbrev, move_pages-Xraw,
and move_pages-Xverbose.
* tests/.gitignore: Likewise.
Dmitry V. Levin [Mon, 18 Feb 2019 00:29:43 +0000 (00:29 +0000)]
tests: robustify threads-execve test against the odds
Give threads-execve.test more chances to succeed.
* tests/threads-execve.test: Retry the test until run out of time.
Shankara Pailoor [Sat, 12 Jan 2019 03:07:33 +0000 (19:07 -0800)]
Honor xlat styles when decoding resource limits
* resource.c (sprint_rlim64, sprint_rlim32): Remove.
(print_rlim64_t, print_rlim32_t): New functions.
(print_rlimit64, print_rlimit32): Use them.
* tests/setrlimit-Xabbrev.c: New file.
* tests/setrlimit-Xraw.c: Likewise.
* tests/setrlimit-Xverbose.c: Likewise.
* tests/setrlimit.c (main): Handle XLAT_ABBREV, XLAT_RAW,
and XLAT_VERBOSE macros.
* tests/xgetrlimit.c (sprint_rlim): Likewise.
* tests/gen_tests.in (setrlimit-Xabbrev, setrlimit-Xraw,
setrlimit-Xverbose): New tests.
* tests/pure_executables.list: Add setrlimit-Xabbrev, setrlimit-Xraw,
and setrlimit-Xverbose.
* tests/.gitignore: Likewise.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Dmitry V. Levin [Sun, 17 Feb 2019 00:10:26 +0000 (00:10 +0000)]
hppa: workaround kernel bug in syscall number tampering
Linux kernel commit v4.6-rc2~20^2 introduced a regression:
when tracer changes syscall number to -1, the kernel fails
to initialize %r28 with -ENOSYS and subsequently fails
to return the error code of the failed syscall to userspace.
Workaround this by initializing %r28 ourselves.
* linux/arch_defs_.h (ARCH_NEEDS_SET_ERROR_FOR_SCNO_TAMPERING): Define
to 0.
* linux/hppa/arch_defs_.h (ARCH_NEEDS_SET_ERROR_FOR_SCNO_TAMPERING):
Define to 1.
* syscall.c (tamper_with_syscall_entering)
[ARCH_NEEDS_SET_ERROR_FOR_SCNO_TAMPERING]: When changing syscall number
to -1, set the return value as well.
Dmitry V. Levin [Sat, 16 Feb 2019 00:33:38 +0000 (00:33 +0000)]
hppa: define PT_* constants as offsets inside struct pt_regs
Define constants passed to upeek and upoke using a method that works
with different wordsize values.
* linux/hppa/arch_regs.c (PT_GR26, PT_GR30, PT_IAOQ0, PT_IAOQ1): Remove.
(PT_GR20, PT_GR28, ARCH_PC_PEEK_ADDR, ARCH_SP_PEEK_ADDR): Redefine using
offsets inside struct pt_regs.
* linux/hppa/get_syscall_args.c (arch_get_syscall_args): Replace PT_GR26
with offsets inside struct pt_regs.
Dmitry V. Levin [Sat, 16 Feb 2019 00:33:38 +0000 (00:33 +0000)]
hppa: enhance decoding of PTRACE_PEEKUSER and PTRACE_POKEUSER
Print symbolic constants corresponding to numeric arguments
of PTRACE_PEEKUSER and PTRACE_POKEUSER requests.
* linux/hppa/userent.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* NEWS: Mention this.
Dmitry V. Levin [Fri, 15 Feb 2019 21:22:30 +0000 (21:22 +0000)]
mips o32: fix 7th syscall argument with PTRACE_GET_SYSCALL_INFO API
As PTRACE_GET_SYSCALL_INFO API supports 6 syscall arguments,
all architectures that have syscalls with more than 6 arguments
(i.e. mips o32) have to fetch extra arguments manually when using
PTRACE_GET_SYSCALL_INFO API.
* linux/mips/get_syscall_args.c [LINUX_MIPSO32]
(arch_get_syscall_args_extra): New function.
* syscall.c (get_syscall_args) [MAX_ARGS > 6]: Use it.
Fixes: v4.26~49 "Introduce PTRACE_GET_SYSCALL_INFO support"
Dmitry V. Levin [Fri, 15 Feb 2019 21:22:30 +0000 (21:22 +0000)]
mips: update comment
* linux/mips/get_syscall_args.c (decode_syscall_subcall): Update comment.
Complements:
v4.26-27-g2c8b6de91 "mips o32: fix build"
Eugene Syromyatnikov [Fri, 1 Feb 2019 10:04:51 +0000 (11:04 +0100)]
tests: add kill_child test
This tests repeatedly creates and kills children, so some corner
cases in handling of not-quite-existing processes can be observed.
Previously, strace was crashing in the following situation:
13994 ????( <unfinished ...>
...
13994 <... ???? resumed>) = ?
as tcp->s_ent wasn't initialised on syscall entering and
strace.c:print_event_exit segfaulted when tried to access
tcp->s_ent->sys_name.
* tests/kill_child.c: New file.
* tests/kill_child.test: New test.
* tests/.gitignore: Add kill_child.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add kill_child.test.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Dmitry V. Levin [Mon, 11 Feb 2019 23:35:07 +0000 (23:35 +0000)]
Wire up kexec_file_load syscall on architectures that use generic unistd.h
* linux/32/syscallent.h [294]: Wire up kexec_file_load syscall
introduced by linux commit v5.0-rc1~35^2~41^2~15.
* linux/64/syscallent.h [294]: Likewise.
* NEWS: Mention this.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=
1676045
Dmitry V. Levin [Mon, 11 Feb 2019 23:35:07 +0000 (23:35 +0000)]
Wire up rseq syscall on architectures that use generic unistd.h
* linux/32/syscallent.h [293]: Wire up rseq syscall introduced by linux
commit v4.19-rc1~109^2~47.
* linux/64/syscallent.h [293]: Likewise.
* NEWS: Mention this.
Dmitry V. Levin [Mon, 11 Feb 2019 21:00:05 +0000 (21:00 +0000)]
tests: robustify preadv2-pwritev2 test against odd kernels
The test used to assume that either both preadv2 and pwritev2 syscalls
are implemented or both are not implemented, but, apparently, there are
kernels in the wild that implement just preadv2 syscall without
pwritev2.
* tests/preadv2-pwritev2.c (main): Skip the dumpio part of the test
if either preadv2 or pwritev2 syscall is not implemented.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=
1668750
Eugene Syromyatnikov [Sun, 10 Feb 2019 23:57:38 +0000 (00:57 +0100)]
ptrace_restart: do not print diagnostics when ptrace returns ESRCH
After some discussion, it was decided that the situation
when the tracee is gone does not worth reporting.
* strace.c (ptrace_restart): Return early if ptrace returned ESRCH.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=
1662936
Eugene Syromyatnikov [Sun, 10 Feb 2019 23:45:37 +0000 (00:45 +0100)]
ptrace_restart: use xlat-based approach for printing ptrace requests
* defs.h (ptrace_cmds): New prototype.
* strace.c (ptrace_op_str): New function.
(ptrace_restart): Use it.
Dmitry V. Levin [Sun, 10 Feb 2019 21:04:41 +0000 (21:04 +0000)]
Fix whitespace issues
* Makefile.am (strace_SOURCES, EXTRA_DIST): Replace SPACE symbol followed
by TAB symbol with TAB symbol.
* kvm.c (is_map_for_file): Likewise.
* tests/gen_tests.in (ioctl_ptp, printsignal-Xverbose): Likewise.
* xlat/skf_ad.in: Likewise.
Eugene Syromyatnikov [Sun, 10 Feb 2019 18:49:46 +0000 (19:49 +0100)]
Make inline message on failed restart attempt more verbose
Hopefully, now it is less confusing.
* strace.c (ptrace_restart): Provide intent and pid in the inline error
message.
References: https://bugzilla.redhat.com/show_bug.cgi?id=
1662936
Eugene Syromyatnikov [Tue, 29 Jan 2019 14:35:00 +0000 (15:35 +0100)]
syscall.c: set MEMORY_MAPPING_CHANGE in stub sysent
As unknown syscalls may incur unknown side effects.
* syscall.c (stub_sysent): Set sys_flags to MEMORY_MAPPING_CHANGE.
Eugene Syromyatnikov [Tue, 29 Jan 2019 13:40:11 +0000 (14:40 +0100)]
Use accessors for tcp->s_ent, return a stub struct if it is NULL
Since code paths are non-trivial, it's an attempt to future-proof
and prevent improper access of tcp->s_ent fields.
* defs.h (struct tcb): Update the description of s_ent field.
(stub_sysent): New declaration.
(tcp_sysent, n_args): New macro functions.
(indirect_ipccall): Use tcp_sysent() instead of tcp->s_ent.
* ipc.c (SYS_FUNC(ipc)): Use n_args() instead of tcp->s_ent->nargs.
* linux/alpha/get_syscall_args.c (get_syscall_args): Likewise.
* linux/bfin/get_syscall_args.c (get_syscall_args): Likewise.
* linux/hppa/get_syscall_args.c (get_syscall_args): Likewise.
* linux/ia64/get_syscall_args.c (get_syscall_args): Likewise.
* linux/microblaze/get_syscall_args.c (get_syscall_args): Likewise.
* linux/mips/get_syscall_args.c (get_syscall_args): Likewise.
* linux/sh/get_syscall_args.c (get_syscall_args): Likewise.
* linux/sh64/get_syscall_args.c (get_syscall_args): Likewise.
* linux/x86_64/get_syscall_args.c (get_syscall_args): Likewise.
* linux/xtensa/get_syscall_args.c (get_syscall_args): Likewise.
* prctl.c (print_prctl_args): Likewise.
* signal.c (SYS_FUNC(sgetmask)): Likewise.
* util.c (printargs, printargs_u, printargs_d): Likewise.
* syscall.c (decode_ipc_subcall, decode_syscall_subcall: Likewise.
(dumpio, tamper_with_syscall_exiting, syscall_entering_decode,
syscall_entering_decode, syscall_entering_trace, syscall_entering_trace,
syscall_exiting_decode, print_syscall_resume, syscall_exiting_trace,
get_syscall_result): Use tcp_sysent() instead of tcp->s_ent.
(stub_sysent): New stub sysent.
(get_scno): Reset scno, s_ent, qual_flg; initialise s->ent from
stub_sysent.
* pathtrace.c (pathtrace_match_set): Use tcp_sysent() instead of
tcp->s_ent.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Tue, 29 Jan 2019 13:07:46 +0000 (14:07 +0100)]
syscall.c: remove arch check for SEN_execv usage
SEN_* declarations are always present and can be used regardless
of architecture.
* syscall.c (syscall_entering_trace): Remove "#if defined SPARC ||
defined SPARC64" guard.
Eugene Syromyatnikov [Tue, 29 Jan 2019 12:54:23 +0000 (13:54 +0100)]
Merge "<... resumed>" printing
Apparently, it was slightly different with no apparent reason.
Use a single routine to print this message now.
* defs.h (print_syscall_resume): New function declaration.
* strace.c (print_event_exit): Replace open-coding of "<... resumed>"
message printing with a print_syscall_resume() call.
* syscall.c (syscall_exiting_trace): Likewise.
(print_syscall_resume): New function.
* tests/threads-execve.c: Update expected output.
Shankara Pailoor [Wed, 9 Jan 2019 17:09:04 +0000 (09:09 -0800)]
sockaddr: print sin6_flowinfo field before sin6_addr
The sin6_flowinfo field comes before sin6_addr in the sockaddr_in6
defintion, but for some reason we switch the order when decoding.
This patch fixes the order of decoding.
* sockaddr.c (print_sockaddr_data_in6): Print sin6_flowinfo field
before sin6_addr.
* NEWS: Mention this fix.
* tests/group_req.c (main): Update expected output.
* tests/net-sockaddr.c (check_in6_linklocal, check_in6): Likewise.
* tests/net-yy-inet6.c (INADDR_STR, SA_FIELDS): Likewise.
* tests/sockaddr_xlat.c (validate_in6): Likewise.
Dmitry V. Levin [Tue, 8 Jan 2019 19:23:44 +0000 (19:23 +0000)]
mips o32: fix build
Commit
917c2ccf3a67 "Refactor stack pointers" moved mips_REG_* macros
from linux/mips/arch_regs.h to linux/mips/arch_regs.c because these
macros are no longer used outside syscall.c or files included by
syscall.c, but this caused a build regression on mips o32 because
decode_syscall_subcall() uses mips_REG_SP prior to its definition.
* syscall.c (decode_syscall_subcall): Move ...
* linux/mips/get_syscall_args.c: ... here.
* NEWS: Mention this fix.
Reported-by: Baruch Siach <baruch@tkos.co.il>
Fixes: v4.26~61 "Refactor stack pointers"
Baruch Siach [Tue, 8 Jan 2019 16:36:20 +0000 (18:36 +0200)]
Fix build for no-MMU targets
Commit
7488ce9e23f1 "Check whether PTRACE_GET_SYSCALL_INFO is supported
by the kernel" added a fork() call in test_ptrace_get_syscall_info()
which is included in the main strace executable code. Although the
test_ptrace_get_syscall_info() routine is not called on no-MMU targets,
the compiler can't optimize it out because it is a global symbol.
So build for no-MMU targets currently fails:
strace-ptrace_syscall_info.o: In function `test_ptrace_get_syscall_info':
ptrace_syscall_info.c:(.text+0x1c): undefined reference to `fork'
* ptrace_syscall_info.c (test_ptrace_get_syscall_info): Make
the definition depend on HAVE_FORK.
* strace.c (init): Call test_ptrace_get_syscall_info unconditionally.
* NEWS: Mention this fix.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Fixes: v4.26~50 "Check whether PTRACE_GET_SYSCALL_INFO is supported by the kernel"
Baruch Siach [Tue, 8 Jan 2019 17:15:35 +0000 (19:15 +0200)]
linux/mips/.gitignore: drop copyright header
The '/*' in the first line of the copyright header matches all files in
that directory. No other .gitignore file has this header. Drop it.
* linux/mips/.gitignore: Remove copyright header.
Fixes: v4.26~23 "Add copyright headers to some files that lack them"
Shankara Pailoor [Wed, 2 Jan 2019 21:15:28 +0000 (13:15 -0800)]
Honor xlat styles when decoding sockaddr_in, sockaddr_in6, and sockaddr_ll
* print_fields.h (PRINT_FIELD_NET_PORT): Handle xlat styles.
* sockaddr.c (print_sll_protocol): New function.
(print_sockaddr_data_ll, print_inet_addr, print_sockaddr_data_in6):
Handle xlat styles.
* NEWS: Mention this.
* tests/sockaddr_xlat.c: New file.
* tests/sockaddr_xlat-Xabbrev.c: Likewise.
* tests/sockaddr_xlat-Xraw.c: Likewise.
* tests/sockaddr_xlat-Xverbose.c: Likewise.
* tests/Makefile.am (EXTRA_DIST): Add sockaddr_xlat.c.
* tests/gen_tests.in (sockaddr_xlat-Xabbrev, sockaddr_xlat-Xraw,
sockaddr_xlat-Xverbose): New tests.
* tests/pure_executables.list: Add sockaddr_xlat-Xabbrev,
sockaddr_xlat-Xraw, and sockaddr_xlat-Xverbose.
* tests/.gitignore: Likewise.
Dmitry V. Levin [Mon, 7 Jan 2019 23:30:52 +0000 (23:30 +0000)]
Remove PRINT_FIELD_INET4_ADDR
Reduce code duplication by removing PRINT_FIELD_INET4_ADDR
and using PRINT_FIELD_INET_ADDR instead.
* print_fields.h (PRINT_FIELD_INET4_ADDR): Remove.
* msghdr.c (print_cmsg_ip_pktinfo): Use PRINT_FIELD_INET_ADDR
instead of PRINT_FIELD_INET4_ADDR.
* net.c (print_mreq): Likewise.
* sockaddr.c (print_sockaddr_data_in): Likewise.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update REL_* constants
* xlat/evdev_relative_axes.in (REL_HWHEEL_HI_RES): New constant
introduced by Linux kernel commit v5.0-rc1~18^2^7~7.
* NEWS: Mention this.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update UDP_* constants
* xlat/sock_udp_options.in (UDP_GRO): New constant introduced
by Linux kernel commit v5.0-rc1~129^2~379^2~8.
* NEWS: Mention this.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update FAN_* constants
* xlat/fan_event_flags.in (FAN_OPEN_EXEC, FAN_OPEN_EXEC_PERM): New
constants introduced by Linux kernel commits v5.0-rc1~124^2~5
and v5.0-rc1~124^2~3, respectively.
* NEWS: Mention this.
* tests/fanotify_mark.c (main): Update expected output.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update SCTP_* constants
* xlat/sock_sctp_options.in (SCTP_EVENT): New constant introduced
by Linux kernel commit v5.0-rc1~129^2~255^2.
* NEWS: Mention this.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update IFLA_* constants
* xlat/rtnl_ifla_info_data_bridge_attrs.in (IFLA_BR_MULTI_BOOLOPT): New
constant introduced by Linux kernel commit v5.0-rc1~129^2~207^2~2.
* NEWS: Mention this.
* tests/nlattr_ifla_linkinfo.c (main): Update.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update NETNSA_* constants
* xlat/rtnl_nsid_attrs.in (NETNSA_TARGET_NSID, NETNSA_CURRENT_NSID): New
constants introduced by Linux kernel commits v5.0-rc1~129^2~201^2~2
and v5.0-rc1~129^2~201^2, respectively.
* rtnl_nsid.c (rtgenmsg_nla_decoders): Add NETNSA_TARGET_NSID
and NETNSA_CURRENT_NSID.
* NEWS: Mention this.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update SECCOMP_* constants
* xlat/seccomp_ops.in (SECCOMP_GET_NOTIF_SIZES): New constant introduced
by Linux kernel commit v5.0-rc1~66^2~1^2~1.
* xlat/seccomp_ret_action.in (SECCOMP_RET_USER_NOTIF): Likewise.
* xlat/seccomp_filter_flags.in (SECCOMP_FILTER_FLAG_NEW_LISTENER):
Likewise.
* NEWS: Mention this.
* tests/seccomp-filter.c (main): Update expected output.
* tests/seccomp-filter-v.c (main): Likewise.
* tests/seccomp_get_action_avail.c (main): Check SECCOMP_RET_USER_NOTIF.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update NT_* constants
* xlat/nt_descriptor_types.in (NT_ARM_PAC_MASK, NT_MIPS_MSA): New
constants introduced by Linux kernel commits v5.0-rc1~35^2~21
and v5.0-rc1~30^2~58, respectively.
* NEWS: Mention this.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update PR_* constants
* xlat/prctl_options.in (PR_PAC_RESET_KEYS): New constant introduced
by Linux kernel commit v5.0-rc1~35^2~19.
* NEWS: Mention this.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update V4L2_* constants
* xlat/v4l2_buf_types.in (V4L2_BUF_TYPE_META_OUTPUT): New constant
introduced by Linux kernel commit v5.0-rc1~181^2~21.
* xlat/v4l2_device_capabilities_flags.in (V4L2_CAP_META_OUTPUT):
Likewise.
* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_CNF4): New constant introduced
by Linux kernel commit v5.0-rc1~182^2~120.
* NEWS: Mention this.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update KVM_CAP_* constants
* xlat/kvm_cap.in (KVM_CAP_MANUAL_DIRTY_LOG_PROTECT,
KVM_CAP_HYPERV_CPUID): New constants introduced by Linux kernel commits
v5.0-rc1~156^2~115 and v5.0-rc1~156^2~74, respectively.
* NEWS: Mention this.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update NDA_* constants
* xlat/rtnl_neigh_attrs.in (NDA_PROTOCOL): New constant introduced
by Linux kernel commit v5.0-rc1~129^2~79.
* rtnl_neigh.c (ndmsg_nla_decoders): Add NDA_PROTOCOL.
* NEWS: Mention this.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update BTRFS_FEATURE_INCOMPAT_* constants
* xlat/btrfs_features_incompat.in
(BTRFS_FEATURE_INCOMPAT_METADATA_UUID): New constant introduced by Linux
kernel commit v5.0-rc1~126^2~64.
* NEWS: Mention this.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update *_MAGIC constants
* xlat/fsmagic.in (BINDERFS_SUPER_MAGIC): New constant introduced
by Linux kernel commit v5.0-rc1~95^2~15.
* NEWS: Mention this.
Dmitry V. Levin [Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)]
xlat: update KERN_* constants
* xlat/sysctl_kern.in (KERN_PANIC_ON_WARN, KERN_PANIC_PRINT): New
constants introduced by Linux kernel commits v3.19-rc1~135^2~91
and v5.0-rc1~38^2~16, respectively.
* configure.ac (AC_CHECK_DECLS): Add them.
* NEWS: Mention this.
Dmitry V. Levin [Thu, 3 Jan 2019 23:36:22 +0000 (23:36 +0000)]
xlat: update BPF_F_* constants
* xlat/bpf_map_flags.in (BPF_F_ZERO_SEED): New constant introduced
by Linux kernel commit v5.0-rc1~129^2~114^2~18^2~3.
* xlat/bpf_prog_flags.in (BPF_F_ANY_ALIGNMENT): New constant introduced
by Linux kernel commit v5.0-rc1~129^2~209^2~17^2~3.
* NEWS: Mention this.
* tests/bpf.c (BPF_MAP_CREATE_checks, BPF_PROG_LOAD_checks,
print_BPF_PROG_LOAD_attr3, print_BPF_PROG_LOAD_attr4): Update.
Martin Lau [Thu, 3 Jan 2019 23:36:22 +0000 (23:36 +0000)]
tests: fix prog_info initialization in bpf-obj_get_info_by_fd-prog*
The sys_bpf(BPF_OBJ_GET_INFO_BY_FD, &bpf_prog_get_info_attr, ...) is
called in a loop. The bpf_prog_get_info_attr.info object is in size 104
but bpf_prog_get_info_attr.info_len is in size 168. Hence, if the prog
is jited, the second iteration onwards will have nr_jited_ksyms == 1
which is asking the kernel to fill the
bpf_prog_get_info_attr.info.jited_ksyms and it is NULL.
* tests/bpf-obj_get_info_by_fd.c (main): Clear memory beyond prog_info
at the start of every iteration.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Dmitry V. Levin [Thu, 3 Jan 2019 23:36:22 +0000 (23:36 +0000)]
tests: use tail_alloc instead of calloc in bpf-obj_get_info_by_fd-prog*
This guarantees that map_info and prog_info objects are not accessed
out of bounds.
* tests/bpf-obj_get_info_by_fd.c: Include <string.h>.
(main): Use tail_alloc instead of calloc for map_info and prog_info.
Dmitry V. Levin [Wed, 2 Jan 2019 00:29:09 +0000 (00:29 +0000)]
Bring lists back to the sorted order
* .gitignore: Make the list sorted again.
* Makefile.am (strace_SOURCES): Likewise.
* tests/.gitignore: Likewise.
* tests/gen_tests.in: Likewise.
* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, EXTRA_DIST):
Likewise.
Dmitry V. Levin [Tue, 1 Jan 2019 21:36:08 +0000 (21:36 +0000)]
tests: fix strace-k.test on alpha
Change strace-k.test to use chdir syscall instead of getpid syscall
because the latter is not universally available, e.g. there is no getpid
syscall on alpha.
* tests/stack-fcall-3.c (f3) <default>: Replace getpid with chdir.
* tests/strace-k.test: Likewise.
* tests/strace-k.expected: Likewise.
* tests/strace-k-demangle.expected: Likewise.
* NEWS: Mention this.
Dmitry V. Levin [Sun, 30 Dec 2018 15:35:21 +0000 (15:35 +0000)]
Fix preprocessor indentation
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
Dmitry V. Levin [Sun, 30 Dec 2018 15:35:21 +0000 (15:35 +0000)]
Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.26-1.
* strace.spec.in: Likewise.
Dmitry V. Levin [Wed, 26 Dec 2018 18:25:10 +0000 (18:25 +0000)]
Prepare for 4.26 release
* NEWS: Update for 4.26 release.
Dmitry V. Levin [Wed, 26 Dec 2018 18:25:10 +0000 (18:25 +0000)]
strace.spec.in: add a comment about the license
Gleb Fotengauer-Malinovskiy [Wed, 26 Dec 2018 16:57:01 +0000 (19:57 +0300)]
Update ioctl entries from linux v4.20
* linux/32/ioctls_inc_align16.h: Update from linux v4.20
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.
* linux/mips/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/s390x/ioctls_arch0.h: Likewise.
* NEWS: Mention this.
Gleb Fotengauer-Malinovskiy [Wed, 26 Dec 2018 16:56:18 +0000 (19:56 +0300)]
maint: update for linux 4.20
* maint/ioctls_sym.sh: Include linux/compiler_attributes.h in every
processed file.
Use asm/ioctls.h workaround for asm-generic/ioctls.h too.
Dmitry V. Levin [Wed, 26 Dec 2018 03:38:33 +0000 (03:38 +0000)]
xlat: update BPF_* constants
* xlat/bpf_map_types.in (BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE): New
constant introduced by Linux kernel commit v4.20-rc1~14^2~124^2~12^2~7.
(BPF_MAP_TYPE_QUEUE, BPF_MAP_TYPE_STACK): New constants introduced
by Linux kernel commit v4.20-rc1~151^2~32^2~11^2~3.
* xlat/bpf_commands.in (BPF_MAP_LOOKUP_AND_DELETE_ELEM): New constant
introduced by Linux kernel commit v4.20-rc1~151^2~32^2~11^2~2.
* tests/bpf.c (BPF_MAP_CREATE_checks): Update.
Eugene Syromyatnikov [Fri, 14 Dec 2018 16:25:24 +0000 (17:25 +0100)]
xlat: add PR_SPEC_INDIRECT_BRANCH to pr_spec_cmds
* xlat/pr_spec_cmds.in (PR_SPEC_INDIRECT_BRANCH): New constant,
introduced by Linux commit v4.20-rc5~4^2~3.
* prctl.c (SYS_FUNC(prctl)) <case PR_GET_SPECULATION_CTRL, case
PR_SET_SPECULATION_CTRL>: Add PR_SPEC_INDIRECT_BRANCH handling.
* tests/prctl-spec-inject.c (main): Add PR_SPEC_INDIRECT_BRANCH decoding
checks, update expected output.
* NEWS: Mention this.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Thu, 1 Nov 2018 17:18:29 +0000 (18:18 +0100)]
xlat: update V4L2_CID_* and V4L2_PIX_FMT_* constants
* xlat/v4l2_control_ids.in (V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS,
V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION): New constants, introduced
by Linux commit v4.20-rc1~51^2~4.
* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_MPEG2_SLICE): Likewise.
(V4L2_PIX_FMT_SUNXI_TILED_NV12): New constant, introduced by Linux
commit v4.20-rc1~51^2~3.
* NEWS: Mention this.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Thu, 1 Nov 2018 17:10:06 +0000 (18:10 +0100)]
xlat: add ABS_RESERVED to evdev_abs
* xlat/evdev_abs.in (ABS_RESERVED): New constant, introduced by Linux
commit v4.20-rc1~133^2~2^2.
* NEWS: Mention this.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Thu, 1 Nov 2018 17:08:15 +0000 (18:08 +0100)]
xlat: add REL_RESERVED and REL_WHEEL_HI_RES to evdev_relative_axes
* xlat/evdev_relative_axes.in (REL_RESERVED): New constant, introduced
by Linux commit v4.20-rc1~133^2~2^2.
(REL_WHEEL_HI_RES): New constant, introduced by Linux commit
v4.20-rc1~133^2~2^2~6 and updated by Linux commit v4.20-rc1~133^2~2^2.
* NEWS: Mention this.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Sun, 23 Sep 2018 22:43:52 +0000 (00:43 +0200)]
xlat: update kvm_cap
* xlat/kvm_cap.in (KVM_CAP_NESTED_STATE): New constant, introduced
by Linux commit v4.19-rc1~87^2~62.
(KVM_CAP_ARM_INJECT_SERROR_ESR): New constant, introduced by Linux
commit v4.19-rc1~55^2~12^2~14, merged with its final value
in v4.19-rc1~55^2~12.
(KVM_CAP_MSR_PLATFORM_INFO): New constant, introduced by Linux commit
v4.19-rc5~8^2~2.
(KVM_CAP_PPC_NESTED_HV): New constant, introduced by Linux commit
v4.20-rc1~113^2~107^2~1.
(KVM_CAP_HYPERV_SEND_IPI): New constant, introduced by Linux commit
v4.20-rc1~113^2~72.
KVM_CAP_COALESCED_PIO): New constant, introduced by Linux commit
v4.20-rc1~113^2~31.
(KVM_CAP_HYPERV_ENLIGHTENED_VMCS): New constant, introduced by Linux
commit v4.20-rc1~113^2~25.
(KVM_CAP_EXCEPTION_PAYLOAD): New constant, introduced by Linux commit
v4.20-rc1~113^2~8.
(KVM_CAP_ARM_VM_IPA_SIZE): New constant, introduced by Linux commit
v4.20-rc1~113^2~5^2~8 and updated by Linux commit
v4.20-rc1~113^2~5.
* NEWS: Mention this.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Thu, 1 Nov 2018 16:34:10 +0000 (17:34 +0100)]
xlat: add IFA_TARGET_NETNSID to rtnl_addr_attrs
* xlat/rtnl_addr_attrs.in (IFA_TARGET_NETNSID): New constant, introduced
by Linux commit v4.20-rc1~14^2~428^2~7.
* NEWS: Mention this.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Thu, 1 Nov 2018 16:29:29 +0000 (17:29 +0100)]
xlat: update neighbor_cache_entry_flags
* xlat/neighbor_cache_entry_flags.in (NTF_OFFLOADED): New constant,
introduced by Linux commit v4.13-rc1~157^2~252^2~13.
(NTF_STICKY): New constant, introduced by Linux commit
v4.20-rc1~14^2~392.
(NTF_USE, NTF_SELF, NTF_MASTER, NTF_PROXY, NTF_EXT_LEARNED, NTF_ROUTER):
Add fallback definitions.
* NEWS: Mention this.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Thu, 1 Nov 2018 16:15:24 +0000 (17:15 +0100)]
xlat: add flow dissector bpf program type constants
* xlat/bpf_attach_type.in (BPF_FLOW_DISSECTOR): New constant
introduced by Linux commit v4.20-rc1~14^2~259^2~9^2~4.
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_FLOW_DISSECTOR): Likewise.
* NEWS: Mention this.
* tests/bpf.c (BPF_PROG_LOAD_checks, BPF_PROG_QUERY_checks): Update.
* tests/kernel_version.c (print_bpf_attr): Update.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Thu, 1 Nov 2018 16:01:29 +0000 (17:01 +0100)]
rtnl_tc: add TCA_STATS_BASIC_HW
* xlat/rtnl_tca_stats_attrs.in (TCA_STATS_BASIC_HW): New constant,
introduced by Linux commit v4.20-rc1~14^2~274^2~1.
* rtnl_tc.c (tca_stats_nla_decoders): Add TCA_STATS_BASIC_HW.
* NEWS: Mention this.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Thu, 1 Nov 2018 15:41:01 +0000 (16:41 +0100)]
xlat: add NETLINK_DUMP_STRICT_CHK to sock_netlink_options
* xlat/sock_netlink_options.in (NETLINK_DUMP_STRICT_CHK): New constant,
introduced by Linux commit v4.20-rc1~14^2~130^2~17.
* NEWS: Mention this.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Thu, 1 Nov 2018 15:31:14 +0000 (16:31 +0100)]
xlat: add IFLA_BR_VLAN_STATS_PER_PORT to rtnl_ifla_info_data_bridge_attrs
* xlat/rtnl_ifla_info_data_bridge_attrs.in
(IFLA_BR_VLAN_STATS_PER_PORT): New constant, introduced by Linux commit
v4.20-rc1~14^2~90.
* rtnl_link.c (ifla_info_data_bridge_nla_decoders): Add
IFLA_BR_VLAN_STATS_PER_PORT.
* NEWS: Mention this.
* tests/nlattr_ifla_linkinfo.c (main): Check it.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Sat, 20 Oct 2018 04:16:05 +0000 (06:16 +0200)]
xlat: add TCP_CLOSE to netlink_states
* xlat/netlink_states.in: Decode state 7 as TCP_CLOSE, since that's what
net core sets socket's initial state to.
Eugene Syromyatnikov [Mon, 15 Oct 2018 15:56:42 +0000 (17:56 +0200)]
xlat: add fallback definitions to setsock_ipv6_options
* xlat/setsock_ipv6_options.in: Add fallback definitions.
Eugene Syromyatnikov [Mon, 15 Oct 2018 15:32:01 +0000 (17:32 +0200)]
xlat: add SOL_CAN_* to socketlayers
* xlat/socketlayers.in (SOL_CAN_BASE): New constant, introduced by Linux
commit v2.6.25-rc1~1162^2~1414.
(SOL_CAN_RAW): New constant, introduced by Linux commit
v2.6.25-rc1~1162^2~1413.
* NEWS: Mention this.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Mon, 10 Sep 2018 23:45:30 +0000 (01:45 +0200)]
xlat: add FAN_ENABLE_AUDIT and FAN_REPORT_TID to fan_init_flags
* xlat/fan_init_flags.in (FAN_ENABLE_AUDIT): New constant, introduced
by Linux commit v4.15-rc1~130^2^2~11.
(FAN_REPORT_TID): New constant, introduced by Linux commit
v4.20-rc1~75^2~2.
* NEWS: Mention this.
* tests/fanotify_init.c (main): Update expected output.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Mon, 15 Oct 2018 15:47:01 +0000 (17:47 +0200)]
xlat: update siginfo_codes
* xlat/siginfo_codes.in (SI_LWP): Remove, as it is not present on Linux.
(SI_NOINFO): Define only on SPARC, provide fallback value.
Eugene Syromyatnikov [Fri, 26 Oct 2018 00:03:40 +0000 (02:03 +0200)]
loop: use XLAT_MACROS_ONLY instead of #stop
As the former allows controlling presence of xlat definitions
during the inclusion and not header generation.
* xlat/loop_cmds.in: Remove #stop.
* loop.c: Wrap "xlat/loop_cmds.h" inclusion in XLAT_MACROS_ONLY.
* tests/ioctl_loop.c: Likewise.
Eugene Syromyatnikov [Wed, 26 Sep 2018 16:28:55 +0000 (18:28 +0200)]
syslog: move constant definitions to xlat
* syslog.c (enum): Remove.
* xlat/syslog_action_type.in: Add fallback definitions.
Dmitry V. Levin [Mon, 24 Dec 2018 23:46:43 +0000 (23:46 +0000)]
Add copyright headers to some files that lack them
We do our best to keep copyright headers up to date, yet
git history provides better information on this subject
and is more accurate than copyright headers.
Dmitry V. Levin [Mon, 24 Dec 2018 23:46:43 +0000 (23:46 +0000)]
Update copyright headers
Dmitry V. Levin [Mon, 24 Dec 2018 20:00:11 +0000 (20:00 +0000)]
Update NEWS
Eugene Syromyatnikov [Tue, 4 Sep 2018 18:30:30 +0000 (20:30 +0200)]
strace.1.in: consistently use CTRL-combinations
Eugene Syromyatnikov [Tue, 4 Sep 2018 14:45:04 +0000 (16:45 +0200)]
strace.1.in: print names of entities in bold, provide man page sections
* strace.1.in (.SH DESCRIPTION, .SH OPTIONS): Add man page section
numbers. Make mentions of strace and other entities bold.
Dmitry V. Levin [Mon, 24 Dec 2018 20:00:11 +0000 (20:00 +0000)]
strace.1.in: document %net
* strace.1.in: Mention %net as a synonym to %network.
Complements:
v4.25-21-g97c3deca5 "basic_filters: add %net as a possible designation for network syscalls"
Shankara Pailoor [Wed, 19 Dec 2018 13:01:40 +0000 (05:01 -0800)]
quotactl: add xlat styles support
* quota.c (print_qcmd): New function.
(SYS_FUNC(quotactl)): Use it to print the quotactl command.
* tests/quotactl.c (print_dqinfo, print_dqfmt): Handle XLAT_RAW
and XLAT_VERBOSE.
(QUOTA_STR, QUOTA_ID_STR, QUOTA_STR_INVALID): New macros.
(gen_quotacmd, gen_quotaid): New functions.
(main): Use them.
* tests/quotactl-Xabbrev.c: New file.
* tests/quotactl-Xraw.c: Likewise.
* tests/quotactl-Xverbose.c: Likewise.
* tests/gen_tests.in (quotactl-Xabbrev, quotactl-Xraw,
quotactl-Xverbose): New tests.
* tests/pure_executables.list: Add quotactl-Xabbrev, quotactl-Xraw,
and quotactl-Xverbose.
* tests/.gitignore: Likewise.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Dmitry V. Levin [Mon, 24 Dec 2018 10:19:24 +0000 (10:19 +0000)]
xlat_idx: do not issue warnings for holes in indices
Some xlat indices like evdev_abs have holes, avoid issuing warnings
about them.
* xlat.c (xlat_idx): Do not issue warnings for holes in the index.
Dmitry V. Levin [Sun, 23 Dec 2018 22:12:36 +0000 (22:12 +0000)]
rtnl_link: fix off-by-one errors in indexed and sorted xlat lookups
* rtnl_link.c (decode_nla_tun_type, decode_ifla_xdp_attached,
decode_ifla_inet_conf, decode_ifla_inet6_flags, decode_ifla_inet6_conf,
decode_ifla_inet6_stats, decode_ifla_inet6_icmp6_stats,
decode_ifla_inet6_agm): Decrement xlat size by one to account
for XLAT_END as other users of indexed and sorted xlats do.
Fixes: v4.25~71 "rtnl_link: decode named constants for IFLA_XDP_ATTACHED attribute value"
Fixes: v4.23~41 "rtnl_link: decode IFLA_AF_SPEC"
Fixes: v4.23~37 "rtnl_link: implement IFLA_INFO_DATA for tun devices"
Dmitry V. Levin [Sun, 23 Dec 2018 22:12:36 +0000 (22:12 +0000)]
net: fix off-by-one error in sorted xlat lookup
* net.c (ax25_protocols): Decrement xlat size by one to account
for XLAT_END as other users of sorted xlats do.
Fixes: v4.25~28 "net: add support for AX.25 protocols and socket option names decoding"
Dmitry V. Levin [Sun, 23 Dec 2018 22:12:36 +0000 (22:12 +0000)]
netlink_smc_diag: fix off-by-one error in xlat lookup
* netlink_smc_diag.c (decode_smc_diag_shutdown): Decrement xlat size
by one to account for XLAT_END as other users of xlats do.
Fixes: v4.25~54 "netlink_smc_diag: decode SMC_DIAG_SHUTDOWN attribute value"
Dmitry V. Levin [Sun, 23 Dec 2018 22:12:36 +0000 (22:12 +0000)]
aio: fix off-by-one error in indexed xlat lookup
* aio.c (tprint_lio_opcode): Decrement xlat size by one to account
for XLAT_END as other users of indexed xlats do.
Fixes: v4.24~71 "aio: print IOCB_CMD_* using xlat"
Dmitry V. Levin [Sun, 23 Dec 2018 22:12:36 +0000 (22:12 +0000)]
nlattr: fix off-by-one error in indexed xlat lookup
* nlattr.c (decode_nla_meminfo): Decrement xlat size by one
to account for XLAT_END as other users of indexed xlats do.
Fixes: v4.23~89 "nlattr: print index names in netlink meminfo array"
Eugene Syromiatnikov [Thu, 20 Dec 2018 15:35:27 +0000 (16:35 +0100)]
evdev: fix off-by-one error in decode_bitset
* evdev.c (decode_bitset): Decrement sorted/indexed xlat's size by one
in order to account for guarding XLAT_END, as other sorted/indexed xlat
wrappers do.
Fixes: v4.23~261 "evdev: support various types of xlats in decode_bitset"
Dmitry V. Levin [Sat, 22 Dec 2018 22:16:03 +0000 (22:16 +0000)]
strace: terminate itself if interrupted by a signal
* strace.c (terminate): Terminate itself if interrupted by a signal.
* NEWS: Mention this change.
* tests/detach-running.test: Check it.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
Shankara Pailoor [Thu, 20 Dec 2018 13:27:40 +0000 (05:27 -0800)]
tests: check that printsignal handles xlat styles properly
* tests/printsignal.c: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/printsignal-Xabbrev.c: New file.
* tests/printsignal-Xraw.c: Likewise.
* tests/printsignal-Xverbose.c: Likewise.
* tests/gen_tests.in (printsignal-Xabbrev, printsignal-Xraw,
printsignal-Xverbose): New tests.
* tests/pure_executables.list: Add printsignal-Xabbrev,
* printsignal-Xraw, and printsignal-Xverbose.
* tests/.gitignore: Likewise.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Sun, 7 Oct 2018 03:25:33 +0000 (05:25 +0200)]
signal: return NULL if signal number has no string representation
Also return NULL if signal number is 0.
* signal.c (signame): Return NULL if signal name has not been found.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Dmitry V. Levin [Sat, 22 Dec 2018 18:58:51 +0000 (18:58 +0000)]
filter_qualify: prepare for the change of signame semantics
* filter_qualify.c (sigstr_to_uint): Check signame return value.
Eugene Syromyatnikov [Sun, 7 Oct 2018 03:23:09 +0000 (05:23 +0200)]
Use sprintsigname for converting signal number to string
As signame is being converted to an xlookup-like function, a separate
routine is needed in order to get string representation of signal.
* defs.h (sprintsigname): New prototype.
* signal.c (sprintsigname): New function.
* strace.c (print_debug_info, print_signalled, print_stopped): Use it
instead of signame.
* wait.c (printstatus): Likewise.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov [Sun, 7 Oct 2018 03:12:42 +0000 (05:12 +0200)]
Use printsignal instead of signame
As the former respects xlat styles while the latter doesn't.
* clone.c (SYS_FUNC(clone)): Use printsignal for printing termination
signal in printflags.
* fcntl.c (print_fcntl) <case F_SETSIG>: Use printsignal.
* prctl.c (SYS_FUNC(prctl)) <case PR_GET_PDEATHSIG,
case PR_SET_PDEATHSIG>: Likewise.
* print_sigevent.c (print_sigevent): Likewise.
* s390.c (s390_runtime_instr): Likewise.
* signal.c (SYS_FUNC(kill), SYS_FUNC(tgkill)): Likewise.
Eugene Syromyatnikov [Sun, 7 Oct 2018 03:09:09 +0000 (05:09 +0200)]
signal: make printisgnal honor xlat style
* signal.c (printsignal): Respect current xlat style.