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!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
This fixes compilation with musl libc.
This approach was already used in process.c, so I assume it is safe.
* signal.c: Move [HAVE_LINUX_PTRACE_H] code out of [HAVE_SYS_REG_H] check.
* syscall.c: Likewise.
* util.c: Likewise.
Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
The decoding of SIOCSIFNAME is incorrect. It does not use
the ifr_index field to look things up, but ifr_newname.
* sock.c (sock_ioctl): Split out SIOCSIFNAME from SIOCGIFNAME and
display ifr_newname.
The ifr name fields of the ifreq structure might not be NUL terminated.
If the user makes an ioctl call where they aren't, then strace ends up
reading random content from its own stack. Limit the printf lengths.
* sock.c (sock_ioctl): Add explicit length limits to ifr_name printfs.
On Android, 32-bit arm and x86 use __kernel_mode_t (an unsigned short)
as their mode_t. The open(2) flags are actually an int, so high ones
like O_CLOEXEC get truncated if you coerce them to mode_t.
* defs.h (tprint_open_modes, sprint_open_modes): Change argument type
from mode_t to int.
* file.c (tprint_open_modes, sprint_open_modes): Likewise.
Signed-off-by: Elliott Hughes <enh@google.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* defs.h (xlat_search): New prototype.
* util.c (xlat_bsearch_compare, xlat_search): New functions.
* file.c (sprintfstype): Use xlat_search for fsmagic lookup.
* xlat/fsmagic.in: Sort by value and mark as not NULL-terminated.
* tests/statfs.c: New file.
* tests/statfs.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add statfs.
(statfs_CFLAGS): Define.
(TESTS): Add statfs.test.
* tests/.gitignore: Add statfs.
When two ore more -y options are given, print local and remote ip:port
pairs associated with socket descriptors. This implementation uses
NETLINK_INET_DIAG for sockaddr lookup; it's based on the patch
prepared by Zubin Mithra as a part of his GSoC 2014 strace project.
* Makefile.am (strace_SOURCES): Add socketutils.c
(EXTRA_DIST): Add linux/inet_diag.h and linux/sock_diag.h.
* defs.h (print_sockaddr_by_inode): New prototype.
* linux/inet_diag.h: New file.
* linux/sock_diag.h: Likewise.
* socketutils.c: Likewise.
* strace.1: Document -yy option.
* strace.c (usage): Likewise.
* util.c (printfd): Use print_sockaddr_by_inode.
Wrap sa_restorer member definitions in #ifdef SA_RESTORER to be
consistent with their use.
If an architecture does not provide sa_restorer members but still
defines SA_RESTORER macro, the latter has to be explicitly undefined.
This change fixes compilation failures like this one:
signal.c: In function 'decode_old_sigaction':
signal.c:631:21: error: 'struct old_sigaction' has no member named 'sa_restorer'
signal.c: In function 'decode_new_sigaction':
signal.c:1224:21: error: 'struct new_sigaction' has no member named 'sa_restorer'
* signal.c (struct old_sigaction, struct old_sigaction32,
struct new_sigaction, struct new_sigaction32):
Wrap sa_restorer member in #ifdef SA_RESTORER.
(decode_old_sigaction, decode_new_sigaction):
Wrap use of sa32.sa_restorer in #ifdef SA_RESTORER.
Signed-off-by: Vicente Olivert Riera <vincent.riera@imgtec.com>
* configure.ac (gl_WARN_ADD): Add -Wsign-compare.
* defs.h (struct tcb): Change 'currpers' type to unsigned.
(struct xlat): Change 'val' type to unsigned
(signame): Add 'const' qualifier to its argument.
(xlookup, printxval): Add 'const' qualifier to the 2nd argument and
change its type to unsigned.
(printpathn): Change the 3rd argument type to unsigned.
(ioctl_lookup): Change 1st argument type to unsigned.
* count.c (call_summary_pers, call_summary): Change 'i' type to unsigned.
* file.c (print_xattr_list): Fix comparisons between signed and unsigned
long values.
* ioctl.c (compare): Fix cast.
(ioctl_lookup): Change 1st argument type to to unsigned.
(ioctl_next_match): Change 'code' type to unsigned.
* mem.c (sys_move_pages): Change 'i' type to unsigned.
* mtd.c (mtd_ioctl): Change 'i' and 'j' types to unsigned.
Print 'i' using %u format string.
* process.c (sys_prctl): Change 'i' type to unsigned.
(printargv): Change 'n' type to unsigned.
(sys_ptrace): Change 'addr' type to unsigned.
* scsi.c (print_sg_io_buffer): Add 'const' qualifier to 'len' argument
and change its type to unsigned. Change 'i' and 'allocated' types
to unsigned.
* signal.c (signame): Add 'const' qualifier to its argument.
Fix comparisons between signed and unsigned values.
(sprintsigmask_n, printsiginfo): Fix comparisons between signed and
unsigned values.
* sock.c (sock_ioctl): Change 'i' and 'nifra' types to unsigned.
* strace.c (expand_tcbtab, alloctcb): Change 'i' type to unsigned.
(detach): Change 'sig' type to unsigned.
(startup_attach): Change 'tcbi' type to unsigned.
(startup_child): Change 'm', 'n', and 'len' types to unsigned.
(init): Use new variable to iterate 'tcbtab'.
(pid2tcb): Change 'i' type to unsigned.
(cleanup): Change 'i' and 'sig' types to unsigned.
* syscall.c (update_personality): Change 'personality' argument type
to unsigned.
(struct qual_options): Change 'bitflag' type to unsigned.
(reallocate_qual): Add 'const' qualifier to its argument and change its
type to unsigned.
(qualify_one): Change 'n' and 'bitflag' arguments types to unsigned.
Add 'const' qualifier to 'n', 'not', and 'pers' arguments.
Change 'p' type to signed int.
(qual_syscall): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
Change 'p' type to signed int.
(qual_signal): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
Change 'i' type to unsigned.
(qual_desc): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
(qualify): Change 'i' type to unsigned.
(get_scno): Change 'currpers' type to unsigned.
Fix a comparison between signed and unsigned values.
* system.c (sys_sysctl): Change 'cnt' and 'max_cnt' types to unsigned.
Fix comparisons between signed and unsigned values.
* util.c (xlookup, printxval): Add 'const' qualifier to 'val' argument
and change its type to unsigned.
(printuid): Fix a comparison between signed and unsigned values.
(printpathn): Change 'n' argument type to unsigned.
(printstr): Change 'size' type to unsigned.
Fix a comparison between signed and unsigned values.
(setbpt): Change 'i' type to unsigned.
* net.c (printsock): Silence a compilation warning.
* reboot.c (sys_reboot): Likewise.
A pointer to fd_set was used uninitialized when nfds == 0.
* desc.c (decode_select): Initialize fds.
Reported-by: Zubin Mithra <zubin.mithra@gmail.com>
Stop using an outdated partial copy of libaio.h, switch back to external
libaio.h from libaio.
This partially reverts commit 2df03c494eb3c36c4178eba35c374831031d1a58.
* aio.c: Drop a partial copy of libaio.h, include <libaio.h> instead.
(print_common_flags): Check for HAVE_STRUCT_IOCB_U_C_FLAGS.
(sys_io_submit): Check for HAVE_DECL_IO_CMD_PWRITE and
HAVE_DECL_IO_CMD_PWRITEV.
* configure.ac: Check for libaio.h and declaration it provides.
The {...} code changes the working dir with `cd`, but the commands outside
of that block expects to be in the original dir. Change to a subshell so
the path outside of this block remains unchanged.
* Makefile.am ($(srcdir)/CREDITS): Change {...} to (...).
When the preadv/pwritev syscalls were added, the ones before it in the
ia64 list were missed, so all the syscalls there and later were not in
the right location (causing things to be decoded incorrectly).
Add the missing syscalls before preadv which also re-aligns all the
syscalls after that point. This fixes the uio.test.
* linux/ia64/syscallent.h: Add syscalls 1310 through 1318.
Looks like ia64 doesn't have sa_restorer either, yet still defines
SA_RESTORER. Deploy the same trick that HPPA is using to make the
test pass.
* signal.c (SA_RESTORER): Undefine when IA64 is defined.
(struct new_sigaction) [IA64]: Disable sa_restorer.
detach-stopped.test is known to fail when PTRACE_SEIZE is not available,
so skip the test in that case.
* tests/detach-stopped.test: Check for "strace -d" output and skip the
test when it says that PTRACE_SEIZE doesn't work.
The preadv/pwritev symbols weren't added to glibc until the 2.10 release,
so trying to build the uio test leads to link failures. Add configure
tests and update uio.test to handle this.
* configure.ac (AC_CHECK_FUNCS): Add preadv/pwritev.
* tests/uio.c: Include config.h.
(main): Check for HAVE_PREADV and HAVE_PWRITEV.
* tests/uio.test: Check exit status of uio helper.
The current detach test code does:
set -e
...
cleanup() {
set +e
kill ...
wait ...
}
...
cleanup
exit 0
The problem is that while `set -e` is disabled for the body of the
cleanup function, it isn't necessarily disabled in the caller scope.
So if the return value of the cleanup function (`wait` in this case)
is non-zero, the script ends up failing overall.
Add an explicit return 0 to the cleanup function so that we don't kill
the overall test pipeline.
* tests/detach-running.test (cleanup): Add return 0.
* tests/detach-sleeping.test (cleanup): Likewise.
* tests/detach-stopped.test (cleanup): Likewise.
This way I don't have to keep reading up on these options and wondering
why the code isn't aborting when the call fails.
* tests/set_ptracer_any.c (main): Note prctl failures are ok.
Previous commit here re-added the bugs trying to be fixed due to a
logic thinko. The patches were tested in isolation and hand merged
later. Oops.
* signal.c (struct new_sigaction): Change || to &&.
Running Linux 3.15 (sparc64) and glibc 2.17 (sparc32) triggers a
rt_sigaction call that does not use SA_RESTORER and has an order
where it inserts a restorer and a size. The current tests don't
support that ordering, so add another regex.
* tests/sigaction.awk: Support no SA_RESTORER and swapped args.
Both these arches have a rt_sigaction syscall that takes 5 args, not 4.
* linux/alpha/syscallent.h (rt_sigaction): Change nargs to 5.
* linux/sparc/syscallent.h (rt_sigaction): Change nargs to 5.
Since the rt_sigaction syscall on hppa doesn't have a sa_restorer,
do not include it in the kernel struct.
We also have to undefine SA_RESTORER so that code doesn't try to
use it. The headers will export this, but the syscall doesn't
actually respect it.
* signal.c (SA_RESTORER): Undefine when HPPA is defined.
(struct new_sigaction): Disable sa_restorer on hppa.
Since the rt_sigaction syscall on alpha doesn't have a sa_restorer,
do not include it in the kernel struct.
* signal.c (struct new_sigaction): Disable sa_restorer on alpha.
This fixes regression introduced by the previous commit.
* io.c (print_llu_from_low_high_val) [SIZEOF_LONG != SIZEOF_LONG_LONG]:
Cast argument to unsigned long before casting it to unsigned long long.
Starting in 3.16, these two syscalls have gotten their own entry
point for x32. See linux 7fd44dacdd803c0bbf38bf478d51d280902bb0f1.
* linux/x32/syscallent.h: Change existing io_{setup,submit} to 64bit,
and add new entry points for x32 specifically.
strace -k does not produce a reliable output on all supported
configurations yet, even basic strace-k.test is known to fail
on some of them.
* strace.c (usage): Document -k option as experimental.
* strace.1: Likewise.
* NEWS: Likewise.
Split stack-fcall.c into several compilation units so that intermediate
function calls would not be optimized out by compiler.
* tests/stack-fcall.c: Move intermediate functions to ...
* tests/stack-fcall-*.c: ... new files.
* tests/Makefile.am (stack_fcall_SOURCES): Add stack-fcall-*.c.