R
R
rewqqwer2017-09-17 09:22:37
linux
rewqqwer, 2017-09-17 09:22:37

What is the difference between syscall setreuid in C/C++ and asm?

I came across a problem incomprehensible to my meager mind: when calling setreuid (0,0) in asm, I catch an (unclear to me) error (sk. 1), with this system call in the C ++ / C program, -1 is also returned, but when run with sudo ( skt 4) returns 0 (successful), disassembling the file shows that the registers and syscol are the same (skt 2-3), so what's the problem then, because I also run the asm file as root?e73afe98f82d403099f64a065c0527b1.pngadac2839d5a7429292c8721257f27565.pngcaebbd5165f74f6884329a190bf0f786.png8bffad99641c4565b3b64d9ee1d28cd4.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2017-09-17
@rewqqwer

what is the problem then

and along the way it is impossible to call system calls from elf64 through int 0x80. So either replace int 0x80 with syscall (and by the way, _NR_exit for x86_64 is 60), or use nasm -static -f elf32and ld -m elf_i386(and then _NR_setreuid will be 70).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question