0

I tried to call exit() by int 0x80 in the following assembly program:

 .section .text
 .globl _start
_start:
 xorq %rdi, %rdi
 xorq %rax, %rax
 movb $0x3c, %al
 int $0x80

but segmentation fault (core dumped) occured. Then I debugged it by gdb and got that the program doesn't stop after calling the exit() and execute the next instruction(which is 00000000). I wonder how to deal with it.

  • That's the 64-bit call number that would work with `syscall`, but you're using the 32-bit `int 0x80` ABI. That's `__NR_umask` in `asm/unistd_32.h`. Use `strace` to see the system call your program actually made (if you have a new enough kernel + strace to properly decode 32-bit system calls from 64-bit processes.) – Peter Cordes Jun 14 '21 at 12:48
  • Ah, found an exact duplicate: [x86\_64 Assembly Linux System Call Confusion](https://stackoverflow.com/q/8510333) calls `int 0x80` with EAX=60. – Peter Cordes Jun 14 '21 at 12:52
  • It exactly solves my problem, thank you very much – Huo Wen Jun 14 '21 at 12:59

0 Answers0