IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
* tests/tests.h (recv_mmsg, send_mmsg): New prototype.
* tests/libmmsg.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/mmsg.c Do not check for __NR_sendmmsg, __NR_recvmmsg,
HAVE_SENDMMSG, and HAVE_RECVMMSG. Do not include unused headers.
(recv_mmsg, send_mmsg): Remove.
IOV_MAX appears to be more portable than UIO_MAXIOV.
* msghdr.c: Include <limits.h>. Remove fallback defintion of UIO_MAXIOV.
(get_optmem_max): Replace UIO_MAXIOV with IOV_MAX.
* tests/msg_control.c: Likewise.
As we've got a proper mechanism that parsers can use for storing private
data between entering and exiting stages, all cases of struct tcb.auxstr
abuse should go.
* btrfs.c (btrfs_ioctl): Use set_tcb_priv_ulong and get_tcb_priv_ulong
instead of abusing tcp->auxstr.
* file_handle.c (SYS_FUNC(name_to_handle_at)): Likewise.
* msghdr.c (SYS_FUNC(recvmsg)): Likewise.
* net.c (decode_sockname, SYS_FUNC(recvfrom)): Likewise.
* v4l2.c (print_v4l2_queryctrl): Likewise.
As the value returned by sprint_timespec points to a static area and may
be overwritten by subsequent calls to sprint_timespec, it is not safe to
save this value on entering syscall and use it later on exiting.
* mmsghdr.c (SYS_FUNC(recvmmsg)): On entering syscall, copy the value
returned by sprint_timespec to a dynamically allocated memory, and save
the pointer using set_tcb_priv_data. On exiting, restore it using
get_tcb_priv_data.
As the value returned by sprint_timespec points to a static area and may
be overwritten by subsequent calls to sprint_timespec, it is not safe to
save this value on entering syscall and use it later on exiting.
* signal.c (SYS_FUNC(rt_sigtimedwait)): On entering syscall, copy the
value returned by sprint_timespec to a dynamically allocated memory,
and save the pointer using set_tcb_priv_data. On exiting, restore it
using get_tcb_priv_data.
We need to be able to store private data in the struct tcb across it's
lifetime. To ensure proper deallocation of this stored data a callback
must be provided along with the data. The callback is executed
automatically on exiting syscall, and when the life of the tcb ends.
* defs.h (struct tcb): Add _priv_data and _free_priv_data fields.
(get_tcb_priv_data, set_tcb_priv_data, free_tcb_priv_data):
New prototypes.
(get_tcb_priv_ulong, set_tcb_priv_ulong): New static inline functions.
* strace.c (get_tcb_priv_data, set_tcb_priv_data, free_tcb_priv_data):
New functions.
(droptcb): Call free_tcb_priv_data.
* syscall.c (trace_syscall_exiting): Call free_tcb_priv_data
when clearing TCB_INSYSCALL flag.
Signed-off-by: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Sadly, musl recvmsg wrapper blindly dereferences 2nd argument,
so limit the affected part of the test to glibc that doesn't.
* tests/msg_name.c (test_msg_name) [!__GLIBC__]: Do not test
with inaccessible 2nd argument.
As the msghdr.msg_namelen argument of recvmsg syscall has the same
read-write semantics as the address length argument of recvfrom syscall,
parser of recvmsg syscall needs a similar fix.
* defs.h (fetch_msghdr_namelen): New prototype.
(decode_msghdr): Add "int *" argument.
* msghdr.c (print_msghdr): Likewise. Treat it as a pointer to struct
msghdr.msg_namelen passed to the kernel. Pass to decode_sockaddr
the size of socket address actually returned by the kernel.
Print both user and kernel address lengths when the value changes.
(decode_msghdr, decode_mmsghdr): Add "int *" argument,
forward it to print_msghdr.
(decode_mmsgvec): Update decode_mmsghdr invocation.
(fetch_msghdr_namelen): New function.
* net.c (SYS_FUNC(sendmsg)): Update decode_msghdr invocation.
(SYS_FUNC(recvmsg)): Use fetch_msghdr_namelen on entering to save
struct msghdr.msg_namelen. On exiting, pass the saved value
to decode_msghdr.
* linux/64/ioctls_inc.h: Update from linux v4.7 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
BLKDAXGET was removed by linux kernel commit v4.7-rc1~78^2^2~4.
* block.c: Do not define BLKDAXGET.
(block_ioctl): Remove BLKDAXGET support.
* tests/ioctl_block.c (main): Remove BLKDAXGET test.
* net.c (SYS_FUNC(recvfrom)): Use fetch_socklen. Save the address
length passed to the kernel and print it on error. Do not print more
bytes of the socket address than actually returned by the kernel.
Print both user and kernel address lengths when the returned address
is truncated.
* net.c (decode_sockname): Print both user and kernel address lengths
when the value changes.
* tests/net-y-unix.c (main): Update expected output.
* tests/net-yy-unix.c (main): Likewise.
* tests/net.expected: Likewise.
* net.c (decode_sockname): Print both user and kernel address lengths
when the returned address is truncated.
* tests/sun_path.expected: Update expected output.
* net.c (fetch_socklen): New function.
(decode_sockname): Use it. On entering syscall, decode early
and return RVAL_DECODED when possible. On error, print the address
length passed to the kernel. Do not print more bytes of the socket
address than actually returned by the kernel.
* net.c (do_sockname): Rename to decode_sockname, drop second argument,
do not print sock_type_flags, return RVAL_DECODED on exiting.
(SYS_FUNC(accept), SYS_FUNC(getsockname)): Use decode_sockname instead
of do_sockname, take its return code into account.
(SYS_FUNC(accept4)): Likewise. Print sock_type_flags when
decode_sockname returns RVAL_DECODED.
Handle multipart netlink messages made of multiple struct nlmsghdr
headers with associated payload in one byte stream.
* netlink.c (fetch_nlmsghdr, print_nlmsghdr,
decode_nlmsghdr_with_payload): New functions.
(decode_netlink): Use them.
* tests/netlink_parsing.c (send_query): Check them.
* tests/netlink_protocol.c (send_query): Check that no part
of netlink message is fetched beyond the end of message.
Check decoding of zero address and zero length messages.
Check decoding of messages with nlmsg_len exceeding message length.
Introduce a general socket netlink parser which prints the header and
a string for the remaining part of the buffer. It doesn't handle all
the netlink flags and types yet because the parser needs more
information, this will be implemented later.
* net.c (decode_sockbuf): New function.
(SYS_FUNC(send), SYS_FUNC(sendto), SYS_FUNC(recv), SYS_FUNC(recvfrom)):
Use it instead of printstr.
* msghdr.c (print_msghdr): Pass IOV_DECODE_NETLINK to tprint_iov_upto()
for netlink sockets.
* netlink.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (decode_netlink, getfdproto): New prototypes.
(iov_decode): Add IOV_DECODER_NETLINK.
* io.c (print_iovec): Use decode_netlink().
* util.c (getfdproto): Remove static keyword.
* xlat/netlink_flags.in: New file.
* xlat/netlink_types.in: New file.
* xlat/fsmagic.in: Add NSFS_MAGIC, TRACEFS_MAGIC, BPF_FS_MAGIC,
and UDF_SUPER_MAGIC introduced by linux kernel commits
v3.19-rc1~53^2~7^2~1, v4.1-rc1~147^2~4, v4.4-rc1~141^2~17^2~1,
and v4.7-rc1~161^2, respectively.
Limit output of struct msghdr.msg_control when
struct msghdr.msg_controllen is greater than the maximum ancillary
buffer size specified in /proc/sys/net/core/optmem_max file.
* configure.ac (AC_CHECK_FUNCS): Add open64.
* defs.h (read_int_from_file): New prototype.
* util.c (read_int_from_file): New function.
* msghdr.c (get_optmem_max): New function based on read_int_from_file.
(decode_msg_control): Use it to check control_len argument.
* tests/msg_control.c (test_big_len): New function.
(main): Use it to test printing of excessively large messages.
* msghdr.c (print_cmsg_ip_opts): Do not print more than max_strlen
bytes of ip options in abbrev mode.
* tests/msg_control.c (print_ip_opts): Use DEFAULT_STRLEN.
(test_sol_ip): Test IP_RETOPTS output in abbrev mode.
* msghdr.c (print_scm_rights): Do not print more than max_strlen
descriptors in abbrev mode.
* tests/msg_control.c (DEFAULT_STRLEN): New macro.
(print_fds): Use it.
(test_scm_rights3): New function.
(main): Use it to test SCM_RIGHTS output in abbrev mode.
* tests/msg_control-v.c: New file.
* tests/msg_control-v.test: New test.
* tests/.gitignore: Add msg_control-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add msg_control-v.test.
* msghdr.c (print_cmsg_ip_ttl): Rename to print_cmsg_uint.
(print_cmsg_ip_checksum): Remove.
(print_cmsg_type_data): Replace print_cmsg_ip_ttl
and print_cmsg_ip_checksum with print_cmsg_uint.