Commit Graph

12 Commits

Author SHA1 Message Date
Todd C. Miller
2eb8ff17be Define sudo_pt_regs instead of user_pt_regs and include the struct keyword.
On s390, the struct is typedef'd without a name.
2022-05-16 12:39:59 -06:00
Todd C. Miller
74c6353a84 ptrace support has been tested on Debian/riscv64. 2022-05-16 09:08:45 -06:00
Todd C. Miller
55bd6272c0 Tracing 32-bit arm binaries from a 64-bit sudo works. 2022-05-14 14:41:18 -06:00
Todd C. Miller
cb95b75ffa ptrace-based intercept has now been tested on 32-bit arm 2022-05-14 13:03:19 -06:00
Todd C. Miller
bb3c4ba07c Don't use PTRACE_SET_SYSCALL for 32-bit arm binaries running on aarch64.
Use PTRACE_SETREGSET with NT_ARM_SYSTEM_CALL instead just like we
would for a 64-bit binary.  Newer Linux headers don't define
PTRACE_SET_SYSCALL for aarch64.
2022-05-13 18:15:28 -06:00
Todd C. Miller
3226c2df40 Initial cut at MIPS support, untested.
Mips is a bit different in that most Linux distros appear to use
the n32 ABI on 64-bit CPUs.  We don't currently support tracing a
64-bit binary from a 32-bit sudo.  We could suport tracing o32
ABI binaries in compat mode, though.
2022-05-13 07:07:32 -06:00
Todd C. Miller
b99debf92f Add arm-specific code to set the system call number.
Fixes rejection of commands due to policy on arm when in intercept mode.
2022-05-12 10:23:27 -06:00
Todd C. Miller
31e8506c82 Enable ptrace intercept on powerpc.
Tested on ppc64 and ppc64le.
2022-05-11 20:07:59 -06:00
Todd C. Miller
a40d62b3d5 It is now safe to make WORDALIGN use compat (not native) aligment.
We allocate space for an extra pointer between argv and the string
table for compat binaries so there is no need to align address to
sizeof(long).
2022-05-09 11:03:30 -06:00
Todd C. Miller
f82aa334cc Use the entire word in ptrace_get_vec_len() and ptrace_read_vec().
For compat binaries, use the upper 32-bits as the next word instead
of calling ptrace(2) to get it.  This reduces the number of ptrace(2)
calls when reading argv and envp for compat binaries.
2022-05-09 10:09:30 -06:00
Todd C. Miller
a15ca9c85b Use native word size for padding and when reading/writing strings.
If we try to use the compat word size we can end up in a situation
where a subsequent PTRACE_POKEDATA overwrites part of what we've
already written since it always writes in sizeof(long) units.
2022-05-06 10:46:06 -06:00
Todd C. Miller
35ea534b3e Move register definitions to exec_ptrace.h 2022-05-05 13:37:26 -06:00