]> granicus.if.org Git - strace/log
strace
5 years agotests: extend test coverage of RND* ioctl commands
Dmitry V. Levin [Mon, 5 Nov 2018 17:40:36 +0000 (17:40 +0000)]
tests: extend test coverage of RND* ioctl commands

* tests/ioctl_random.c (main): Check the error path of RNDADDENTROPY
parser.  Check decoding of unrecognized RND* ioctl commands.

5 years agoAdd support for /dev/[u]random ioctls
Rasmus Villemoes [Mon, 5 Nov 2018 17:29:00 +0000 (17:29 +0000)]
Add support for /dev/[u]random ioctls

* random_ioctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (DECL_IOCTL): Add random.
* ioctl.c (ioctl_decode): Add 'R' case.
* xlat/random_ioctl_cmds.in: New file.
* tests/ioctl_random.c: New file.
* tests/.gitignore: Add ioctl_random.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (ioctl_random): New entry.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
5 years agoAdd dist/INSTALL
Eugene Syromyatnikov [Wed, 16 May 2018 00:22:44 +0000 (02:22 +0200)]
Add dist/INSTALL

* dist/INSTALL: New file.
* bootstrap: Copy it.
* .gitignore: Add /INSTALL.

References: https://github.com/strace/strace/issues/17
References: https://github.com/strace/strace/issues/55
Closes: https://github.com/strace/strace/issues/67
5 years agoRename INSTALL to README-configure
Eugene Syromyatnikov [Tue, 13 Mar 2018 13:11:01 +0000 (14:11 +0100)]
Rename INSTALL to README-configure

* INSTALL-git.md: Replace INSTALL with README-configure.
* maint/install.texi: Likewise.
* INSTALL: Rename to README-configure, regenerate.
* Makefile.am (EXTRA_DIST): Add README-configure.

References: https://github.com/strace/strace/issues/85
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
5 years agodist/README: add more references
Eugene Syromyatnikov [Tue, 4 Sep 2018 14:32:25 +0000 (16:32 +0200)]
dist/README: add more references

* dist/README: Mention README-hacking, add links to repositories
and the mailing list archive.

Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
5 years agoREADME.md: add a link to the new contributors guide
Eugene Syromyatnikov [Tue, 4 Sep 2018 13:54:30 +0000 (15:54 +0200)]
README.md: add a link to the new contributors guide

* README.md: Add a link to the Guide of new contributors.

Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>
5 years agoPost-release administrivia
Dmitry V. Levin [Tue, 30 Oct 2018 10:43:31 +0000 (10:43 +0000)]
Post-release administrivia

* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.25-1.
* strace.spec.in: Likewise.

5 years agoPrepare for 4.25 release v4.25
Dmitry V. Levin [Tue, 30 Oct 2018 08:09:10 +0000 (08:09 +0000)]
Prepare for 4.25 release

* NEWS: Update for 4.25 release.

5 years agoUpdate copyright headers
Dmitry V. Levin [Tue, 30 Oct 2018 08:09:10 +0000 (08:09 +0000)]
Update copyright headers

Headers updated automatically using maint/update_copyright_years.sh
script.

5 years agoUpdate NEWS
Dmitry V. Levin [Thu, 25 Oct 2018 10:37:49 +0000 (10:37 +0000)]
Update NEWS

5 years agoImplement decoding of NBD_* ioctl commands
Elvira Khabirova [Sat, 22 Sep 2018 13:09:50 +0000 (15:09 +0200)]
Implement decoding of NBD_* ioctl commands

* nbd_ioctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (DECL_IOCTL): Add nbd.
* ioctl.c (ioctl_decode): Add 0xab (nbd) case.
* xlat/nbd_ioctl_cmds.in: Likewise.
* xlat/nbd_ioctl_flags.in: Likewise.
* tests/ioctl_nbd.c: Likewise.
* tests/.gitignore: Add ioctl_nbd.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (ioctl_nbd): New entry.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
5 years agotests: fix build with recent kernel headers
Dmitry V. Levin [Thu, 25 Oct 2018 13:36:54 +0000 (13:36 +0000)]
tests: fix build with recent kernel headers

Linux commit v4.19-rc2-5-g2ecefa0a15fd0ef88b9cd5d15ceb813008136431
changed the definition of struct keyctl_dh_params in an incompatible
way again.  Workaround this issue by using designated initializers.

* tests/keyctl.c (main): Use designated initializers for
struct keyctl_dh_params.

5 years agoarm, sparc, sparc64: wire up io_pgetevents
Dmitry V. Levin [Wed, 24 Oct 2018 09:05:38 +0000 (09:05 +0000)]
arm, sparc, sparc64: wire up io_pgetevents

* linux/arm/syscallent.h ([399]): Wire up io_pgetevents syscall
introduced by Linux commit v4.19-rc7~24^2~1.
(ARM_FIRST_SHUFFLED_SYSCALL, SYS_socket_subcall): Raise from 400 to 500,
to make room for new syscalls.
* linux/sparc/syscallent.h ([361]): Wire up io_pgetevents syscall
introduced by Linux commit v4.19~31^2~5.
* linux/sparc64/syscallent.h: Likewise.

5 years agoUpdate ioctl entries from linux v4.19
Gleb Fotengauer-Malinovskiy [Sun, 21 Oct 2018 08:47:44 +0000 (11:47 +0300)]
Update ioctl entries from linux v4.19

* linux/32/ioctls_inc_align16.h: Update from linux v4.19-rc8
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/i386/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
* NEWS: Mention this.

5 years agomaint: update for linux 4.19-rc8
Gleb Fotengauer-Malinovskiy [Sun, 21 Oct 2018 08:47:06 +0000 (11:47 +0300)]
maint: update for linux 4.19-rc8

* maint/ioctls_sym.sh (x86_list): Add KVM_[GS]ET_NESTED_STATE.

5 years agoRemove redundant VIDIOC_SUBDEV_* constants
Dmitry V. Levin [Wed, 24 Oct 2018 07:48:56 +0000 (07:48 +0000)]
Remove redundant VIDIOC_SUBDEV_* constants

Remove those of VIDIOC_SUBDEV_* constants are defined exactly the same
way by the Linux kernel as their VIDIOC_* origins.

Linux kernel commit v4.19-rc1~137^2~248 introduced more of such
duplicates, forward remove them as well.

