Why does this ptrace program say syscall returned -38?

前端 未结 3 660
面向向阳花
面向向阳花 2021-01-05 05:28

It\'s the same as this one except that I\'m running execl(\"/bin/ls\", \"ls\", NULL);.

The result is obviously wrong as every syscall returns with

3条回答
  •  情歌与酒
    2021-01-05 05:41

    At a punt I'd say you're examining eax, or its 64 bit equivalent (presumably rax) for the return code of a system call. There's an additional slot for saving this register named orig_eax, used for restarting system calls.

    I poked around into this stuff quite a lot but can't for the life of me locate my findings. Here are some related questions:

    • In Linux, on entry of a sys call, what is the value in %eax? (not orig_eax)
    • Why is orig_eax provided in addition to eax?

    Update0

    Poking around again it seems my memory serves correct. You'll find everything you need right here in the kernel source (the main site is down, fortunately torvalds now mirrors linux at github).

提交回复
热议问题