When gcc generates code that handles exceptions, it produces tables that describe how to unwind the stack. These tables are found in the .eh_frame section.
.eh_frame:0000000000400F7D ; START OF FUNCTION CHUNK FOR encrypt .eh_frame:0000000000400F7D .eh_frame:0000000000400F7D loc_400F7D: ; Keypatch modified this from: .eh_frame:0000000000400F7D mov rax, 3 ; db 0 .eh_frame:0000000000400F7D ; db 0 .eh_frame:0000000000400F7D ; db 0 .eh_frame:0000000000400F7D ; db 0 .eh_frame:0000000000400F7D ; db 0 .eh_frame:0000000000400F7D ; Keypatch modified this from: .eh_frame:0000000000400F7D ; mov eax, 3 .eh_frame:0000000000400F7D ; db 0BBh .eh_frame:0000000000400F7D ; db 0 .eh_frame:0000000000400F84 mov rbx, 0 ; Keypatch modified this from: .eh_frame:0000000000400F84 ; db 0 .eh_frame:0000000000400F84 ; db 0 .eh_frame:0000000000400F84 ; db 0 .eh_frame:0000000000400F84 ; db 0 .eh_frame:0000000000400F84 ; db 14h .eh_frame:0000000000400F84 ; db 0 .eh_frame:0000000000400F84 ; db 0 .eh_frame:0000000000400F8B mov rcx, rdi ; Keypatch modified this from: .eh_frame:0000000000400F8B ; db 0 .eh_frame:0000000000400F8B ; db 0 .eh_frame:0000000000400F8B ; db 0 .eh_frame:0000000000400F8E mov rdx, 40h ; Keypatch modified this from: .eh_frame:0000000000400F8E ; db 0 .eh_frame:0000000000400F8E ; db 0 .eh_frame:0000000000400F8E ; db 1 .eh_frame:0000000000400F8E ; db 7Ah .eh_frame:0000000000400F8E ; db 52h .eh_frame:0000000000400F8E ; db 0 .eh_frame:0000000000400F8E ; db 1 .eh_frame:0000000000400F95 syscall ; Keypatch modified this from: .eh_frame:0000000000400F95 ; js short loc_400FA7 .eh_frame:0000000000400F95 ; add [rbx], ebx .eh_frame:0000000000400F95 ; or al, 7 .eh_frame:0000000000400F95 ; Keypatch padded NOP to next boundary: 1 bytes .eh_frame:0000000000400F95 ; Keypatch modified this from: .eh_frame:0000000000400F95 ; jmp loc_400AB4 .eh_frame:0000000000400F95 ; Keypatch padded NOP to next boundary: 3 bytes .eh_frame:0000000000400F97 jmp loc_400AB4 ; Keypatch modified this from: .eh_frame:0000000000400F97 ; END OF FUNCTION CHUNK FOR encrypt ; nop
反编译代码:
1 2
puts("Input your Plaintext to be encrypted"); __asm { syscall; Keypatch modified this from: } // read