* linux/32/ioctls_inc_align16.h: Remove VIDIOC_SUBDEV_DV_TIMINGS_CAP,
VIDIOC_SUBDEV_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_G_DV_TIMINGS,
VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_QUERY_DV_TIMINGS,
VIDIOC_SUBDEV_S_DV_TIMINGS, and VIDIOC_SUBDEV_S_EDID.
* 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.
* maint/ioctls_sym.sh: Remove VIDIOC_SUBDEV_DV_TIMINGS_CAP,
VIDIOC_SUBDEV_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUMSTD,
VIDIOC_SUBDEV_G_DV_TIMINGS, VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_G_STD,
VIDIOC_SUBDEV_QUERY_DV_TIMINGS, VIDIOC_SUBDEV_QUERYSTD,
VIDIOC_SUBDEV_S_DV_TIMINGS, VIDIOC_SUBDEV_S_EDID, and
VIDIOC_SUBDEV_S_STD.

6 years agoxtensa: fix typo in pkey_alloc syscall number
Dmitry V. Levin [Thu, 27 Sep 2018 19:46:36 +0000 (19:46 +0000)]
xtensa: fix typo in pkey_alloc syscall number

* linux/xtensa/syscallent.h (pkey_alloc): Change from 249 to 349.

6 years agoxlat: print _IOC_NONE in symbolic form even if it is equal to 0
Dmitry V. Levin [Sun, 23 Sep 2018 09:54:55 +0000 (09:54 +0000)]
xlat: print _IOC_NONE in symbolic form even if it is equal to 0

On some architectures _IOC_NONE equals to 1, on others it is 0.
Change the way how ioctl direction flags are printed so that
_IOC_NONE is printed in symbolic form even if it is equal to 0.

* xlat/ioctl_dirs.in (_IOC_NONE): Move to the head of the list.
* tests/ioctl_inotify.c (main): Update expected output.
* tests/ioctl_loop. (main): Likewise.c
* tests/ioctl_perf.c (main): Likewise.
* tests/ioctl_scsi.c (main): Likewise.

6 years agoDisable git-archive
Dmitry V. Levin [Tue, 18 Sep 2018 21:54:17 +0000 (21:54 +0000)]
Disable git-archive

Since configure uses git-version-gen which in turn depends
on "git describe" or  a .tarball-version file, raw archives
generated by "git archive" cannot be built.

* .gitattributes: New file.
* README-github_gitlab-autogenerated-archives.txt: Likewise.

6 years agoWorkaround signedness bugs in system NLMSG_OK reported by -Wsign-compare
Dmitry V. Levin [Sun, 16 Sep 2018 21:32:37 +0000 (21:32 +0000)]
Workaround signedness bugs in system NLMSG_OK reported by -Wsign-compare

Introduce a replacement for NLMSG_OK provided by <linux/netlink.h> since
that system macro contains signedness bugs that are not going to be fixed.

* netlink.h: Include <stdbool.h>.
(is_nlmsg_ok): New static inline function.
* socketutils.c (receive_responses): Use it instead of NLMSG_OK.
* tests/netlink_inet_diag.c (check_responses): Likewise.
* tests/netlink_netlink_diag.c (check_responses): Likewise.
* tests/netlink_unix_diag.c (check_responses): Likewise.

Closes: https://github.com/strace/strace/issues/79
6 years agotests/sprintrc.c: drop redundant check
Dmitry V. Levin [Sun, 16 Sep 2018 16:45:24 +0000 (16:45 +0000)]
tests/sprintrc.c: drop redundant check

* tests/sprintrc.c (sprintrc_ex): Remove fmt check, this also fixes the
warning reported by clang -Wtautological-constant-out-of-range-compare.

6 years agobuild: enable gcc -Woverride-init and clang -Winitializer-overrides
Dmitry V. Levin [Sun, 16 Sep 2018 11:44:01 +0000 (11:44 +0000)]
build: enable gcc -Woverride-init and clang -Winitializer-overrides

* m4/st_warn_cflags.m4 (gl_WARN_ADD): Add -Winitializer-overrides
and -Woverride-init.

6 years agotests: exclude arm_sync_file_range from ksysent test
Dmitry V. Levin [Sun, 16 Sep 2018 11:44:01 +0000 (11:44 +0000)]
tests: exclude arm_sync_file_range from ksysent test

arm_sync_file_range is better known as sync_file_range2.

* tests/ksysent.sed: Filter out arm_sync_file_range.

6 years agoIgnore warnings about overridden initialization of hwaddr_sizes
Dmitry V. Levin [Sun, 16 Sep 2018 11:44:01 +0000 (11:44 +0000)]
Ignore warnings about overridden initialization of hwaddr_sizes

As hwaddr_sizes array is explicitly initialized this way,
ignore potential warnings reported by gcc -Woverride-init
and clang -Winitializer-overrides.

* gcc_compat.h (CLANG_PREREQ): New macro.
(DIAG_PUSH_IGNORE_OVERRIDE_INIT, DIAG_POP_IGNORE_OVERRIDE_INIT): New
macros non-trivially defined for gcc >= 4.2 and clang >= 2.8.
* sock.c (print_ifreq): Use them to ignore warnings about overridden
initialization of hwaddr_sizes array.

Closes: https://github.com/strace/strace/issues/77
6 years agotests: workaround clang -Wunneeded-internal-declaration bug
Dmitry V. Levin [Sun, 16 Sep 2018 09:48:16 +0000 (09:48 +0000)]
tests: workaround clang -Wunneeded-internal-declaration bug

* tests/execve.c (main): Explicitly mark q_envp variable as used
to workaround clang -Wunneeded-internal-declaration bug.
* tests/execveat.c (main): Likewise.
* tests/nsyscalls.c (main): Explicitly mark syscallent variable as used
to workaround clang -Wunneeded-internal-declaration bug.

Closes: https://github.com/strace/strace/issues/78
6 years agoprocess: honor xlat style in print_user_offset_addr
Eugene Syromyatnikov [Fri, 31 Aug 2018 07:01:24 +0000 (09:01 +0200)]
process: honor xlat style in print_user_offset_addr

* process.c (print_user_offset_addr): Print in accordance with xlat
verbosity setting.

6 years agotime: add xlat styles support to printclockname
Eugene Syromyatnikov [Fri, 31 Aug 2018 04:42:28 +0000 (06:42 +0200)]
time: add xlat styles support to printclockname

* time.c (printclockname): Respectl xlat_verbosity.

