setxattr on x64
set an extended attribute value
sys_setxattr(const char *path, const char *name, const void *value, size_t size, int flags)
| number | 188 (0xbc) |
|---|---|
| abi | common |
| entry point | sys_setxattr |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | setxattr(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 188, the syscall number |
rdi | const char *path |
rsi | const char *name |
rdx | const void *value |
r10 | size_t size |
r8 | int flags |
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 226
- arm64 5
- arm 226
- riscv64 5
- ia32 226
- x32 1073742012
- loongarch64 5
- ppc64 209
- ppc 209
- s390x 224
- mips64 5180
- mipsn32 6180
- mipso32 4224
- alpha 382
- arc 5
- blackfin 226, removed in 4.17
- cris 226, removed in 4.17
- csky 5
- frv 226, removed in 4.17
- hexagon 5
- ia64 1217, removed in 6.7
- m32r 226, removed in 4.17
- m68k 223
- metag 5, removed in 4.17
- microblaze 226
- mn10300 226, removed in 4.17
- nds32 5, removed in 5.18
- nios2 5
- openrisc 5
- parisc 238
- score 5, removed in 4.17
- sh 226
- sparc 169
- sparc64 169
- tilegx 5, removed in 4.17
- tilepro 5, removed in 4.17
- xtensa 68
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/setxattr