checked auxv for what to handle
This commit is contained in:
@@ -18,7 +18,7 @@ IvyBridge(2012) and AMD Zen 2 Family 17H(2019) and Linux 5.9(2020).
|
|||||||
- [x] `rt_sigreturn`: we can't use the normal `syscall` interception because we push something onto
|
- [x] `rt_sigreturn`: we can't use the normal `syscall` interception because we push something onto
|
||||||
the stack, so `ucontext` isn't on top anymore.
|
the stack, so `ucontext` isn't on top anymore.
|
||||||
- [x] `/proc/self/exe`: intercept calls to `readlink`/`readlinkat` with that as argument
|
- [x] `/proc/self/exe`: intercept calls to `readlink`/`readlinkat` with that as argument
|
||||||
- [ ] `auxv`: check if that is setup correctly and completely
|
- [x] `auxv`: check if that is setup correctly and completely
|
||||||
- [ ] JIT support: intercept `mmap`, `mprotect` and `mremap` that change pages to be executable
|
- [ ] JIT support: intercept `mmap`, `mprotect` and `mremap` that change pages to be executable
|
||||||
- [ ] `SIGILL` patching fallback
|
- [ ] `SIGILL` patching fallback
|
||||||
- [x] `vdso` handling
|
- [x] `vdso` handling
|
||||||
|
|||||||
11
src/main.zig
11
src/main.zig
@@ -110,7 +110,6 @@ pub fn main() !void {
|
|||||||
var i: usize = 0;
|
var i: usize = 0;
|
||||||
const auxv = std.os.linux.elf_aux_maybe.?;
|
const auxv = std.os.linux.elf_aux_maybe.?;
|
||||||
while (auxv[i].a_type != elf.AT_NULL) : (i += 1) {
|
while (auxv[i].a_type != elf.AT_NULL) : (i += 1) {
|
||||||
// TODO: look at other auxv types and check if we need to change them.
|
|
||||||
auxv[i].a_un.a_val = switch (auxv[i].a_type) {
|
auxv[i].a_un.a_val = switch (auxv[i].a_type) {
|
||||||
elf.AT_PHDR => base + ehdr.phoff,
|
elf.AT_PHDR => base + ehdr.phoff,
|
||||||
elf.AT_PHENT => ehdr.phentsize,
|
elf.AT_PHENT => ehdr.phentsize,
|
||||||
@@ -123,6 +122,16 @@ pub fn main() !void {
|
|||||||
try patchLoadedElf(auxv[i].a_un.a_val);
|
try patchLoadedElf(auxv[i].a_un.a_val);
|
||||||
break :blk auxv[i].a_un.a_val;
|
break :blk auxv[i].a_un.a_val;
|
||||||
},
|
},
|
||||||
|
elf.AT_EXECFD => {
|
||||||
|
@panic("Got AT_EXECFD auxv value");
|
||||||
|
// TODO: handle AT_EXECFD, when needed
|
||||||
|
// The SysV ABI Specification says:
|
||||||
|
// > At process creation the system may pass control to an interpreter program. When
|
||||||
|
// > this happens, the system places either an entry of type AT_EXECFD or one of
|
||||||
|
// > type AT_PHDR in the auxiliary vector. The entry for type AT_EXECFD uses the
|
||||||
|
// > a_val member to contain a file descriptor open to read the application
|
||||||
|
// > program’s object file.
|
||||||
|
},
|
||||||
else => auxv[i].a_un.a_val,
|
else => auxv[i].a_un.a_val,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user