6 years agoperf: rewrite print_perf_event_attr using PRINT_FIELD_* macros
Eugene Syromyatnikov [Fri, 31 Aug 2018 04:05:08 +0000 (06:05 +0200)]
perf: rewrite print_perf_event_attr using PRINT_FIELD_* macros

* perf.c: Include "print_fields.h".
(PRINT_XLAT): Remove.
(print_perf_event_attr): Use PRINT_FIELD_* macros.

6 years agotests: check stack unwinding for signals
Eugene Syromyatnikov [Fri, 31 Aug 2018 14:04:16 +0000 (16:04 +0200)]
tests: check stack unwinding for signals

* tests/stack-fcall-3.c: Include <signal.h>.
(f3): Call getpid or kill depending on the argument, store getpid result.
* tests/stack-fcall.c (main): Remove arguments, call f0(0) and f0(1).
* tests/strace-k-demangle.expected: Update expected output.
* tests/strace-k.expected: Likewise.
* tests/strace-k.test: Rewrite pattern matching code.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agoPrint stack traces on signals
Eugene Syromyatnikov [Wed, 29 Aug 2018 16:09:57 +0000 (18:09 +0200)]
Print stack traces on signals

I don't know why it hasn't been done earlier.

* strace.c (print_stopped) [ENABLE_STACKTRACE]: Call unwind_tcb_print
if stack trace printing is enabled.

6 years agoxlat: provide fallback definitions for open_access_modes constants
Eugene Syromyatnikov [Fri, 31 Aug 2018 07:08:08 +0000 (09:08 +0200)]
xlat: provide fallback definitions for open_access_modes constants

* xlat/open_access_modes.in: Add fallback values.

6 years agoxlat: update resources
Eugene Syromyatnikov [Fri, 31 Aug 2018 03:22:29 +0000 (05:22 +0200)]
xlat: update resources

* xlat/resources.in: Declare as #value indexed, provide fallback values.
(RLIMIT_VMEM): Remove.

6 years agonlattr: ignore nla_type flags when selecting nlattr decoder
Eugene Syromyatnikov [Tue, 28 Aug 2018 01:07:59 +0000 (03:07 +0200)]
nlattr: ignore nla_type flags when selecting nlattr decoder

* nlattr.c (decode_nlattr_with_data): Apply NLA_TYPE_MASK to nla_type
before decoder selection.

6 years agonetlink_packet_diag: assorted decoding fixes
Eugene Syromyatnikov [Mon, 27 Aug 2018 19:34:06 +0000 (21:34 +0200)]
netlink_packet_diag: assorted decoding fixes

* xlat/af_packet_versions.in: New file.
* netlink_packet_diag.c: Include "xlat/af_packet_versions.h".
(decode_packet_diag_req): sdiag_protocol shouldn't be decoded as a protocol,
currently it should be set to 0.
(decode_packet_diag_info): Decode pdi_version field using af_packet_versions
xlat; decode pdi_index field as an interface index.
(packet_diag_msg_nla_decoders) <PACKET_DIAG_UID>: Decode using
decode_nla_uid.
(decode_packet_diag_msg): Decode pdiag_num as an low-level protocol.
* tests/netlink_sock_diag.c: Update expected output.
* tests/nlattr_packet_diag_msg.c: Likewise.

6 years agosockaddr: add X.25 socket address decoding support
Eugene Syromyatnikov [Mon, 27 Aug 2018 04:26:56 +0000 (06:26 +0200)]
sockaddr: add X.25 socket address decoding support

* sockaddr.c: Include <linux/x25.h>.
(print_sockaddr_data_x25): New function.
(sa_printers) <[AF_X25]>: New socket address handler.
* tests/net-sockaddr.c (check_x25): New function.
(main): Use it to check X.25 socket address decoding.

6 years agonet: add support for AX.25 protocols and socket option names decoding
Eugene Syromyatnikov [Mon, 27 Aug 2018 04:22:52 +0000 (06:22 +0200)]
net: add support for AX.25 protocols and socket option names decoding

* xlat/ax25_protocols.in: New file.
* xlat/sock_ax25_options.in: Likewise.
* net.c: Include "xlat/ax25_protocols.h" and "xlat/sock_ax25_options.h".
* (SYS_FUNC(socket)): <[AF_AX25]>: Print protocol name using
ax25_protocols xlat.
(print_sockopt_fd_level_name) <[SOL_AX25]>: Print socket option name
using sock_ax25_options xlat.

6 years agosockaddr: decode AX.25 socket addresses
Eugene Syromyatnikov [Mon, 27 Aug 2018 01:13:04 +0000 (03:13 +0200)]
sockaddr: decode AX.25 socket addresses

* defs.h (print_ax25_addr): New prototype.
* print_fields.h (PRINT_FIELD_AX25_ADDR): New macro.
* sockaddr.c: Include <linux/ax25.h>.
(check_ax25_address, ax25_addr2str, print_ax25_addr_raw,
print_ax25_addr, print_sockaddr_data_ax25): New functions.
(sa_printers) <[AF_AX25]>: New printer.
* tests/net-sockaddr.c (AX25_ADDR): New macro.
(check_ax25): New function.
(main): Use it to check AX.25 socket address decoding.

6 years agomacros: add ROUNDUP macro
Eugene Syromyatnikov [Sun, 2 Sep 2018 16:15:40 +0000 (18:15 +0200)]
macros: add ROUNDUP macro

* macros.h (ROUNDUP): New macro.

6 years agofutex: recognise FUTEX_BITSET_MATCH_ANY bitmask
Eugene Syromyatnikov [Wed, 29 Aug 2018 20:18:36 +0000 (22:18 +0200)]
futex: recognise FUTEX_BITSET_MATCH_ANY bitmask

* xlat/futexbitset.in: New file.
* futex.c: Include "xlat/futexbitset.h".
(futex) <FUTEX_WAIT_BITSET, FUTEX_WAKE_BITSET>: Decode val3 using
futexbitset xlat.
* tests/futex.c: Add checks for 0xffffffff bitset mask printing.

Closes: Linux commit v4.16-rc1~166^2^2~2
6 years agoioprio: move constant definitions to xlat
Eugene Syromyatnikov [Mon, 27 Aug 2018 19:26:04 +0000 (21:26 +0200)]
ioprio: move constant definitions to xlat

