diff --git a/litebox_platform_linux_userland/src/syscall_intercept/systrap.rs b/litebox_platform_linux_userland/src/syscall_intercept/systrap.rs index c9b0d3ded3..642267cdae 100644 --- a/litebox_platform_linux_userland/src/syscall_intercept/systrap.rs +++ b/litebox_platform_linux_userland/src/syscall_intercept/systrap.rs @@ -605,6 +605,7 @@ fn register_seccomp_filter() { (libc::SYS_gettid, vec![]), (libc::SYS_futex, vec![]), (libc::SYS_set_tid_address, vec![]), + (libc::SYS_exit, vec![]), (libc::SYS_exit_group, vec![]), (libc::SYS_tgkill, vec![]), (libc::SYS_set_robust_list, vec![]), diff --git a/litebox_shim_linux/Cargo.toml b/litebox_shim_linux/Cargo.toml index 3033b8b9d7..6104fb09ea 100644 --- a/litebox_shim_linux/Cargo.toml +++ b/litebox_shim_linux/Cargo.toml @@ -9,6 +9,7 @@ litebox = { path = "../litebox/", version = "0.1.0" } litebox_common_linux = { path = "../litebox_common_linux/", version = "0.1.0" } litebox_platform_multiplex = { path = "../litebox_platform_multiplex/", version = "0.1.0" } once_cell = { version = "1.20.2", default-features = false, features = ["alloc", "race"] } +elf = { version = "0.7.4", default-features = false } # Currently a specific commit (a6e338f1e97e95c192b305bd78be9dd3a54f4bf9) in # https://github.com/weizhiao/rust-elfloader/ causes trouble on the latest # released version of elf-loader, thus we limit ourselves to the released @@ -16,6 +17,7 @@ once_cell = { version = "1.20.2", default-features = false, features = ["alloc", elf_loader = { version = "=0.10.0", features = ["fs"] } thiserror = { version = "2.0.6", default-features = false } ringbuf = { version = "0.4.8", default-features = false, features = ["alloc"] } +syscalls = { version = "0.6", default-features = false } [target.'cfg(target_arch = "x86")'.dependencies] # ELF loader requires us to enable the `rel` dependency on 32-bit to work. diff --git a/litebox_shim_linux/src/lib.rs b/litebox_shim_linux/src/lib.rs index 6e085ce983..2d8b8e8f6a 100644 --- a/litebox_shim_linux/src/lib.rs +++ b/litebox_shim_linux/src/lib.rs @@ -22,8 +22,9 @@ use litebox::{ LiteBox, fs::FileSystem, mm::{PageManager, linux::PAGE_SIZE}, - platform::{RawConstPointer as _, RawMutPointer as _}, + platform::{ExitProvider as _, RawConstPointer as _, RawMutPointer as _}, sync::RwLock, + utils::{ReinterpretSignedExt, TruncateExt as _}, }; use litebox_common_linux::{SyscallRequest, errno::Errno}; use litebox_platform_multiplex::Platform; @@ -432,3 +433,166 @@ pub fn syscall_entry(request: SyscallRequest) -> isize { }, ) } + +#[cfg(target_arch = "x86_64")] +core::arch::global_asm!( + " + .text + .align 4 + .globl syscall_callback + .type syscall_callback,@function +syscall_callback: + /* TODO: save float and vector registers (xsave or fxsave) */ + /* Save caller-saved registers */ + push rcx + push rdx + push rsi + push rdi + push r8 + push r9 + push r10 + push r11 + pushf + + /* Save the original stack pointer */ + push rbp + mov rbp, rsp + + /* Align the stack to 16 bytes */ + and rsp, -16 + + /* Reserve space on the stack for syscall arguments */ + sub rsp, 48 + + /* Save syscall arguments (rdi, rsi, rdx, r10, r8, r9) into the reserved space */ + mov [rsp], rdi + mov [rsp + 8], rsi + mov [rsp + 16], rdx + mov [rsp + 24], r10 + mov [rsp + 32], r8 + mov [rsp + 40], r9 + + /* Pass the syscall number to the syscall dispatcher */ + mov rdi, rax + /* Pass the pointer to the syscall arguments to syscall_handler */ + mov rsi, rsp + + /* Call syscall_handler */ + call syscall_handler + + /* Restore the original stack pointer */ + mov rsp, rbp + pop rbp + + /* Restore caller-saved registers */ + popf + pop r11 + pop r10 + pop r9 + pop r8 + pop rdi + pop rsi + pop rdx + pop rcx + + /* Return to the caller */ + ret +" +); + +/// Syscall callback function for 32-bit x86 +/// +/// The stack layout at the entry of the callback (see litebox_syscall_rewriter +/// for more details): +/// +/// Addr | data | +/// 0 | sysno | +/// -4: | ret addr | <-- esp +/// +/// The first two instructions adjust the stack such that it saves one +/// instruction (i.e., `pop sysno`) from the caller (trampoline code). +#[cfg(target_arch = "x86")] +core::arch::global_asm!( + " + .text + .align 4 + .globl syscall_callback + .type syscall_callback,@function +syscall_callback: + pop eax /* pop ret addr */ + xchg eax, [esp] /* exchange it with sysno */ + + /* Save registers and constructs arguments */ + push ebp + push edi + push esi + push edx + push ecx + push ebx + push eax + + /* save the pointer to argments in eax */ + mov eax, esp + + pushf + /* Save the original stack pointer */ + mov ebp, esp + /* Align the stack to 16 bytes */ + and esp, -16 + + /* Pass the pointer to the sysno and arguments to syscall_handler_32 */ + push eax + + call syscall_handler_32 + + mov esp, ebp + popf + pop ebx /* not need to restore eax (sysno) */ + pop ebx + pop ecx + pop edx + pop esi + pop edi + pop ebp + + /* Return to the caller */ + ret +" +); + +unsafe extern "C" { + pub(crate) fn syscall_callback() -> isize; +} + +#[unsafe(no_mangle)] +#[cfg(target_arch = "x86")] +unsafe extern "C" fn syscall_handler_32(args: *const usize) -> isize { + let syscall_number = unsafe { *args }; + unsafe { syscall_handler(syscall_number, args.add(1)) } +} + +#[unsafe(no_mangle)] +unsafe extern "C" fn syscall_handler(syscall_number: usize, args: *const usize) -> isize { + let syscall_args = unsafe { core::slice::from_raw_parts(args, 6) }; + let Ok(syscall_number) = u32::try_from(syscall_number) else { + return Errno::ENOSYS.as_neg() as isize; + }; + let sysno = ::syscalls::Sysno::from(syscall_number); + let dispatcher = match sysno { + ::syscalls::Sysno::write => SyscallRequest::Write { + fd: syscall_args[0].reinterpret_as_signed().truncate(), + buf: unsafe { core::mem::transmute::>(syscall_args[1]) }, + count: syscall_args[2], + }, + ::syscalls::Sysno::exit | ::syscalls::Sysno::exit_group => { + litebox_platform_multiplex::platform() + .exit(syscall_args[0].reinterpret_as_signed().truncate()) + } + _ => todo!("syscall {sysno} not implemented"), + }; + if let SyscallRequest::Ret(ret) = dispatcher { + ret + } else { + syscall_entry(dispatcher) + } +} diff --git a/litebox_shim_linux/src/loader/elf.rs b/litebox_shim_linux/src/loader/elf.rs index caf3026e71..c5977dfef0 100644 --- a/litebox_shim_linux/src/loader/elf.rs +++ b/litebox_shim_linux/src/loader/elf.rs @@ -184,6 +184,55 @@ pub struct ElfLoadInfo { pub user_stack_top: usize, } +#[cfg(target_arch = "x86_64")] +type Ehdr = elf::file::Elf64_Ehdr; +#[cfg(target_arch = "x86")] +type Ehdr = elf::file::Elf32_Ehdr; +#[cfg(target_arch = "x86_64")] +type Shdr = elf::section::Elf64_Shdr; +#[cfg(target_arch = "x86")] +type Shdr = elf::section::Elf32_Shdr; + +/// Get the syscall callback placeholder address from the ELF file if it is modified by our syscall +/// rewriter. The placeholder initially has a magic number that is going to be replaced by the actual +/// syscall callback. +fn get_syscall_callback_placeholder(object: &mut ElfFile) -> Option> { + let mut buf: [u8; size_of::()] = [0; size_of::()]; + object.read(&mut buf, 0).unwrap(); + let elfhdr: &Ehdr = unsafe { &*(buf.as_ptr().cast()) }; + + // read section headers + let shdrs_size = usize::from(elfhdr.e_shentsize) * usize::from(elfhdr.e_shnum.checked_sub(1)?); + let mut buf: [u8; size_of::()] = [0; size_of::()]; + // Read the last section header because our syscall rewriter adds a trampoline section at the end. + object + .read( + &mut buf, + usize::try_from(elfhdr.e_shoff).unwrap() + shdrs_size, + ) + .unwrap(); + let trampoline_shdr: &Shdr = unsafe { &*(buf.as_ptr().cast()) }; + if trampoline_shdr.sh_type != elf::abi::SHT_PROGBITS + || trampoline_shdr.sh_flags != (elf::abi::SHF_ALLOC | elf::abi::SHF_EXECINSTR).into() + { + return None; + } + + let mut placeholder: [u8; 8] = [0; 8]; + object + .read( + &mut placeholder, + usize::try_from(trampoline_shdr.sh_offset).unwrap(), + ) + .ok()?; + let magic_number = u64::from_ne_bytes(placeholder); + // TODO: check section name instead of magic number + if magic_number != super::REWRITER_MAGIC_NUMBER { + return None; + } + NonNull::new(trampoline_shdr.sh_addr as *mut usize) +} + /// Loader for ELF files pub(super) struct ElfLoader; @@ -217,9 +266,28 @@ impl ElfLoader { ) -> Result { let elf = { let mut loader = Loader::::new(); - loader - .easy_load(ElfFile::new(path).map_err(ElfLoaderError::OpenError)?) - .map_err(ElfLoaderError::LoaderError)? + let mut object = ElfFile::new(path).map_err(ElfLoaderError::OpenError)?; + // Check if the file is modified by our syscall rewriter. If so, we need to update + // the syscall callback pointer. + let placeholder = get_syscall_callback_placeholder(&mut object); + let elf = loader + .easy_load(object) + .map_err(ElfLoaderError::LoaderError)?; + if let Some(placeholder) = placeholder { + // mprotect the memory to make it writable + let pm = litebox_page_manager(); + // `mprotect` requires the address to be page-aligned + let start_addr = placeholder.as_ptr() as usize & !(PAGE_SIZE - 1); + let ptr = unsafe { + core::mem::transmute::<*mut u8, crate::MutPtr>(start_addr as *mut u8) + }; + unsafe { pm.make_pages_writable(ptr, 0x1000) } + .expect("failed to make pages writable"); + unsafe { placeholder.write(crate::syscall_callback as usize) }; + unsafe { pm.make_pages_executable(ptr, 0x1000) } + .expect("failed to make pages executable"); + } + elf }; let interp: Option = if let Some(interp_name) = elf.interp() { // e.g., /lib64/ld-linux-x86-64.so.2 diff --git a/litebox_shim_linux/src/loader/mod.rs b/litebox_shim_linux/src/loader/mod.rs index 16894bc6fc..7d6da28723 100644 --- a/litebox_shim_linux/src/loader/mod.rs +++ b/litebox_shim_linux/src/loader/mod.rs @@ -11,3 +11,7 @@ pub fn load_program( ) -> Result { elf::ElfLoader::load(path, argv, envp) } + +/// The magic number used to identify the LiteBox rewriter and where we should +/// update the syscall callback pointer. +pub const REWRITER_MAGIC_NUMBER: u64 = u64::from_le_bytes(*b"LITE BOX"); diff --git a/litebox_shim_linux/tests/common/mod.rs b/litebox_shim_linux/tests/common/mod.rs index c9f85c7939..3e7b3ae3f0 100644 --- a/litebox_shim_linux/tests/common/mod.rs +++ b/litebox_shim_linux/tests/common/mod.rs @@ -42,7 +42,7 @@ unsafe extern "C" { fn trampoline(entry: usize, sp: usize) -> !; } -pub fn init_platform() { +pub fn init_platform(enable_systrap: bool) { let platform = Platform::new(None); set_platform(platform); let platform = litebox_platform_multiplex::platform(); @@ -67,7 +67,9 @@ pub fn init_platform() { ), litebox::fs::layered::LayeringSemantics::LowerLayerWritableFiles, )); - platform.enable_syscall_interception_with(litebox_shim_linux::syscall_entry); + if enable_systrap { + platform.enable_syscall_interception_with(litebox_shim_linux::syscall_entry); + } install_dir("/lib64"); install_dir("/lib32"); @@ -75,12 +77,15 @@ pub fn init_platform() { install_dir("/lib/x86_64-linux-gnu"); } -pub fn compile(output: &std::path::Path, exec_or_lib: bool) { - // Compile the hello.c file to an executable - let mut args = vec!["-o", output.to_str().unwrap(), "./tests/hello.c"]; +/// Compile C code into an executable +pub fn compile(input: &str, output: &str, exec_or_lib: bool, nolibc: bool) { + let mut args = vec!["-o", output, input]; if exec_or_lib { args.push("-static"); } + if nolibc { + args.push("-nostdlib"); + } args.push(match std::env::consts::ARCH { "x86_64" => "-m64", "x86" => "-m32", diff --git a/litebox_shim_linux/tests/dylib.rs b/litebox_shim_linux/tests/dylib.rs index ae1ba1136a..48ac99ff10 100644 --- a/litebox_shim_linux/tests/dylib.rs +++ b/litebox_shim_linux/tests/dylib.rs @@ -6,7 +6,7 @@ mod common; fn test_load_exec_dynamic() { let dir_path = std::env::var("OUT_DIR").unwrap(); let path = std::path::Path::new(dir_path.as_str()).join("hello_dylib"); - common::compile(&path, false); + common::compile("./tests/hello.c", path.to_str().unwrap(), false, false); let executable_path = "/hello_dylib"; let executable_data = std::fs::read(path).unwrap(); @@ -25,7 +25,7 @@ fn test_load_exec_dynamic() { .map(|f| (f, std::fs::read(f).unwrap())) .collect(); - common::init_platform(); + common::init_platform(true); common::install_file(executable_data, executable_path); for (path, data) in files { diff --git a/litebox_shim_linux/tests/exec.rs b/litebox_shim_linux/tests/exec.rs index 521f2a3e44..7f562a2995 100644 --- a/litebox_shim_linux/tests/exec.rs +++ b/litebox_shim_linux/tests/exec.rs @@ -4,14 +4,144 @@ mod common; fn test_load_exec_static() { let dir_path = std::env::var("OUT_DIR").unwrap(); let path = std::path::Path::new(dir_path.as_str()).join("hello_exec"); - common::compile(&path, true); + common::compile("./tests/hello.c", path.to_str().unwrap(), true, false); let executable_path = "/hello_exec"; let executable_data = std::fs::read(path).unwrap(); - common::init_platform(); + common::init_platform(true); common::install_file(executable_data, executable_path); common::test_load_exec_common(executable_path); } + +const HELLO_WORLD_NOLIBC: &str = r#" +// gcc tests/test.c -o test -static -nostdlib (-m32) +#if defined(__x86_64__) +int write(int fd, const char *buf, int length) +{ + int ret; + + asm("mov %1, %%eax\n\t" + "mov %2, %%edi\n\t" + "mov %3, %%rsi\n\t" + "mov %4, %%edx\n\t" + "syscall\n\t" + "mov %%eax, %0" + : "=r" (ret) + : "i" (1), // #define SYS_write 1 + "r" (fd), + "r" (buf), + "r" (length) + : "%eax", "%edi", "%rsi", "%edx"); + + return ret; +} + +_Noreturn void exit_group(int code) +{ + /* Infinite for-loop since this function can't return */ + for (;;) { + asm("mov %0, %%eax\n\t" + "mov %1, %%edi\n\t" + "syscall\n\t" + : + : "i" (231), // #define SYS_exit_group 231 + "r" (code) + : "%eax", "%edi"); + } +} +#elif defined(__i386__) +int write(int fd, const char *buf, int length) +{ + int ret; + + asm("mov %1, %%eax\n\t" + "mov %2, %%ebx\n\t" + "mov %3, %%ecx\n\t" + "mov %4, %%edx\n\t" + "int $0x80\n\t" + "mov %%eax, %0" + : "=r" (ret) + : "i" (4), // #define SYS_write 4 + "g" (fd), + "g" (buf), + "g" (length) + : "%eax", "%ebx", "%ecx", "%edx"); + + return ret; +} +_Noreturn void exit_group(int code) +{ + /* Infinite for-loop since this function can't return */ + for (;;) { + asm("mov %0, %%eax\n\t" + "mov %1, %%ebx\n\t" + "int $0x80\n\t" + : + : "i" (252), // #define SYS_exit_group 252 + "r" (code) + : "%eax", "%ebx"); + } +} +#else +#error "Unsupported architecture" +#endif + +int main() { + // use write to print a string + write(1, "Hello, World!\n", 14); + return 0; +} + +void _start() { + exit_group(main()); +} +"#; + +#[test] +fn test_syscall_rewriter() { + let dir_path = std::env::var("OUT_DIR").unwrap(); + let src_path = std::path::Path::new(dir_path.as_str()).join("hello_exec_nolibc.c"); + std::fs::write(src_path.clone(), HELLO_WORLD_NOLIBC).unwrap(); + let path = std::path::Path::new(dir_path.as_str()).join("hello_exec_nolibc"); + common::compile( + src_path.to_str().unwrap(), + path.to_str().unwrap(), + true, + true, + ); + + // rewrite the hello_exec_nolibc + let hooked_path = std::path::Path::new(dir_path.as_str()).join("hello_exec_nolibc.hooked"); + let _ = std::fs::remove_file(hooked_path.clone()); + let output = std::process::Command::new("cargo") + .args([ + "run", + "-p", + "litebox_syscall_rewriter", + "--", + "--trampoline-addr", + litebox_shim_linux::loader::REWRITER_MAGIC_NUMBER + .to_string() + .as_str(), + "-o", + hooked_path.to_str().unwrap(), + path.to_str().unwrap(), + ]) + .output() + .expect("Failed to run syscall rewriter"); + assert!( + output.status.success(), + "failed to run syscall rewriter {:?}", + std::str::from_utf8(output.stderr.as_slice()).unwrap() + ); + + let executable_path = "/hello_exec_nolibc.hooked"; + let executable_data = std::fs::read(hooked_path).unwrap(); + + common::init_platform(false); + common::install_file(executable_data, executable_path); + common::test_load_exec_common(executable_path); +} diff --git a/litebox_syscall_rewriter/src/lib.rs b/litebox_syscall_rewriter/src/lib.rs index c8f6d616d0..9e729d748e 100644 --- a/litebox_syscall_rewriter/src/lib.rs +++ b/litebox_syscall_rewriter/src/lib.rs @@ -288,9 +288,21 @@ fn hook_syscalls_in_section( ); // Add call [rip + offset_to_shared_target] - trampoline_data.extend_from_slice(&[0xFF, 0x15]); - let disp32 = -(i32::try_from(trampoline_data.len()).unwrap() + 4); - trampoline_data.extend_from_slice(&disp32.to_le_bytes()); + if arch == Arch::X86_64 { + trampoline_data.extend_from_slice(&[0xFF, 0x15]); + let disp32 = -(i32::try_from(trampoline_data.len()).unwrap() + 4); + trampoline_data.extend_from_slice(&disp32.to_le_bytes()); + } else { + // For 32-bit, use a different approach to simulate `call [rip + disp32]` + trampoline_data.push(0x50); // PUSH EAX + trampoline_data.extend_from_slice(&[0xE8, 0x0, 0x0, 0x0, 0x0]); // CALL next instruction + trampoline_data.push(0x58); // POP EAX (effectively store IP in EAX) + trampoline_data.extend_from_slice(&[0xFF, 0x90]); // CALL [EAX + offset] + let disp32 = -(i32::try_from(trampoline_data.len()).unwrap() - 3); + trampoline_data.extend_from_slice(&disp32.to_le_bytes()); + // Note we skip `POP EAX` here as it is done by the callback `syscall_callback` + // from litebox_shim_linux/src/lib.rs, which helps reduce the size of the trampoline. + } // Add jmp back to original after syscall let return_addr = inst.address() + inst.bytes().len() as u64; diff --git a/litebox_syscall_rewriter/tests/snapshots/snapshot_tests__hello-32-diff.snap b/litebox_syscall_rewriter/tests/snapshots/snapshot_tests__hello-32-diff.snap index bce3a7a519..35bdeed5e5 100644 --- a/litebox_syscall_rewriter/tests/snapshots/snapshot_tests__hello-32-diff.snap +++ b/litebox_syscall_rewriter/tests/snapshots/snapshot_tests__hello-32-diff.snap @@ -26,7 +26,7 @@ snapshot_kind: text - 804bf8c: c7 44 24 4c 51 00 00 movl $0x51,0x4c(%esp) - 804bf93: 00 - 804bf94: cd 80 int $0x80 -+ 804bf8c: e9 94 26 06 00 jmp 80ae625 <_fini+0x29> ++ 804bf8c: e9 9b 26 06 00 jmp 80ae62c <_fini+0x30> + 804bf91: 90 nop + 804bf92: 90 nop + 804bf93: 90 nop @@ -40,13 +40,13 @@ snapshot_kind: text 804bfab: 8d 8e 20 e6 fc ff lea -0x319e0(%esi),%ecx - 804bfb1: ba 2d 00 00 00 mov $0x2d,%edx - 804bfb6: cd 80 int $0x80 -+ 804bfb1: e9 82 26 06 00 jmp 80ae638 <_fini+0x3c> ++ 804bfb1: e9 90 26 06 00 jmp 80ae646 <_fini+0x4a> + 804bfb6: 90 nop + 804bfb7: 90 nop 804bfb8: b8 fc 00 00 00 mov $0xfc,%eax - 804bfbd: bb 7f 00 00 00 mov $0x7f,%ebx - 804bfc2: cd 80 int $0x80 -+ 804bfbd: e9 86 26 06 00 jmp 80ae648 <_fini+0x4c> ++ 804bfbd: e9 9b 26 06 00 jmp 80ae65d <_fini+0x61> + 804bfc2: 90 nop + 804bfc3: 90 nop 804bfc4: e8 67 ff 00 00 call 805bf30 <__tls_init_tp> @@ -58,13 +58,13 @@ snapshot_kind: text 804c082: 8d 8e 20 e6 fc ff lea -0x319e0(%esi),%ecx - 804c088: ba 2d 00 00 00 mov $0x2d,%edx - 804c08d: cd 80 int $0x80 -+ 804c088: e9 cb 25 06 00 jmp 80ae658 <_fini+0x5c> ++ 804c088: e9 e7 25 06 00 jmp 80ae674 <_fini+0x78> + 804c08d: 90 nop + 804c08e: 90 nop 804c08f: b8 fc 00 00 00 mov $0xfc,%eax - 804c094: bb 7f 00 00 00 mov $0x7f,%ebx - 804c099: cd 80 int $0x80 -+ 804c094: e9 cf 25 06 00 jmp 80ae668 <_fini+0x6c> ++ 804c094: e9 f2 25 06 00 jmp 80ae68b <_fini+0x8f> + 804c099: 90 nop + 804c09a: 90 nop 804c09b: e9 46 fe ff ff jmp 804bee6 <__libc_setup_tls+0x126> @@ -76,7 +76,7 @@ snapshot_kind: text 805a30c: b8 2d 00 00 00 mov $0x2d,%eax - 805a311: 8b 5c 24 08 mov 0x8(%esp),%ebx - 805a315: cd 80 int $0x80 -+ 805a311: e9 62 43 05 00 jmp 80ae678 <_fini+0x7c> ++ 805a311: e9 8c 43 05 00 jmp 80ae6a2 <_fini+0xa6> + 805a316: 90 nop 805a317: 89 82 28 36 00 00 mov %eax,0x3628(%edx) 805a31d: 39 d8 cmp %ebx,%eax @@ -88,13 +88,13 @@ snapshot_kind: text - 805c9b5: 31 db xor %ebx,%ebx - 805c9b7: 89 c8 mov %ecx,%eax - 805c9b9: cd 80 int $0x80 -+ 805c9b5: e9 cd 1c 05 00 jmp 80ae687 <_fini+0x8b> ++ 805c9b5: e9 fe 1c 05 00 jmp 80ae6b8 <_fini+0xbc> + 805c9ba: 90 nop 805c9bb: 89 c2 mov %eax,%edx - 805c9bd: 8d 1c 28 lea (%eax,%ebp,1),%ebx - 805c9c0: 89 c8 mov %ecx,%eax - 805c9c2: cd 80 int $0x80 -+ 805c9bd: e9 d4 1c 05 00 jmp 80ae696 <_fini+0x9a> ++ 805c9bd: e9 0c 1d 05 00 jmp 80ae6ce <_fini+0xd2> + 805c9c2: 90 nop + 805c9c3: 90 nop 805c9c4: 39 c2 cmp %eax,%edx @@ -107,7 +107,7 @@ snapshot_kind: text - 805ca0d: c3 ret - 805ca0e: 66 90 xchg %ax,%ax + 805ca0d: e9 .byte 0xe9 -+ 805ca0e: 94 xchg %eax,%esp ++ 805ca0e: d3 .byte 0xd3 + 805ca0f: 1c .byte 0x1c 0805ca10 <_dl_sysinfo_int80>: @@ -128,7 +128,7 @@ snapshot_kind: text 808b545: 8b 6f 08 mov 0x8(%edi),%ebp - 808b548: 8b 7f 04 mov 0x4(%edi),%edi - 808b54b: cd 80 int $0x80 -+ 808b548: e9 67 31 02 00 jmp 80ae6b4 <_fini+0xb8> ++ 808b548: e9 ad 31 02 00 jmp 80ae6fa <_fini+0xfe> 808b54d: 5d pop %ebp 808b54e: 5f pop %edi 808b54f: 5b pop %ebx @@ -138,7 +138,7 @@ snapshot_kind: text 80930a6: 8d 4c 24 30 lea 0x30(%esp),%ecx - 80930aa: b8 92 00 00 00 mov $0x92,%eax - 80930af: cd 80 int $0x80 -+ 80930aa: e9 13 b6 01 00 jmp 80ae6c2 <_fini+0xc6> ++ 80930aa: e9 60 b6 01 00 jmp 80ae70f <_fini+0x113> + 80930af: 90 nop + 80930b0: 90 nop 80930b1: 81 c4 bc 04 00 00 add $0x4bc,%esp @@ -150,7 +150,7 @@ snapshot_kind: text 08098e30 <__restore_rt>: - 8098e30: b8 ad 00 00 00 mov $0xad,%eax - 8098e35: cd 80 int $0x80 -+ 8098e30: e9 9d 58 01 00 jmp 80ae6d2 <_fini+0xd6> ++ 8098e30: e9 f1 58 01 00 jmp 80ae726 <_fini+0x12a> + 8098e35: 90 nop + 8098e36: 90 nop 8098e37: 90 nop @@ -159,13 +159,13 @@ snapshot_kind: text 8098e38: 58 pop %eax - 8098e39: b8 77 00 00 00 mov $0x77,%eax - 8098e3e: cd 80 int $0x80 -+ 8098e39: e9 a4 58 01 00 jmp 80ae6e2 <_fini+0xe6> ++ 8098e39: e9 ff 58 01 00 jmp 80ae73d <_fini+0x141> + 8098e3e: 90 nop + 8098e3f: 90 nop 08098e40 <__libc_sigaction>: 8098e40: 55 push %ebp -@@ -124321,4 +124331,57 @@ +@@ -124321,4 +124331,99 @@ 80ae605: 81 c3 ef 49 03 00 add $0x349ef,%ebx 80ae60b: 83 c4 08 add $0x8,%esp 80ae60e: 5b pop %ebx @@ -180,49 +180,91 @@ snapshot_kind: text + 80ae612: 00 00 add %al,(%eax) + 80ae614: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi + 80ae618: 89 d0 mov %edx,%eax -+ 80ae61a: ff 15 f0 ff ff ff call *0xfffffff0 -+ 80ae620: e9 df b7 f9 ff jmp 8049e04 <__libc_start_call_main+0x94> -+ 80ae625: c7 44 24 4c 51 00 00 movl $0x51,0x4c(%esp) -+ 80ae62c: 00 -+ 80ae62d: ff 15 dd ff ff ff call *0xffffffdd -+ 80ae633: e9 5e d9 f9 ff jmp 804bf96 <__libc_setup_tls+0x1d6> -+ 80ae638: ba 2d 00 00 00 mov $0x2d,%edx -+ 80ae63d: ff 15 cd ff ff ff call *0xffffffcd -+ 80ae643: e9 70 d9 f9 ff jmp 804bfb8 <__libc_setup_tls+0x1f8> -+ 80ae648: bb 7f 00 00 00 mov $0x7f,%ebx -+ 80ae64d: ff 15 bd ff ff ff call *0xffffffbd -+ 80ae653: e9 6c d9 f9 ff jmp 804bfc4 <__libc_setup_tls+0x204> -+ 80ae658: ba 2d 00 00 00 mov $0x2d,%edx -+ 80ae65d: ff 15 ad ff ff ff call *0xffffffad -+ 80ae663: e9 27 da f9 ff jmp 804c08f <__libc_setup_tls+0x2cf> -+ 80ae668: bb 7f 00 00 00 mov $0x7f,%ebx -+ 80ae66d: ff 15 9d ff ff ff call *0xffffff9d -+ 80ae673: e9 23 da f9 ff jmp 804c09b <__libc_setup_tls+0x2db> -+ 80ae678: 8b 5c 24 08 mov 0x8(%esp),%ebx -+ 80ae67c: ff 15 8e ff ff ff call *0xffffff8e -+ 80ae682: e9 90 bc fa ff jmp 805a317 <__brk+0x17> -+ 80ae687: 31 db xor %ebx,%ebx -+ 80ae689: 89 c8 mov %ecx,%eax -+ 80ae68b: ff 15 7f ff ff ff call *0xffffff7f -+ 80ae691: e9 25 e3 fa ff jmp 805c9bb <_dl_early_allocate+0x4b> -+ 80ae696: 8d 1c 28 lea (%eax,%ebp,1),%ebx -+ 80ae699: 89 c8 mov %ecx,%eax -+ 80ae69b: ff 15 6f ff ff ff call *0xffffff6f -+ 80ae6a1: e9 1e e3 fa ff jmp 805c9c4 <_dl_early_allocate+0x54> -+ 80ae6a6: c3 ret -+ 80ae6a7: 66 90 xchg %ax,%ax -+ 80ae6a9: ff 15 61 ff ff ff call *0xffffff61 -+ 80ae6af: e9 5e e3 fa ff jmp 805ca12 <_dl_sysinfo_int80+0x2> -+ 80ae6b4: 8b 7f 04 mov 0x4(%edi),%edi -+ 80ae6b7: ff 15 53 ff ff ff call *0xffffff53 -+ 80ae6bd: e9 8b ce fd ff jmp 808b54d <__libc_do_syscall_int80+0xd> -+ 80ae6c2: b8 92 00 00 00 mov $0x92,%eax -+ 80ae6c7: ff 15 43 ff ff ff call *0xffffff43 -+ 80ae6cd: e9 df 49 fe ff jmp 80930b1 <_dl_debug_vdprintf+0xf1> -+ 80ae6d2: b8 ad 00 00 00 mov $0xad,%eax -+ 80ae6d7: ff 15 33 ff ff ff call *0xffffff33 -+ 80ae6dd: e9 55 a7 fe ff jmp 8098e37 <__restore_rt+0x7> -+ 80ae6e2: b8 77 00 00 00 mov $0x77,%eax -+ 80ae6e7: ff 15 23 ff ff ff call *0xffffff23 -+ 80ae6ed: e9 4e a7 fe ff jmp 8098e40 <__libc_sigaction> ++ 80ae61a: 50 push %eax ++ 80ae61b: e8 00 00 00 00 call 80ae620 <_fini+0x24> ++ 80ae620: 58 pop %eax ++ 80ae621: ff 90 f0 ff ff ff call *-0x10(%eax) ++ 80ae627: e9 d8 b7 f9 ff jmp 8049e04 <__libc_start_call_main+0x94> ++ 80ae62c: c7 44 24 4c 51 00 00 movl $0x51,0x4c(%esp) ++ 80ae633: 00 ++ 80ae634: 50 push %eax ++ 80ae635: e8 00 00 00 00 call 80ae63a <_fini+0x3e> ++ 80ae63a: 58 pop %eax ++ 80ae63b: ff 90 d6 ff ff ff call *-0x2a(%eax) ++ 80ae641: e9 50 d9 f9 ff jmp 804bf96 <__libc_setup_tls+0x1d6> ++ 80ae646: ba 2d 00 00 00 mov $0x2d,%edx ++ 80ae64b: 50 push %eax ++ 80ae64c: e8 00 00 00 00 call 80ae651 <_fini+0x55> ++ 80ae651: 58 pop %eax ++ 80ae652: ff 90 bf ff ff ff call *-0x41(%eax) ++ 80ae658: e9 5b d9 f9 ff jmp 804bfb8 <__libc_setup_tls+0x1f8> ++ 80ae65d: bb 7f 00 00 00 mov $0x7f,%ebx ++ 80ae662: 50 push %eax ++ 80ae663: e8 00 00 00 00 call 80ae668 <_fini+0x6c> ++ 80ae668: 58 pop %eax ++ 80ae669: ff 90 a8 ff ff ff call *-0x58(%eax) ++ 80ae66f: e9 50 d9 f9 ff jmp 804bfc4 <__libc_setup_tls+0x204> ++ 80ae674: ba 2d 00 00 00 mov $0x2d,%edx ++ 80ae679: 50 push %eax ++ 80ae67a: e8 00 00 00 00 call 80ae67f <_fini+0x83> ++ 80ae67f: 58 pop %eax ++ 80ae680: ff 90 91 ff ff ff call *-0x6f(%eax) ++ 80ae686: e9 04 da f9 ff jmp 804c08f <__libc_setup_tls+0x2cf> ++ 80ae68b: bb 7f 00 00 00 mov $0x7f,%ebx ++ 80ae690: 50 push %eax ++ 80ae691: e8 00 00 00 00 call 80ae696 <_fini+0x9a> ++ 80ae696: 58 pop %eax ++ 80ae697: ff 90 7a ff ff ff call *-0x86(%eax) ++ 80ae69d: e9 f9 d9 f9 ff jmp 804c09b <__libc_setup_tls+0x2db> ++ 80ae6a2: 8b 5c 24 08 mov 0x8(%esp),%ebx ++ 80ae6a6: 50 push %eax ++ 80ae6a7: e8 00 00 00 00 call 80ae6ac <_fini+0xb0> ++ 80ae6ac: 58 pop %eax ++ 80ae6ad: ff 90 64 ff ff ff call *-0x9c(%eax) ++ 80ae6b3: e9 5f bc fa ff jmp 805a317 <__brk+0x17> ++ 80ae6b8: 31 db xor %ebx,%ebx ++ 80ae6ba: 89 c8 mov %ecx,%eax ++ 80ae6bc: 50 push %eax ++ 80ae6bd: e8 00 00 00 00 call 80ae6c2 <_fini+0xc6> ++ 80ae6c2: 58 pop %eax ++ 80ae6c3: ff 90 4e ff ff ff call *-0xb2(%eax) ++ 80ae6c9: e9 ed e2 fa ff jmp 805c9bb <_dl_early_allocate+0x4b> ++ 80ae6ce: 8d 1c 28 lea (%eax,%ebp,1),%ebx ++ 80ae6d1: 89 c8 mov %ecx,%eax ++ 80ae6d3: 50 push %eax ++ 80ae6d4: e8 00 00 00 00 call 80ae6d9 <_fini+0xdd> ++ 80ae6d9: 58 pop %eax ++ 80ae6da: ff 90 37 ff ff ff call *-0xc9(%eax) ++ 80ae6e0: e9 df e2 fa ff jmp 805c9c4 <_dl_early_allocate+0x54> ++ 80ae6e5: c3 ret ++ 80ae6e6: 66 90 xchg %ax,%ax ++ 80ae6e8: 50 push %eax ++ 80ae6e9: e8 00 00 00 00 call 80ae6ee <_fini+0xf2> ++ 80ae6ee: 58 pop %eax ++ 80ae6ef: ff 90 22 ff ff ff call *-0xde(%eax) ++ 80ae6f5: e9 18 e3 fa ff jmp 805ca12 <_dl_sysinfo_int80+0x2> ++ 80ae6fa: 8b 7f 04 mov 0x4(%edi),%edi ++ 80ae6fd: 50 push %eax ++ 80ae6fe: e8 00 00 00 00 call 80ae703 <_fini+0x107> ++ 80ae703: 58 pop %eax ++ 80ae704: ff 90 0d ff ff ff call *-0xf3(%eax) ++ 80ae70a: e9 3e ce fd ff jmp 808b54d <__libc_do_syscall_int80+0xd> ++ 80ae70f: b8 92 00 00 00 mov $0x92,%eax ++ 80ae714: 50 push %eax ++ 80ae715: e8 00 00 00 00 call 80ae71a <_fini+0x11e> ++ 80ae71a: 58 pop %eax ++ 80ae71b: ff 90 f6 fe ff ff call *-0x10a(%eax) ++ 80ae721: e9 8b 49 fe ff jmp 80930b1 <_dl_debug_vdprintf+0xf1> ++ 80ae726: b8 ad 00 00 00 mov $0xad,%eax ++ 80ae72b: 50 push %eax ++ 80ae72c: e8 00 00 00 00 call 80ae731 <_fini+0x135> ++ 80ae731: 58 pop %eax ++ 80ae732: ff 90 df fe ff ff call *-0x121(%eax) ++ 80ae738: e9 fa a6 fe ff jmp 8098e37 <__restore_rt+0x7> ++ 80ae73d: b8 77 00 00 00 mov $0x77,%eax ++ 80ae742: 50 push %eax ++ 80ae743: e8 00 00 00 00 call 80ae748 <_fini+0x14c> ++ 80ae748: 58 pop %eax ++ 80ae749: ff 90 c8 fe ff ff call *-0x138(%eax) ++ 80ae74f: e9 ec a6 fe ff jmp 8098e40 <__libc_sigaction> \ No newline at end of file