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!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
When built with -O0, gcc (rightfully) generates function prologue, which
results in writing %rbp to the stack, causing premature KVM_EXIT_MMIO.
It could be possible to avoid such problems by "naked" attribute but,
unfortunately, the latter is not available on x86 with older GCC.
A trick suggested in [1] is used instead: assembly is moved
to the global scope.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50242#c3
* tests/ioctl_kvm_run.c (code): Remove function.
Add globally scoped __asm__ with the function code and its size.
(code, code_size): New extern symbols declarations.
(run_kvm): Remove code_size definition and initialization.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
As it has proven itself useful.
* tests/ioctl_kvm_run.c (run_kvm) <case KVM_EXIT_MMIO:>: Fail
on unexpected KVM_EXIT_MMIO, providing relevant diagnostics.
Recent glibc (since version 2.26) uses accept4 syscall for implementing
accept call on sparc. Unfortunately, it's impossible to simply fall
back on raw syscall as it had not been wired up until linux commit
v4.4-rc8~4^2~1.
* tests/accept_compat.h: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/net-y-unix.c: Include accept_compat.h, use do_accept()
instead of accept() calls.
* tests/net-yy-inet.c: Likewise.
* tests/net-yy-unix.c: Likewise.
* tests/net.expected: Allow accept4.
* xlat/pkey_access.in (PKEY_DISABLE_EXECUTE): New constant introduced
by linux kernel commit v4.16-rc1~93^2~85.
* tests/pkey_alloc.c: Update expected output.
* NEWS: Mention it.
* linux/powerpc/syscallent.h [384..386]: Add pkey_alloc,
pkey_free, and pkey_mprotect syscalls introduced by linux kernel
commits v4.16-rc1~93^2~70 and v4.16-rc1~93^2~69, respectively.
* linux/powerpc64/syscallent.h: Likewise.
* NEWS: Mention it.
There is no compat support in strace and there are no systems
within reach that would allow to test it.
* linux/ia64/arch_regs.c (IA64_PSR_IS, ia64_ia32mode): Remove.
* linux/ia64/get_error.c (get_error): Remove ia64_ia32mode branch.
* linux/ia64/get_scno.c (arch_get_scno): Likewise.
* linux/ia64/get_syscall_args.c (get_syscall_args): Likewise.
* linux/ia64/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/ia64/set_scno.c (arch_set_scno): Likewise.
In order to have the same view as tracee has, with regards to
"never fail" syscalls.
* syscall.c (tamper_with_syscall_exiting): Call get_error after the
return value tampering to re-initialise u_rval and u_error fields
of struct tcb.
Include "ptrace.h" before any header that can include <signal.h>
because on some architectures the latter may include <asm/sigcontext.h>
which in turn may include <asm/ptrace.h> with potentially devastating
effect on <sys/ptrace.h>.
* process.c: Include "ptrace.h" before "regs.h".
* rt_sigframe.c: Likewise.
* sigreturn.c: Include "ptrace.h" before "nsig.h".
* syscall.c: Likewise.
* wait.c: Include "ptrace.h" before <sys/wait.h>.
* strace.c: Include "ptrace.h" before <signal.h>.
* tests/ptrace.c: Likewise.
* tests/test_ucopy.c: Include <sys/ptrace.h> before <signal.h>.
As it will be used elsewhere.
* basic_filters.c (scno_by_name): New function.
(qualify_syscall_name): Use it.
* defs.h (scno_by_name): New declaration.
* defs.h (struct inject_data): Change type of rval field to
kernel_ulong_t.
* filter_qualify.c (parse_inject_token): Use string_to_kulong instead of
string_to_uint for rval parsing. Warn if retval is clipped in compat
personality.
And add support for reading of various types.
* string_to_uint.c (string_to_uint_ex): Change to work with long long.
(string_to_uint): Move it...
* string_to_uint.h (string_to_uint): ...here.
(string_to_uint_upto): Accept long long as max_val, return long long.
(string_to_ulong, string_to_kulong, string_to_ulonglong): New functions,
for completeness.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
This makes interface a bit irregular otherwise.
* defs.h (syscall_name): Clarify description.
* syscall.c (syscall_name): Do not call shuffle_scno.
* printsiginfo.c (print_si_info) <case SIGSYS>: Use shuffle_scno.
syscall_name() is used only in printsiginfo.c:print_si_info currently,
and is supplied with raw syscall number (that's why it has this ugly
__X32_SYSCALL_BIT hack). But since it handled only __X32_SYSCALL_BIT and
not shuffle_scno(), it was broken on ARM. Let's replace it with shuffle_scno
call, as it handles both the case of shuffled ARM syscalls and the
__X32_SYSCALL_BIT.
* syscall.c (syscall_name): Call shuffle_scno instead of custom
__X32_SYSCALL_BIT handling.
While we are here, let's fix AArch64 by limiting scno shuffling
to compat personality only.
* syscall.c: Include shuffle_scno.c.
(shuffle_scno): Move it to a...
* linux/arm/shuffle_scno.c: New file.
* linux/aarch64/shuffle_scno.c: New file, define arm's shuffle_scno
as arm_shuffle_scno and call it only for personality 1.
* linux/shuffle_scno.c: New file, fallback trivial shuffle_scno
definition.
* Makefile.am (EXTRA_DIST): Add them.
* tests/accept.c [__NR_accept && !TEST_SYSCALL_NAME]: Define a wrapper that
calls accept directly.
* tests/sockname.c [TEST_SYSCALL_STR]: Do not define TEST_SYSCALL_STR.
Since this is where get_error gets the return value from in the compat case.
linux/x86_64/set_error.c (set_error, set_success): Update i386_regs.eax
if tracee is in compat personality.