* xlat/ioprio_class.in: Add fallback values.
* xlat/ioprio_who.in: Likewise.
* ioprio.c: Remove IOPRIO_WHO_* and IOPRIO_CLASS_* enums.

6 years agonet: decode AF_PACKET protocols in socket syscall
Eugene Syromyatnikov [Mon, 27 Aug 2018 13:20:33 +0000 (15:20 +0200)]
net: decode AF_PACKET protocols in socket syscall

* net.c: Include "xlat/ethernet_protocols.h" in XLAT_MACROS_ONLY mode.
(SYS_FUNC(socket)) <AF_PACKET>: Decode using ethernet_protocols xlat.

6 years agoprint_ifindex: add public get_ifname method
Eugene Syromyatnikov [Mon, 27 Aug 2018 13:16:10 +0000 (15:16 +0200)]
print_ifindex: add public get_ifname method

In order to be able to obtain sanitised device name internally.

* defs.h (get_ifname): New declaration.
* print_ifindex.c (get_ifname): Refactor, leaving out addition
of if_nametoindex("") part.
(sprint_ifname): New function, adds if_nametoindex("")
to get_ifname's output.
(print_ifindex): Use sprint_ifname instead of get_ifname.

6 years agosocketutils: introduce get_family_by_proto
Eugene Syromyatnikov [Mon, 27 Aug 2018 10:49:20 +0000 (12:49 +0200)]
socketutils: introduce get_family_by_proto

Add a helper function that returns address family based on the internal
notion of the socket protocol using protocols table.

* defs.h (get_family_by_proto): New declaration.
* socketutils.c (get_family_by_proto): New function.

6 years agosocketutils: add more IP/IPv6 transport protocols
Eugene Syromyatnikov [Mon, 27 Aug 2018 10:46:34 +0000 (12:46 +0200)]
socketutils: add more IP/IPv6 transport protocols

* defs.h (sock_proto): Add SOCK_PROTO_UDPLITE, SOCK_PROTO_DCCP,
SOCK_PROTO_SCTP, SOCK_PROTO_L2TP_IP, SOCK_PROTO_PING, SOCK_PROTO_RAW,
SOCK_PROTO_UDPLITEv6, SOCK_PROTO_DCCPv6, SOCK_PROTO_L2TP_IPv6,
SOCK_PROTO_SCTPv6, SOCK_PROTO_PINGv6, and SOCK_PROTO_RAWv6.
* socketutils.c: Include "xlat/inet_protocols.h" in XLAT_MACROS_ONLY
mode.
(protocols): Add protocol descriptions for them.

6 years agosocketutils: store more information in protocols table
Eugene Syromyatnikov [Mon, 27 Aug 2018 10:41:48 +0000 (12:41 +0200)]
socketutils: store more information in protocols table

This also allows getting rid of all these *_v[46]_get calls.

* socketutils.c (unix_get, inet_get, netlink_gen): Add family, protocol,
and proto_name paramteres, use them where appropriate.
(tcp_v4_get, udp_v4_get, tcp_v6_get, udp_v6_get): Remove.
(protocols): Add family and proto fields to the structure, call inet_get
for IP/IPv6 protocols.
(get_sockaddr_by_inode_uncached): Update protocols->get calls.

6 years agosockaddr: whitespace cleanup, fix typo in comment
Eugene Syromyatnikov [Mon, 27 Aug 2018 01:16:18 +0000 (03:16 +0200)]
sockaddr: whitespace cleanup, fix typo in comment

* sockaddr.c (print_sockaddr_data_bt): Fix typo, remove excess
indentation from the switch statement.

6 years agotests: add utimensat test variants with different xlat verbosity levels
Eugene Syromyatnikov [Sat, 25 Aug 2018 23:30:15 +0000 (01:30 +0200)]
tests: add utimensat test variants with different xlat verbosity levels

* tests/utimensat-Xabbrev.c: New file.
* tests/utimensat-Xraw.c: Likewise.
* tests/utimensat-Xverbose.c: Likewise.
* tests/utimensat.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
* tests/pure_executables.list: Add utimensat-Xabbrev, utimensat-Xraw,
and utimensat-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (utimensat-Xabbrev, utimensat-Xraw, utimensat-Xverbose): New
tests.

6 years agoprint_timespec: make print_timespec_t_utime respect xlat style setting
Eugene Syromyatnikov [Sat, 25 Aug 2018 23:28:30 +0000 (01:28 +0200)]
print_timespec: make print_timespec_t_utime respect xlat style setting

* print_timespec.c (print_timespec_t_utime): Print raw timespec value
in accordance with xlat style setting.

6 years agonetlink: honor custom xlat style setting during nlmsg flags printing
Eugene Syromyatnikov [Sat, 25 Aug 2018 23:11:37 +0000 (01:11 +0200)]
netlink: honor custom xlat style setting during nlmsg flags printing

Commit v4.23~343 introduced xlat style argument to printflags_ex, but
XLAT_STYLE_DEFAULT was introduced only in the next commit v4.23~342,
which led to missing out fixing the sole external user of this
peculiar extended interface.

* netlink.c (decode_nlmsg_flags): Use XLAT_STYLE_DEFAULT instead of
XLAT_STYLE_ABBREV in printflags_ex call.

Fixes: v4.23~342 "Introduce XLAT_STYLE_DEFAULT"
6 years agonetlink_netfilter: use xlat styles for res_id workaround printing
Eugene Syromyatnikov [Sat, 25 Aug 2018 20:13:51 +0000 (22:13 +0200)]
netlink_netfilter: use xlat styles for res_id workaround printing

* netlink_netfilter.c (decode_netlink_netfilter): Call print_xlat_ex
in order to respect xlat style setting.

6 years agoxlat: provide fallback definitions for epollevents
Eugene Syromyatnikov [Mon, 27 Aug 2018 19:23:47 +0000 (21:23 +0200)]
xlat: provide fallback definitions for epollevents

* xlat/epollevents.in: Provide fallback definitions, add EPOLLNVAL
constant (introduced by Linux commit v4.16-rc1~3^2~3).

6 years agoxlat: provide fallback definitions to pollflags
Eugene Syromyatnikov [Mon, 27 Aug 2018 19:20:51 +0000 (21:20 +0200)]
xlat: provide fallback definitions to pollflags

* xlat/pollflags.in: Add fallback definitions for POLLWRNORM,
POLLWRBAND, POLLMSG, POLLREMOVE, and POLLRDHUP.

