Linux Application Stack Analysis

2024-11-13 13:54:34 +0000

A look into the stack, when the program is executed.

.global _start

.text
    _start:
        xor     %rbp, %rbp

        xor     %edi, %edi
        mov     $231, %ax
        syscall
        hlt
as -c program.s  -o program.o
ld -o program -I/lib64/ld-linux-x86-64.so.2 -lc -s program.o

Registers

rax     0000000000000038
rbx     0000000000000000
rcx     00007FFFE1975F38    [stack]:00007FFFE1975F38
rdx     00007BC112488380    ld_linux_x86_64.so.2:_dl_fini
rsi     00007BC1124BC8B8    ld_linux_x86_64.so.2:rtld_errno+618
rdi     00007BC1124BC2E0    ld_linux_x86_64.so.2:rtld_errno+40
rbp     0000000000000000
rsp     00007FFFE1975F20    [stack]:00007FFFE1975F20
rip     0000000000401000    start
r8      00007FFFE1977AC3    [stack]:00007FFFE1977AC3
r9      00007BC1124B9440    ld_linux_x86_64.so.2:tunable_list
r10     00007FFFE1975B20    [stack]:00007FFFE1975B20
r11     0000000000000203
r12     0000000000401000    start
r13     00007FFFE1975F20    [stack]:00007FFFE1975B20
r14     0000000000000000
r15     0000000000000000

Stack

00007FFFE1975F20    0000000000000001                                argument count
00007FFFE1975F28    00007FFFE1977AC3    [stack]:00007FFFE1977AC3    program name
00007FFFE1975F30    0000000000000000  
00007FFFE1975F38    00007FFFE1977AF5    [stack]:00007FFFE1977AF5    env argument start
00007FFFE1975F40    00007FFFE1977B07    [stack]:00007FFFE1977B07
00007FFFE1975F48    00007FFFE1977B15    [stack]:00007FFFE1977B15
00007FFFE1975F50    00007FFFE1977B24    [stack]:00007FFFE1977B24
00007FFFE1975F58    00007FFFE1977B39    [stack]:00007FFFE1977B39
00007FFFE1975F60    00007FFFE1977B54    [stack]:00007FFFE1977B54
00007FFFE1975F68    00007FFFE1977B5C    [stack]:00007FFFE1977B5C
00007FFFE1975F70    00007FFFE1977B70    [stack]:00007FFFE1977B70
00007FFFE1975F78    00007FFFE1977B85    [stack]:00007FFFE1977B85
00007FFFE1975F80    00007FFFE1977BA1    [stack]:00007FFFE1977BA1
00007FFFE1975F88    00007FFFE1977BD5    [stack]:00007FFFE1977BD5
00007FFFE1975F90    00007FFFE1977C0B    [stack]:00007FFFE1977C0B
00007FFFE1975F98    00007FFFE1977C1C    [stack]:00007FFFE1977C1C
00007FFFE1975FA0    00007FFFE1977C33    [stack]:00007FFFE1977C33
00007FFFE1975FA8    00007FFFE1977C47    [stack]:00007FFFE1977C47
00007FFFE1975FB0    00007FFFE1977C59    [stack]:00007FFFE1977C59
00007FFFE1975FB8    00007FFFE1977CC1    [stack]:00007FFFE1977CC1
00007FFFE1975FC0    00007FFFE1977CD0    [stack]:00007FFFE1977CD0
00007FFFE1975FC8    00007FFFE1977CEE    [stack]:00007FFFE1977CEE
00007FFFE1975FD0    00007FFFE1977D28    [stack]:00007FFFE1977D28
00007FFFE1975FD8    00007FFFE1977D47    [stack]:00007FFFE1977D47
00007FFFE1975FE0    00007FFFE1977D5D    [stack]:00007FFFE1977D5D
00007FFFE1975FE8    00007FFFE1977D6E    [stack]:00007FFFE1977D6E
00007FFFE1975FF0    00007FFFE1977D87    [stack]:00007FFFE1977D87
00007FFFE1975FF8    00007FFFE1977DA0    [stack]:00007FFFE1977DA0
00007FFFE1976000    00007FFFE1977DC6    [stack]:00007FFFE1977DC6
00007FFFE1976008    00007FFFE1977DFA    [stack]:00007FFFE1977DFA
00007FFFE1976010    00007FFFE1977E0A    [stack]:00007FFFE1977E0A
00007FFFE1976018    00007FFFE1977E1D    [stack]:00007FFFE1977E1D
00007FFFE1976020    00007FFFE1977E2D    [stack]:00007FFFE1977E2D
00007FFFE1976028    00007FFFE1977E38    [stack]:00007FFFE1977E38
00007FFFE1976030    00007FFFE1977E4B    [stack]:00007FFFE1977E4B
00007FFFE1976038    00007FFFE1977E76    [stack]:00007FFFE1977E76
00007FFFE1976040    00007FFFE1977F02    [stack]:00007FFFE1977F02
00007FFFE1976048    00007FFFE1977F58    [stack]:00007FFFE1977F58
00007FFFE1976050    00007FFFE1977F87    [stack]:00007FFFE1977F87
00007FFFE1976058    00007FFFE1977F9A    [stack]:00007FFFE1977F9A
00007FFFE1976060    00007FFFE1977FB9    [stack]:00007FFFE1977FB9
00007FFFE1976068    0000000000000000                                env argument end
00007FFFE1976070    0000000000000021  
00007FFFE1976078    00007FFFE19EF000    [vdso]:00007FFFE19EF000