From c448d10586b50ad302ea6f80e54989e4cfbb3299 Mon Sep 17 00:00:00 2001 From: Jason White Date: Wed, 23 Nov 2022 13:55:56 -0800 Subject: [PATCH] Reduce size of getcpu vdso Summary: The `getcpu` VDSO was just returning 0 unconditionally. This was an old hack to determinize the getcpu syscall, but we don't need this anymore because we just intercept it and determinize it instead. Reducing the size of this vdso function will make it more compatible with various VDSO implementations. Reviewed By: wkhughes Differential Revision: D41506684 fbshipit-source-id: 3dacad93971ecc7969d725f8b7e984a189a0ebb4 --- reverie-ptrace/src/vdso.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/reverie-ptrace/src/vdso.rs b/reverie-ptrace/src/vdso.rs index dbf99ad..0974800 100644 --- a/reverie-ptrace/src/vdso.rs +++ b/reverie-ptrace/src/vdso.rs @@ -28,7 +28,7 @@ mod vdso_syms { #![allow(non_upper_case_globals)] pub const time: &[u8; 8] = &[ - 0xb8, 0xc9, 0x0, 0x0, 0x0, // mov %SYS_time, %eax + 0xb8, 0xc9, 0x00, 0x00, 0x00, // mov %SYS_time, %eax 0x0f, 0x05, // syscall 0xc3, // retq ]; @@ -39,16 +39,10 @@ mod vdso_syms { 0xc3, // retq ]; - pub const getcpu: &[u8; 32] = &[ - 0x48, 0x85, 0xff, // test %rdi, %rdi - 0x74, 0x06, // je .. - 0xc7, 0x07, 0x00, 0x00, 0x00, 0x00, // movl $0x0, (%rdi) - 0x48, 0x85, 0xf6, // test %rsi, %rsi - 0x74, 0x06, // je .. - 0xc7, 0x06, 0x00, 0x00, 0x00, 0x00, // movl $0x0, (%rsi) - 0x31, 0xc0, // xor %eax, %eax + pub const getcpu: &[u8; 8] = &[ + 0xb8, 0x35, 0x01, 0x00, 0x00, // mov SYS_getcpu, %eax + 0x0f, 0x05, // syscall 0xc3, // retq - 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00, // nopl 0x0(%rax) ]; pub const gettimeofday: &[u8; 8] = &[