6 years agoxlat: provide fallback values for socktypes
Eugene Syromyatnikov [Mon, 27 Aug 2018 13:15:20 +0000 (15:15 +0200)]
xlat: provide fallback values for socktypes

* xlat/socktypes.in: Provide fallback values.

6 years agoxlat: provide fallback values to route_nexthop_flags
Eugene Syromyatnikov [Mon, 27 Aug 2018 10:32:42 +0000 (12:32 +0200)]
xlat: provide fallback values to route_nexthop_flags

* xlat/route_nexthop_flags.in: Add fallback values.

6 years agoblock: move fallback definitions for ioctl commands to xlat
Eugene Syromyatnikov [Sat, 25 Aug 2018 20:02:35 +0000 (22:02 +0200)]
block: move fallback definitions for ioctl commands to xlat

* xlat/block_ioctl_cmds.in: New file.
* block.c: Include "xlat/block_ioctl_cmds.h" in XLAT_MACROS_ONLY mode.
(BLKPG, BLKTRACESETUP, BLKTRACESTART, BLKTRACESTOP, BLKTRACETEARDOWN,
BLKDISCARD, BLKIOMIN, BLKIOOPT, BLKALIGNOFF, BLKPBSZGET,
BLKDISCARDZEROES, BLKSECDISCARD, BLKROTATIONAL, BLKZEROOUT): Remove
fallback definitions as those are porvided by block_ioctl_cmds xlat now.

6 years agoDecode BLKGETSIZE64 unconditionally
Eugene Syromyatnikov [Sat, 25 Aug 2018 20:01:29 +0000 (22:01 +0200)]
Decode BLKGETSIZE64 unconditionally

It is available on all supported kernel versions.

* block.c (block_ioctl): Remove #ifdef HAVE_BLKGETSIZE64.
* configure.ac: Remove BLKGETSIZE64 check.

6 years agoxlat: add ability to specify a default string to print_xlat_ex
Eugene Syromyatnikov [Sun, 19 Aug 2018 17:55:15 +0000 (19:55 +0200)]
xlat: add ability to specify a default string to print_xlat_ex

In order to avoid dealing with xlat verbosity styles outside xlat code
as much as possible.

* defs.h (xlat_style_private_flag_bits): Rename from
print_array_flag_bits, add PXF_DEFAULT_STR_BIT.
(xlat_style_private_flags): Rename from print_array_flags, add
FLAG_(PXF_DEFAULT_STR).
* xlat.c (print_xlat_ex): Handle PXF_DEFAULT_STR by interpreting str
as a default value (print both value and str in XLAT_STYLE_ABBREV).

6 years agonlattr: provide common AF_INET{,6} address decoders
Eugene Syromyatnikov [Sun, 19 Aug 2018 12:37:12 +0000 (14:37 +0200)]
nlattr: provide common AF_INET{,6} address decoders

Rename decode_ifla_inet6_token to decode_nla_in6_addr,
add a sister function decode_nla_in_addr for future use.

* nlattr.c (decode_nla_in_addr, decode_nla_in6_addr): New functions.
* nlattr.h (DECL_NLA(in_addr), DECL_NLA(in6_addr)): New declarations.
* rtnl_link.c (decode_ifla_inet6_token): Remove.
(ifla_inet6_nla_decoders) <[IFLA_INET6_TOKEN]>: Use decode_nla_in6_addr.

6 years agonet: decode SOL_XDP socket option names
Eugene Syromyatnikov [Sun, 19 Aug 2018 19:53:14 +0000 (21:53 +0200)]
net: decode SOL_XDP socket option names

* xlat/sock_xdp_options.in: New file.
* net.c: Include "xlat/sock_xdp_options.h".
(print_sockopt_fd_level_name) <case SOL_XDP>: Print SOL_XDP socket
option names.

6 years agoxlat: add SOL_XDP to socketlayers.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 19:44:51 +0000 (21:44 +0200)]
xlat: add SOL_XDP to socketlayers.in

* xlat/socketlayers.in (SOL_XDP): New constant, introduced by Linux
commit v4.18-rc1~114^2~304^2~4^2~14.

6 years agoxlat: add AF_XDP to addrfams.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 19:44:10 +0000 (21:44 +0200)]
xlat: add AF_XDP to addrfams.in

* xlat/addrfams.in (AF_XDP): New constant, introduced by Linux commit
v4.18-rc1~114^2~304^2~4^2~14.

6 years agonetlink_smc_diag: decode SMC_DIAG_SHUTDOWN attribute value
Eugene Syromyatnikov [Sun, 19 Aug 2018 19:33:26 +0000 (21:33 +0200)]
netlink_smc_diag: decode SMC_DIAG_SHUTDOWN attribute value

* xlat/sock_shutdown_flags.in: New file.
* netlink_smc_diag.c: Include "xlat/sock_shutdown_flags.h".
(decode_smc_diag_shutdown): New function.
(smc_diag_msg_nla_decoders) <[SMC_DIAG_SHUTDOWN]>: Use
decode_smc_diag_shutdown.
* tests/nlattr_smc_diag_msg.c: Add checks for SMC_DIAG_SHUTDOWN.

6 years agotests/ioctl_v4l2: do not calculate page end address each time
Eugene Syromyatnikov [Sun, 19 Aug 2018 18:14:35 +0000 (20:14 +0200)]
tests/ioctl_v4l2: do not calculate page end address each time

* tests/ioctl_v4l2.c (main): Replace page + size with page_end.

6 years agoprint_fields: simplify UINT64_MAX printing
Eugene Syromyatnikov [Sun, 19 Aug 2018 18:13:02 +0000 (20:13 +0200)]
print_fields: simplify UINT64_MAX printing

As we have print_xlat_u now.

* print_fields.h (PRINT_FIELD_U64): Use print_xlat_u for UINT64_MAX
printing.

6 years agonsfs: simplify auxstr logic
Eugene Syromyatnikov [Sun, 19 Aug 2018 17:58:18 +0000 (19:58 +0200)]
nsfs: simplify auxstr logic

There's no need to check whether non-NULL value is being assigned to
auxstr; syscall_exiting_trace does it itself.

* nsfs.c (nsfs_ioctl) <case NS_GET_NSTYPE>: Simply assign result of
xlookup to auxstr if syserror(tcp) is false.

