system calls openat(…) = 3 its bytes registers rax 3 hello.c lines 5 to 7 of 11 5 char buf [ 32 ] ; 6 int f = open ( "note" , 0 ) ; 7 int n = read ( f , buf , 32 ) ; disassembly main 4011 88 4 mov rax, fs:[0x28] 4011 91 mov [rbp - 8], rax 4011 95 mov [rbp - 0x34] , 0 4011 9c 6 lea rdi, [rip + 0xe61] 4011 a3 xor esi, esi 4011 a5 mov al, sil 4011 a8 call 401070 open@plt open ("note", O_RDONLY) = 3 4011 ad mov [rbp - 0x38], eax 4011 b0 7 mov edi, [rbp - 0x38] 4011 b3 lea rsi, [rbp - 0x30] 4011 b7 mov [rbp - 0x48], rsi 4011 bb mov edx, 0x20 4011 c0 call 401060 read@plt f 3 the stack's canary stack 18 words · offsets from rbp · the frames they belong to rsp -50 7fffffffe cb0 0 -48 7fffffffe cb8 0 -40 n, high half 7fffffffe cc0 0 -38 f, low half 7fffffffe cc8 3 -30 buf 7fffffffe cd0 0 -28 buf+8 7fffffffe cd8 0 -20 buf+10 7fffffffe ce0 0 -18 buf+18 7fffffffe ce8 0 -10 7fffffffe cf0 0 -8 7fffffffe cf8 0x4434195f31f30300 rbp +0 saved rbp 7fffffffe d00 7fffffffedb0 +8 7fffffffe d08 7ffff7c27781 libc+27781 +10 7fffffffe d10 7ffff7fe0c60 ld.so+22c60 +18 7fffffffe d18 7fffffffee38 7fffffffefe8 ".… +20 7fffffffe d20 0x1f7fbe000 +28 7fffffffe d28 401180 main +30 7fffffffe d30 7fffffffed70 +38 7fffffffe d38 7ffff7fdf260 ld.so+21260 main libc+27781 syscall crosses down; the kernel opens "note" and answers 3 in rax. open's ret comes straight back to main: the stub was a jump, not a call. main keeps the answer in f. moment 38 of 46