| 1 |
.\" Copyright 2016, Michael Kerrisk <[email protected]> |
| 2 |
.\" Copyright 2016, Eugene Syromyatnikov <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH KEYCTL_INVALIDATE 2const 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
KEYCTL_INVALIDATE |
| 10 |
\- |
| 11 |
invalidate a key |
| 12 |
.SH LIBRARY |
| 13 |
Standard C library |
| 14 |
.RI ( libc ,\~ \-lc ) |
| 15 |
.SH SYNOPSIS |
| 16 |
.nf |
| 17 |
.BR "#include <linux/keyctl.h>" " /* Definition of " KEY* " constants */" |
| 18 |
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */" |
| 19 |
.B #include <unistd.h> |
| 20 |
.P |
| 21 |
.BI "long syscall(SYS_keyctl, KEYCTL_INVALIDATE, key_serial_t " key ); |
| 22 |
.fi |
| 23 |
.SH DESCRIPTION |
| 24 |
Mark a key as invalid. |
| 25 |
.P |
| 26 |
The ID of the key to be invalidated is specified in |
| 27 |
.IR key . |
| 28 |
.P |
| 29 |
To invalidate a key, |
| 30 |
the caller must have |
| 31 |
.I search |
| 32 |
permission on the key. |
| 33 |
.\" CAP_SYS_ADMIN is permitted to invalidate certain special keys |
| 34 |
.P |
| 35 |
This operation marks the key as invalid |
| 36 |
and schedules immediate garbage collection. |
| 37 |
The garbage collector removes the invalidated key from all keyrings and |
| 38 |
deletes the key when its reference count reaches zero. |
| 39 |
After this operation, |
| 40 |
the key will be ignored by all searches, |
| 41 |
even if it is not yet deleted. |
| 42 |
.P |
| 43 |
Keys that are marked invalid become invisible to normal key operations |
| 44 |
immediately, though they are still visible in |
| 45 |
.I /proc/keys |
| 46 |
(marked with an 'i' flag) |
| 47 |
until they are actually removed. |
| 48 |
.SH RETURN VALUE |
| 49 |
On success, |
| 50 |
0 is returned. |
| 51 |
.P |
| 52 |
On error, \-1 is returned, and |
| 53 |
.I errno |
| 54 |
is set to indicate the error. |
| 55 |
.SH VERSIONS |
| 56 |
A wrapper is provided in the |
| 57 |
.I libkeyutils |
| 58 |
library: |
| 59 |
.BR keyctl_invalidate (3). |
| 60 |
.SH STANDARDS |
| 61 |
Linux. |
| 62 |
.SH HISTORY |
| 63 |
Linux 3.5. |
| 64 |
.\" commit fd75815f727f157a05f4c96b5294a4617c0557da |
| 65 |
.SH SEE ALSO |
| 66 |
.BR keyctl (2), |
| 67 |
.BR keyctl_invalidate (3) |