6 years agoxlat: add BPF_PROG_TYPE_SK_REUSEPORT to bpf_prog_types.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:46:26 +0000 (15:46 +0200)]
xlat: add BPF_PROG_TYPE_SK_REUSEPORT to bpf_prog_types.in

* xlat/bpf_prog_types.in (BPF_PROG_TYPE_SK_REUSEPORT): New constant,
introduced by Linux commit v4.19-rc1~140^2~24^2~2^2~5.
* tests/bpf.c: Update expected output.

6 years agoxlat: add IPSTATS_MIB_REASM_OVERLAPS to snmp_ip_stats_mib.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:42:13 +0000 (15:42 +0200)]
xlat: add IPSTATS_MIB_REASM_OVERLAPS to snmp_ip_stats_mib.in

* xlat/snmp_ip_stats.in (IPSTATS_MIB_REASM_OVERLAPS): New constant,
introduced by Linux commit v4.19-rc1~140^2~128^2~2.

6 years agoxlat: update bpf_map_types.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:39:54 +0000 (15:39 +0200)]
xlat: update bpf_map_types.in

* xlat/bpf_map_types.in (BPF_MAP_TYPE_CGROUP_STORAGE): New constant,
introduced by Linux commit v4.19-rc1~140^2~108^2~3^2~12.
(BPF_MAP_TYPE_REUSEPORT_SOCKARRAY): New constant, introduced by Linux
commit v4.19-rc1~140^2~24^2~2^2~6.
* tests/bpf.c: Update expected output.

6 years agortnl_link: add IFLA_MIN_MTU and IFLA_MAX_MTU attributes
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:31:11 +0000 (15:31 +0200)]
rtnl_link: add IFLA_MIN_MTU and IFLA_MAX_MTU attributes

Introduced by Linux commit v4.19-rc1~140^2~205^2~1.

* rtnl_link.c (ifinfomsg_nla_decoders) <[IFLA_MIN_MTU], [IFLA_MAX_MTU]>:
New decoder, calls decode_nla_u32.
* xlat/rtnl_link_attrs.in (IFLA_MIN_MTU, IFLA_MAX_MTU): New constant.

6 years agoxlat: add IPV4_DEVCONF_BC_FORWARDING-1 to inet_devconf_indices.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:30:27 +0000 (15:30 +0200)]
xlat: add IPV4_DEVCONF_BC_FORWARDING-1 to inet_devconf_indices.in

* xlat/inet_devconf_indices.in (IPV4_DEVCONF_BC_FORWARDING-1): New
constant, introduced by Linux commit v4.19-rc1~140^2~208^2~1.

6 years agortnl_netconf: add NETCONFA_BC_FORWARDING attribute
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:29:06 +0000 (15:29 +0200)]
rtnl_netconf: add NETCONFA_BC_FORWARDING attribute

Introduced by Linux commit v4.19-rc1~140^2~208^2~1.

* rtnl_netconf.c (netconfmsg_nla_decoders) <[NETCONFA_BC_FORWARDING]>:
New decoder, calls decode_nla_s32.
* xlat/rtnl_netconf_attrs.in (NETCONFA_BC_FORWARDING): New constant.

6 years agonetlink_smc_diag: add SMC_DIAG_FALLBACK attribute support
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:20:33 +0000 (15:20 +0200)]
netlink_smc_diag: add SMC_DIAG_FALLBACK attribute support

Introduced by Linux commit v4.19-rc1~140^2~253^2~1.

* linux/smc_diag.h (SMC_DIAG_FALLBACK): New enumeration item.
(struct smc_diag_fallback): New type definition.
* netlink_smc_diag.c: Include "xlat/smc_decl_codes.h".
(decode_smc_diag_fallback): New function.
(smc_diag_msg_nla_decoders) <[SMC_DIAG_FALLBACK]>: New decoder, calls
decode_smc_diag_fallback.
* tests/nlattr_smc_diag_msg.c: Add checks for SMC_DIAG_FALLBACK
attribute decoding.
* xlat/smc_decl_codes.in: New file.
* xlat/smc_diag_attrs.in (SMC_DIAG_FALLBACK): New constant.

6 years agodefs.h: add style argument to printxval_search_ex macro
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:19:21 +0000 (15:19 +0200)]
defs.h: add style argument to printxval_search_ex macro

It is identical to printxval_search otherwise.

* defs.h (printxval_search_ex): Add style argument.

6 years agoxlat: update v4l2_pix_fmts.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 12:52:58 +0000 (14:52 +0200)]
xlat: update v4l2_pix_fmts.in

* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_FWHT): New constant, introduced by
Linux commit v4.19-rc1~137^2~221.
(V4L2_PIX_FMT_SBGGR14P, V4L2_PIX_FMT_SGBRG14P, V4L2_PIX_FMT_SGRBG14P,
V4L2_PIX_FMT_SRGGB14P): New constants, introduced by Linux commit
v4.19-rc1~137^2~97.
(V4L2_PIX_FMT_Y10P): New constant, introduced by Linux commit
v4.19-rc1~137^2~95.

6 years agonetlink_smc_diag: decode smc_diag_msg.diag_fallback constant names
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:56:21 +0000 (11:56 +0200)]
netlink_smc_diag: decode smc_diag_msg.diag_fallback constant names

Introduced by Linux commit v4.19-rc1~140^2~285^2~4.

* xlat/smc_diag_mode.in: New file.
* netlink_smc_diag.c: Include "xlat/smc_diag_mode.h".
(decode_smc_diag_msg): Print diag_fallback field using smc_diag_mode
xlat.
* tests/netlink_sock_diag.c (test_smc_diag_msg): Update expected output.
* tests/nlattr_smc_diag_msg.c (print_smc_diag_msg): Likewise.

6 years agortnl_link: add IFLA_BRPORT_BACKUP_PORT attribute
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:47:11 +0000 (11:47 +0200)]
rtnl_link: add IFLA_BRPORT_BACKUP_PORT attribute

Introduced by Linux commit v4.19-rc1~140^2~288^2.

* xlat/rtnl_ifla_brport_attrs.in (IFLA_BRPORT_BACKUP_PORT): New
constant.
* rtnl_link.c (ifla_brport_nla_decoders) <[IFLA_BRPORT_BACKUP_PORT]>:
New decoder.

6 years agoxlat: update nt_descriptor_types.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:41:16 +0000 (11:41 +0200)]
xlat: update nt_descriptor_types.in

