pkey_free on x64
allocate or free a protection key
sys_pkey_free(int pkey)
| number | 331 (0x14b) |
|---|---|
| abi | common |
| kconfig | CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS |
| family | pkeys see the whole family on x64 |
| entry point | sys_pkey_free |
| since | Linux 4.9 |
| man page | pkey_free(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 331, the syscall number |
rdi | int pkey |
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 382
- arm64 290
- arm 396
- riscv64 290
- ia32 382
- x32 1073742155
- loongarch64 290
- ppc64 385
- ppc 385
- s390x 386
- mips64 5325
- mipsn32 6329
- mipso32 4365
- alpha 526
- arc 290
- csky 290
- hexagon 290
- ia64 1356, removed in 6.7
- m68k 383
- metag 290, removed in 4.17
- microblaze 397
- nds32 290, removed in 5.18
- nios2 290
- openrisc 290
- parisc 353
- score 290, removed in 4.17
- sh 386
- sparc 364
- sparc64 364
- tilegx 290, removed in 4.17
- tilepro 290, removed in 4.17
- xtensa 350
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/pkey_free