aboutsummaryrefslogtreecommitdiff
path: root/semestr-4/ask/lista9/gadget.s
blob: 6d60a63bb4a053666a45a8fab6d6609b473e8a55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
        .global gadget

        .text

# rax: 0x3c
# rdi: 0
# rdx: {NULL, ...}
# rsi: path + '\n'
gadget:
        dec     %rax            # rax: 0x3c -> 0x3b (sys_execve)
        mov     %rdx, %rsi      # rsi: argv = {NULL}
        mov     %rdi, %rdx      # rdx: envp = NULL
        lea     16(%rsp),%rdi   # rdi: path
        ret

# vim: ft=gas