* xlat/nt_descriptor_types.in (NT_VMCOREDD): New named constant,
introduced by Linux commit v4.18-rc1~114^2~252^2~2.
(NT_MIPS_DSP): New named constant, introduced by Linux commit
v4.19-rc1~42^2~63.
(NT_MIPS_FP_MODE): New named constant, introduced by Linux commit
v4.19-rc1~42^2~62.

6 years agoxlat: add AUDIT_INTEGRITY_POLICY_RULE to nl_audit_types.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:38:51 +0000 (11:38 +0200)]
xlat: add AUDIT_INTEGRITY_POLICY_RULE to nl_audit_types.in

* xlat/nl_audit_types.in (AUDIT_INTEGRITY_POLICY_RULE): New constant,
introduced by Linux commit v4.19-rc1~124^2~5.

6 years agortnl_link: decode named constants for IFLA_XDP_ATTACHED attribute value
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:31:34 +0000 (11:31 +0200)]
rtnl_link: decode named constants for IFLA_XDP_ATTACHED attribute value

* xlat/rtnl_ifla_xdp_attached_mode.in: New file.
* rtnl_link.c: Include "xlat/rtnl_ifla_xdp_attached_mode.h".
(decode_ifla_xdp_attached): New function.
(ifla_xdp_nla_decoders) <[IFLA_XDP_ATTACHED]>: Use
decode_ifla_xdp_attached instead of decode_nla_u8.
* tests/nlattr_ifla_xdp.c: Add checks for IFLA_XDP_ATTACHED decoding.

6 years agortnl_link: add new IFLA_XDP_* attributes
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:14:27 +0000 (11:14 +0200)]
rtnl_link: add new IFLA_XDP_* attributes

Introduced by Linux commit v4.19-rc1~140^2~364^2~6^2~6.

* xlat/rtnl_ifla_xdp_attrs.in (IFLA_XDP_DRV_PROG_ID,
IFLA_XDP_SKB_PROG_ID, IFLA_XDP_HW_PROG_ID): New constants.
* rtnl_link.c (ifla_xdp_nla_decoders): Add decoders for
IFLA_XDP_DRV_PROG_ID, IFLA_XDP_SKB_PROG_ID, and IFLA_XDP_HW_PROG_ID.
* tests/nlattr_ifla_xdp.c: Add checks for new attributes.

6 years agoxlat: update v4l2_control_ids.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 08:58:11 +0000 (10:58 +0200)]
xlat: update v4l2_control_ids.in

* xlat/v4l2_control_ids.in (V4L2_CID_MPEG_VIDEO_VP8_PROFILE): Renamed
from V4L2_CID_MPEG_VIDEO_VPX_PROFILE (the latter is now a synonym),
by Linux commit v4.19-rc1~137^2~270.
(V4L2_CID_MPEG_VIDEO_VP9_PROFILE): New constant, introduced by Linux
commit v4.19-rc1~137^2~269.

6 years agoxlat: add SO_TXTIME to sock_options.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 08:54:51 +0000 (10:54 +0200)]
xlat: add SO_TXTIME to sock_options.in

* xlat/sock_options.in (SO_TXTIME): New constant, introduced by Linux
commit v4.19-rc1~140^2~465^2~12.

6 years agonetlink_smc_diag: implement SMC_DIAG_DMBINFO decoding
Eugene Syromyatnikov [Sun, 19 Aug 2018 08:48:06 +0000 (10:48 +0200)]
netlink_smc_diag: implement SMC_DIAG_DMBINFO decoding

The message has been added by Linux commit v4.19-rc1~140^2~507^2~1.

* linux/smc_diag.h: Include "gcc_compat.h".
(enum): Add SMC_DIAG_DMBINFO.
(struct smcd_diag_dmbinfo): New type definition.
* xlat/smc_diag_attrs.in (SMC_DIAG_DMBINFO): New constant.
* netlink_smc_diag.c (decode_smc_diag_dmbinfo): New function.
(smc_diag_msg_nla_decoders) [SMC_DIAG_DMBINFO]: New decoder, calls
decode_smc_diag_dmbinfo.
* tests/nlattr_smc_diag_msg.c: Add SMC_DIAG_DMBINFO check.

6 years agoxlat: add SCTP_REUSE_PORT to sock_sctp_options.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 07:59:01 +0000 (09:59 +0200)]
xlat: add SCTP_REUSE_PORT to sock_sctp_options.in

* xlat/sock_sctp_options.in (SCTP_REUSE_PORT): New constant, introduced
by Linux commit v4.19-rc1~140^2~518.

6 years agoxlat: add IN_MASK_CREATE to inotify_flags.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 07:57:04 +0000 (09:57 +0200)]
xlat: add IN_MASK_CREATE to inotify_flags.in

* xlat/inotify_flags.in (IN_MASK_CREATE): New constant, introduced by
Linux commit v4.19-rc1~115^2.
* tests/inotify.c (main): Update expected output.

6 years agotests: workaround systemd-nspawn habit of disabling unimplemented syscalls
Dmitry V. Levin [Wed, 22 Aug 2018 20:38:27 +0000 (20:38 +0000)]
tests: workaround systemd-nspawn habit of disabling unimplemented syscalls

* tests/nsyscalls.c (test_syscall): Do not assume that unimplemented
syscalls always fail with ENOSYS.

6 years agotests: workaround systemd-nspawn habit of disabling mlockall syscall
Dmitry V. Levin [Wed, 22 Aug 2018 20:38:27 +0000 (20:38 +0000)]
tests: workaround systemd-nspawn habit of disabling mlockall syscall

* tests/mmap.c (main): Do not assume that mlockall syscall always
succeeds.

6 years agotests: workaround systemd-nspawn habit of disabling munlockall syscall
Dmitry V. Levin [Wed, 22 Aug 2018 20:38:27 +0000 (20:38 +0000)]
tests: workaround systemd-nspawn habit of disabling munlockall syscall

* tests/munlockall.c (main): Do not assume that munlockall syscall
always succeeds.

6 years agoDecode AF_SMC netlink messages unconditionally
Eugene Syromyatnikov [Sun, 19 Aug 2018 08:43:47 +0000 (10:43 +0200)]
Decode AF_SMC netlink messages unconditionally

As smc_diag.h is bundled, there is little sense to build AF_SMC support
conditionally.

