linux/Documentation
David Howells f7e47677e3 watch_queue: Add a key/keyring notification facility
Add a key/keyring change notification facility whereby notifications about
changes in key and keyring content and attributes can be received.

Firstly, an event queue needs to be created:

	pipe2(fds, O_NOTIFICATION_PIPE);
	ioctl(fds[1], IOC_WATCH_QUEUE_SET_SIZE, 256);

then a notification can be set up to report notifications via that queue:

	struct watch_notification_filter filter = {
		.nr_filters = 1,
		.filters = {
			[0] = {
				.type = WATCH_TYPE_KEY_NOTIFY,
				.subtype_filter[0] = UINT_MAX,
			},
		},
	};
	ioctl(fds[1], IOC_WATCH_QUEUE_SET_FILTER, &filter);
	keyctl_watch_key(KEY_SPEC_SESSION_KEYRING, fds[1], 0x01);

After that, records will be placed into the queue when events occur in
which keys are changed in some way.  Records are of the following format:

	struct key_notification {
		struct watch_notification watch;
		__u32	key_id;
		__u32	aux;
	} *n;

Where:

	n->watch.type will be WATCH_TYPE_KEY_NOTIFY.

	n->watch.subtype will indicate the type of event, such as
	NOTIFY_KEY_REVOKED.

	n->watch.info & WATCH_INFO_LENGTH will indicate the length of the
	record.

	n->watch.info & WATCH_INFO_ID will be the second argument to
	keyctl_watch_key(), shifted.

	n->key will be the ID of the affected key.

	n->aux will hold subtype-dependent information, such as the key
	being linked into the keyring specified by n->key in the case of
	NOTIFY_KEY_LINKED.

Note that it is permissible for event records to be of variable length -
or, at least, the length may be dependent on the subtype.  Note also that
the queue can be shared between multiple notifications of various types.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: James Morris <jamorris@linux.microsoft.com>
2020-05-19 15:19:06 +01:00
..
ABI change email address for Pali Rohár 2020-04-10 15:36:22 -07:00
accounting
admin-guide - Document DM integrity allow_discard feature that was added during 2020-04-30 16:45:08 -07:00
arm
arm64 Documentation: arm64: fix amu.rst doc warnings 2020-04-23 17:05:22 +01:00
block
bpf bpf: lsm: Add Documentation 2020-03-30 01:35:12 +02:00
cdrom
core-api bpf: Restrict bpf_trace_printk()'s %s usage and add %pks, %pus specifier 2020-05-15 08:10:36 -07:00
cpu-freq
crypto
dev-tools linux-kselftest-kunit-5.7-rc1 2020-04-01 16:11:40 -07:00
devicetree i.MX fixes for 5.7: 2020-05-14 00:00:07 +02:00
doc-guide
driver-api A handful of late-arriving fixes for the documentation tree. 2020-04-10 17:53:43 -07:00
fault-injection
fb
features
filesystems debugfs: remove return value of debugfs_create_u32() 2020-04-17 17:08:50 +02:00
firmware_class
firmware-guide Documentation: firmware-guide: ACPI: fix table alignment in namespace.rst 2020-04-08 14:27:48 +02:00
fpga
gpu UAPI Changes: 2020-03-19 10:40:27 +10:00
hid
hwmon hwmon: (pmbus/isl68137) Fix up chip IDs 2020-04-12 15:12:51 -07:00
i2c
ia64
ide
iio
infiniband
input
isdn
kbuild Documentation: kbuild: fix the section title format 2020-04-23 10:53:19 +09:00
kernel-hacking docs: locking: Drop :c:func: throughout 2020-03-20 17:16:24 -06:00
leds
livepatch
locking Documentation/locking/locktypes: Minor copy editor fixes 2020-03-28 12:47:34 +01:00
m68k
maintainer
media media updates for v5.7-rc1 2020-03-30 13:42:05 -07:00
mhi docs: Add documentation for MHI bus 2020-03-19 07:41:04 +01:00
mips docs: mips: remove no longer needed au1xxx_ide.rst documentation 2020-03-24 15:53:48 +01:00
misc-devices Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2020-04-01 14:47:40 -07:00
netlabel
networking ice: cleanup language in ice.rst for fw.app 2020-05-01 15:30:24 -07:00
nios2
nvdimm
openrisc
parisc
PCI pci-v5.7-changes 2020-04-03 14:25:02 -07:00
pcmcia
power Merge branches 'pm-core', 'pm-sleep', 'pm-acpi' and 'pm-domains' 2020-03-30 14:46:58 +02:00
powerpc powerpc updates for 5.7 2020-04-05 11:12:59 -07:00
process Documentation/changes: Raise minimum supported binutils version to 2.23 2020-04-09 00:02:00 +09:00
RCU
riscv
s390
scheduler
scsi SCSI misc on 20200402 2020-04-02 17:03:53 -07:00
security watch_queue: Add a key/keyring notification facility 2020-05-19 15:19:06 +01:00
sh
sound ALSA: hda/realtek - Remove now-unnecessary XPS 13 headphone noise fixups 2020-03-31 10:54:06 +02:00
sparc
sphinx
sphinx-static
spi
target docs: prevent warnings due to autosectionlabel 2020-03-20 17:01:29 -06:00
timers
trace New tracing features: 2020-04-05 10:36:18 -07:00
translations media updates for v5.7-rc1 2020-03-30 13:42:05 -07:00
usb usb: raw-gadget: documentation updates 2020-05-14 12:30:18 +03:00
userspace-api pipe: Add general notification queue support 2020-05-19 15:08:24 +01:00
virt docs/virt/kvm: Document configuring and running nested guests 2020-05-06 05:45:47 -04:00
vm mm/zswap: allow setting default status, compressor and allocator in Kconfig 2020-04-07 10:43:41 -07:00
w1
watchdog
x86 Documentation/x86, efi/x86: Clarify EFI handover protocol and its requirements 2020-04-14 08:32:15 +02:00
xtensa
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
asm-annotations.rst
atomic_bitops.txt
atomic_t.txt
bus-virt-phys-mapping.txt
Changes
CodingStyle
conf.py docs: conf.py: avoid thousands of duplicate label warning on Sphinx 2020-03-20 17:01:34 -06:00
COPYING-logo
crc32.txt
debugging-via-ohci1394.txt
digsig.txt
DMA-API-HOWTO.txt
DMA-API.txt
DMA-attributes.txt
DMA-ISA-LPC.txt
docutils.conf
dontdiff
futex-requeue-pi.txt
hwspinlock.txt
index.rst Char/Misc driver patches for 5.7-rc1 2020-04-03 13:22:40 -07:00
IPMI.txt
IRQ-affinity.txt
IRQ-domain.txt
IRQ.txt
irqflags-tracing.txt
Kconfig
kprobes.txt
kref.txt
logo.gif
lzo.txt
mailbox.txt
Makefile Kbuild updates for v5.7 2020-03-31 16:03:39 -07:00
memory-barriers.txt
nommu-mmap.txt
percpu-rw-semaphore.txt
pi-futex.txt
preempt-locking.txt
rbtree.txt
remoteproc.txt remoteproc: Add elf64 support in elf loader 2020-03-25 22:29:40 -07:00
robust-futex-ABI.txt threads: Update PID limit comment according to futex UAPI change 2020-03-21 17:48:13 +01:00
robust-futexes.txt
rpmsg.txt
speculation.txt
static-keys.txt
SubmittingPatches
tee.txt
this_cpu_ops.txt
unaligned-memory-access.txt
watch_queue.rst pipe: Add general notification queue support 2020-05-19 15:08:24 +01:00
xz.txt