getuid on x64
get user identity
sys_getuid(void)
| number | 102 (0x66) |
|---|---|
| abi | common |
| entry point | sys_getuid |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | getuid(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 102, the syscall number |
rax | the return value |
Then run syscall to enter the kernel.
The syscall instruction clobbers rcx (the return address lands in rcx) and r11 (the flags land in r11).
Since Linux 5.14 the kernel reads the syscall number from eax and ignores the upper 32 bits of rax. Older kernels fail with ENOSYS when those bits are not zero, and mov eax, N clears them, so it works on both.
Same syscall on other architectures
- x86 24
- arm64 174
- arm 24
- riscv64 174
- ia32 24
- x32 1073741926
- loongarch64 174
- ppc64 24
- ppc 24
- s390x 199
- mips64 5100
- mipsn32 6100
- mipso32 4024
- arc 174
- blackfin 24, removed in 4.17
- cris 24, removed in 4.17
- csky 174
- frv 24, removed in 4.17
- hexagon 174
- ia64 1046, removed in 6.7
- m68k 24
- metag 174, removed in 4.17
- microblaze 24
- mn10300 24, removed in 4.17
- nds32 174, removed in 5.18
- nios2 174
- openrisc 174
- parisc 24
- score 174, removed in 4.17
- sh 24
- sparc 24
- sparc64 24
- tilegx 174, removed in 4.17
- tilepro 174, removed in 4.17
- xtensa 137
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/getuid