* netlink_smc_diag.c [!AF_SMC]: Include xlat/addrfams.h under
XLAT_MACROS_ONLY, enable the rest of file.
* netlink_sock_diag.c: Include xlat/addrfams.h under XLAT_MACROS_ONLY.
(diag_decoders): Remove "ifdef AF_SMC" condition for [AF_SMC], reorder
in accordance with address family values.
* tests/nlattr_smc_diag_msg.c [!AF_SMC]: Define AF_SMC to 43, enable
the rest of test.

6 years agostrace.c: introduce struct tcb_wait_data
Dmitry V. Levin [Tue, 14 Aug 2018 13:43:34 +0000 (13:43 +0000)]
strace.c: introduce struct tcb_wait_data

Introduce a new structure to pass information between next_event(),
restart_delayed_tcb(), and dispatch_event().

This is going to be used by a subsequent change of next_event().

* strace.c (struct tcb_wait_data): New type.
(next_event): Remove parameters, return a pointer
to const struct tcb_wait_data.  Return NULL instead of TE_BREAK.
(dispatch_event): Replace all parameters with a pointer
to const struct tcb_wait_data, obtain the trace event, siginfo,
and status from its fields.
(restart_delayed_tcb): Add local struct tcb_wait_data variable
with te field set to TE_RESTART, pass it to dispatch_event().
(main): Remove status and si variables, update next_event()
and dispatch_event() invocations.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
6 years agoxlat: fix typo in smc_protocols.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 19:51:15 +0000 (21:51 +0200)]
xlat: fix typo in smc_protocols.in

* xlat/smc_protocols.in: s/^MCPROTO_SMC/SMCPROTO_SMC/.

6 years agoci: add a test with the latest gcc and mainline headers
Dmitry V. Levin [Sun, 19 Aug 2018 10:26:18 +0000 (10:26 +0000)]
ci: add a test with the latest gcc and mainline headers

* .gitlab-ci.yml (gcc-x86_64-libdw-mainline): New entry.
* .travis.yml (CC=gcc-8, KHEADERS=torvalds/linux): Likewise.

6 years agoci: update gitlab ubuntu image
Dmitry V. Levin [Sun, 19 Aug 2018 10:26:18 +0000 (10:26 +0000)]
ci: update gitlab ubuntu image

* .gitlab-ci.yml (image): Replace "ubuntu:17.10" with "ubuntu:18.04".

6 years agoci: install kernel headers after compiler dependencies
Dmitry V. Levin [Sun, 19 Aug 2018 10:26:18 +0000 (10:26 +0000)]
ci: install kernel headers after compiler dependencies

* ci/install-dependencies.sh: Install kernel headers after compiler
dependencies to avoid a needless attempt to install $common_packages.

6 years agoci: fix kernel headers version diagnostics
Dmitry V. Levin [Sun, 19 Aug 2018 10:26:18 +0000 (10:26 +0000)]
ci: fix kernel headers version diagnostics

* ci/run-build-and-tests.sh: Honor $CPPFLAGS when printing
kernel headers version.

6 years agotests: enhance test coverage of evdev ioctl
Zhibin Li [Fri, 10 Aug 2018 12:17:38 +0000 (20:17 +0800)]
tests: enhance test coverage of evdev ioctl

* tests/ioctl_evdev.c (main): Test EVIOCGMTSLOTS(8) command.

6 years agotests: check decoding of successful evdev ioctl
Zhibin Li [Wed, 1 Aug 2018 09:54:35 +0000 (17:54 +0800)]
tests: check decoding of successful evdev ioctl

* tests/ioctl_evdev-success.c: New file.
* tests/ioctl_evdev-success-v.c: Likewise.
* tests/ioctl_evdev-success.test: New test.
* tests/ioctl_evdev-success-v.test: Likewise.
* tests/.gitignore: Add ioctl_evdev-success and ioctl_evdev-success-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add the two tests mentioned above.

6 years agoevdev: fix decoding of EVIOCGBIT(0, ...)
Zhibin Li [Wed, 1 Aug 2018 09:53:57 +0000 (17:53 +0800)]
evdev: fix decoding of EVIOCGBIT(0, ...)

There is a comment in drivers/input/evdev.c which says:
/* EV_SYN==0 is EV_CNT, _not_ SYN_CNT, see EVIOCGBIT */

That is, EVIOCGBIT(0, ...) should return a bit mask with supported
event types instead of SYN_* event codes.

* defs.h (evdev_ev): New prototype.
* evdev.c: Include "xlat/evdev_ev.h" and remove "xlat/evdev_sync.h".
(bit_ioctl) <case EV_SYN>: Replace EV_SYN with 0, use evdev_ev
with XT_SORTED in decode_bitset invocation instead.
* ioctl.c: Do not include "xlat/evdev_ev.h".
(evdev_decode_number): Print nr == 0x20 as "0" instead of "EV_SYN".
* tests/ioctl_evdev.c (main): Use 0 instead of EV_SYN in EVIOCGBIT
output.
* xlat/evdev_sync.in: Remove.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Fixes: v4.10~89 "Add decoding for evdev ioctls"
6 years agoevdev: fix decoding of bit sets
Zhibin Li [Wed, 1 Aug 2018 09:53:57 +0000 (17:53 +0800)]
evdev: fix decoding of bit sets

According to drivers/input/evdev.c:bits_to_user(),
the Linux kernel returns the number of bytes, not bits.

* evdev.c (decode_bitset_): Treat syscall return value as the number
of bytes.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Fixes: v4.10~89 "Add decoding for evdev ioctls"
6 years agokvm: decode the argument of KVM_CHECK_EXTENSION
Pierre Marsais [Thu, 16 Aug 2018 19:04:41 +0000 (20:04 +0100)]
kvm: decode the argument of KVM_CHECK_EXTENSION

xlat/kvm_cap.in has been generated using the following command line:

grep '#define\s\+KVM_CAP' $linux/include/uapi/linux/kvm.h |
sed -E -e 's/^#define\s+([^ \t]+)\s*([0-9]+).*$/printf "%-40s%s\n" \1 \2/e' \
       -e 's/ {8}/\t/g; s/ +/\t/g'

* xlat/kvm_cap.in: New file.
* kvm.c: Include "xlat/kvm_cap.h".
(kvm_ioctl_decode_check_extension): New function.
(kvm_ioctl): Use it.
* tests/ioctl_kvm_run_common.c (main): Check decoding
of KVM_CHECK_EXTENSION command.

Signed-off-by: Pierre Marsais <pierre.marsais@lse.epita.fr>