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!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Initialize errstr inside invoke_test_syscall so that its users
won't have to go into trouble of caring about clobbering errno.
* tests/fcntl-common.c (errstr): New variable.
(invoke_test_syscall): Initialize it.
(test_flock_einval, test_flock64_einval, test_flock,
test_f_owner_ex_type_pid): Use it.
* tests/fcntl.c (test_flock64_undecoded): Likewise.
* tests/fcntl64.c (test_flock64_lk64): Likewise.
Extend invoke_test_syscall for later use with different file
descriptors.
* tests/fcntl-common.c (invoke_test_syscall): Add fd argument, pass it
to TEST_SYSCALL_NR syscall. All users updated.
This change enables F_OFD_SETLK* tests for fcntl as well.
* tests/fcntl64.c (test_flock64): Rename to test_flock64_lk64.
[F_OFD_SETLK]: Remove.
(test_flock64_einval): Move ...
* tests/fcntl-common.c: ... here.
(test_flock64_lk64): New protype.
(test_flock64_einval, test_flock64): New functions.
* tests/fcntl.c (test_flock64_einval): Rename to test_flock64_undecoded.
(TEST_FLOCK64_UNDECODED): New macro.
(test_flock64): Rename to test_flock64_lk64, replace TEST_FLOCK64_EINVAL
with TEST_FLOCK64_UNDECODED.
It is not limited to struct flock, more fcntl tests are going to land
in this file.
* tests/struct_flock.c: Rename to fcntl-common.c.
* tests/Makefile.am (EXTRA_DIST): Rename struct_flock.c
to fcntl-common.c.
* tests/fcntl.c: Likewise.
* tests/fcntl64.c: Likewise.
* configure.ac (AC_CHECK_TYPES): Check for struct fib_rule_port_range
in <linux/fib_rules.h>.
* tests/nlattr_fib_rule_hdr.c: Include <linux/in.h>.
(FRA_PROTOCOL, FRA_IP_PROTO, FRA_SPORT_RANGE, FRA_DPORT_RANGE): New
macro constants.
[!HAVE_STRUCT_FIB_RULE_PORT_RANGE] (struct fib_rule_port_range): New
type.
(main): Check decoding of new FRA_* netlink attributes.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
* nlattr.c (decode_nla_xval): New function.
* nlattr.h: Include "xlat.h".
(struct decode_nla_xlat_opts): New type.
(DECL_NLA(xval)): New declaration.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
* tests/ioctl_inotify.c (sys_ioctl): New function.
(main): Use sys_ioctl for ioctl calls with oversized arguments.
* tests/ioctl_loop.c: Likewise.
* tests/ioctl_perf.c: Likewise.
Print interface indices according to the preferred xlat style settings.
* print_ifindex.c (INI_PFX, INI_SFX): New helper macros.
[HAVE_IF_INDEXTONAME] (get_ifname): New function.
[HAVE_IF_INDEXTONAME] (print_ifindex): Implement as a wrapper around
get_ifname and print_xlat_ex.
The old code works only when an array contains exactly two items.
* tests/test_nlattr.h (TEST_NLATTR_ARRAY): Fix pointer address
for the case of incomplete read.
* xlat/netlink_sk_meminfo_indices.in: New file.
* nlattr.c: Include xlat/netlink_sk_meminfo_indices.h.
(decode_nla_meminfo): Use print_array_ex, pass
netlink_sk_meminfo_indices as index xlat table.
* tests/nlattr_inet_diag_msg.c: Update expected output.
A shorthand similar to ARG_STR in its purpose: it provides and ability
to pass an array an its size without variable name duplication.
* macros.h (ARRSZ_PAIR): New macro.
* defs.h (XLAT_STYLE_SPEC_BITS, XLAT_STYLE_MASK): New macro constants.
(tfetch_mem_fn, print_fn): New typedefs.
(enum print_array_flag_bits, enum print_array_flags): New enumerations.
(print_array_ex): Rename from print_array, add flags, index_xlat,
index_xlat_size, and index_dflt arguments.
(print_array): New static inline function, a thin wrapper around
print_array_ex.
util.c: Include "xlat.h".
(print_array): Rename to print_array_ex, add flags, index_xlat,
index_xlat_size, and index_dflt arguments. Print array indices
according to the style settings specified by flags if PAF_PRINT_INDICES
is set.
These new functions are going to be used instead of umove_or_printaddr*
as umoven_func argument of print_array.
* defs.h (tfetch_mem64, tfetch_mem64_ignore_syserror): New
function prototypes.
(tfetch_mem, tfetch_mem_ignore_syserror): New static inline
wrappers.
(tfetch_obj): New macro wrapper around tfetch_mem.
* util.c (tfetch_mem64, tfetch_mem64_ignore_syserror): New
functions.
(umoven_or_printaddr64, umoven_or_printaddr64_ignore_syserror): Use
them.
* bpf_attr.h [!BPF_TAG_SIZE] (BPF_TAG_SIZE): Define.
[BPF_TAG_SIZE]: Check that BPF_TAG_SIZE is 8.
(struct bpf_map_info_struct, struct bpf_prog_info_struct): New
structures.
(bpf_map_info_struct_size, expected_bpf_map_info_struct_size,
bpf_prog_info_struct_size, expected_bpf_prog_info_struct_size): New
macro constants.
* bpf.c (print_bpf_obj_info_fn): New type.
(print_bpf_map_info, print_bpf_prog_info, fetch_bpf_obj_info,
print_bpf_obj_info_addr, print_bpf_obj_info): New functions.
(BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Print bpf_fd and info_len
fields only on entering, call print_bpf_obj_info for printing info field.
* tests/bpf.c (BPF_OBJ_GET_INFO_BY_FD_checks): Print info field
as a pointer.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
struct bpf_prog_info and bpf_map_info need essentially the same handling
as union bpf_attr.
* gen_bpf_attr_check.sh: Derive type_name from $struct if it doesn't
start with "BPF_", derive TYPE_NAME from type_name, use them in code
generation.
* m4/gen_bpf_attr_m4.sh: Rewrite parsing/generation code into awk,
add support for structures outside union bpf_attr.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
As various bpf commands need different data to save between entering
and exiting of the syscall, do not emulate union bpf_attr approach.
* bpf.c (struct bpf_priv_data): Remove.
(DECL_BPF_CMD_DECODER): Remove "struct bpf_priv_data *" argument.
(BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): Use set_tcb_priv_ulong
and get_tcb_priv_ulong to keep bpf_attr.query.prog_cnt field.
(SYS_FUNC(bpf)): Remove priv variable, do not initialize it,
and do not pass it to bpf_cmd_decoders.
* tests/bpf-success-v.c: New file.
* tests/bpf-success.c: Likewise.
* tests/bpf-success-v.test: New test.
* tests/bpf-success.test: Likewise.
* tests/.gitignore: Add bpf-success and bpf-success-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add bpf-success.test and bpf-success-v.test.
* tests/bpf.c [INJECT_RETVAL] (sys_bpf): Check that retuned value
is equivalent to the injected one; append "(INJECTED)" string to errstr.
(prog_load_ids, prog_load_ids_ptr): New variables.
(init_BPF_PROG_QUERY_attr4, print_BPF_PROG_QUERY_attr4,
init_BPF_PROG_QUERY_attr5, print_BPF_PROG_QUERY_attr5): New functions.
(BPF_PROG_QUERY_checks): Drop "const" qualifier, add new checks.
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): Use
print_uint32_array_member instead of print_uint64_array_member for
printing prog_ids elements (and change the type of prog_id_buf from
uint64_t to uint32_t), as they are 32-bit; use common trick with
print_big_u64_addr for handling possible ambiguity with prog_ids
address.
* tests/bpf.c (BIG_ADDR_MAYBE): New macro.
(BPF_PROG_QUERY_checks): Update expected output.
* xlat/ebpf_regs.in: New file.
* bpf.c (struct ebpf_insn, struct ebpf_insns_data): New type definitions.
(print_ebpf_insn, print_ebpf_prog): New functions.
(DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Use them.
As these have some argument output on the exit path.
* tests/ioctl_perf-success.c: New file.
* tests/ioctl_perf-success.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
(check_PROGRAMS): Add ioctl_perf-success.
* tests/.gitignore: Likewise.
* tests/ioctl_perf.c: Remove TODO.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
* xlat/inet_protocols.in (IPPROTO_GGP, IPPROTO_HELLO, IPPROTO_ND):
Remove, not defined in Linux.
(IPPROTO_BEETPH): New constant, introduced by Linux commit
v2.6.19-rc1~33^2.
(IPPROTO_L2TP): New constant, introduced by Linux commit
v2.6.35-rc1~473^2~594.
(IPPROTO_MH): New constant, introduced by Linux commit
v2.6.19-rc1~1272^2~157.
Add default values to constants, sort the file.
There's little reason not to decode error code for syscalls printed in
raw; moreover, it creates inconsistencies for unknown syscall printing.
Another issue was with error numbers unknown to strace: previously, they
were printed as "... = -1 1234 (Unknown error 1234)" which looked kinda
weird.
* syscall.c (print_err_ret): New function.
(syscall_exiting_trace): Remove u_error variable, use tcp->u_error
instead. Remove u_error_str variable.
(syscall_exiting_trace) <if (raw(tcp))>: Call print_err_ret if u_error
is non-zero.
(syscall_exiting_trace) <if (!(sys_res & RVAL_NONE) && tcp->u_error)>:
Use print_err_ret for default error printing.
* tests/nsyscalls.c [!LINUX_MIPSO32] (test_syscall): Update expected
output.
* tests/qual_fault.c (invoke) <if (is_raw)>: Likewise.
* strace.1.in (.SH DESCIPTION): Update unknown syscall example.
Replace BIG_ADDR_IS_64BIT and BIG_ADDR_IS_32BIT with BIG_ADDR().
* tests/bpf.c (BIG_ADDR): New macro.
(BIG_ADDR_IS_64BIT, BIG_ADDR_IS_32BIT): Remove.
(BPF_PROG_LOAD_checks, BPF_OBJ_PIN_checks,
BPF_RAW_TRACEPOINT_OPEN_checks): Use BIG_ADDR() instead of
BIG_ADDR_IS_64BIT and BIG_ADDR_IS_32BIT.
Introduce BIG_ADDR_IS_64BIT and BIG_ADDR_IS_32BIT to reduce redundancy.
* tests/bpf.c (BIG_ADDR_IS_64BIT, BIG_ADDR_IS_32BIT): New macros.
(BPF_PROG_LOAD_checks, BPF_OBJ_PIN_checks,
BPF_RAW_TRACEPOINT_OPEN_checks): Use them.