[PATCH 1/9] uapi: General notification ring definitions [ver #5]
Greg Kroah-Hartman
gregkh at linuxfoundation.org
Wed Jul 3 17:08:10 UTC 2019
On Fri, Jun 28, 2019 at 04:48:34PM +0100, David Howells wrote:
> Add UAPI definitions for the general notification ring, including the
> following pieces:
>
> (1) struct watch_notification.
>
> This is the metadata header for each entry in the ring. It includes a
> type and subtype that indicate the source of the message
> (eg. WATCH_TYPE_MOUNT_NOTIFY) and the kind of the message
> (eg. NOTIFY_MOUNT_NEW_MOUNT).
>
> The header also contains an information field that conveys the
> following information:
>
> - WATCH_INFO_LENGTH. The size of the entry (entries are variable
> length).
>
> - WATCH_INFO_ID. The watch ID specified when the watchpoint was
> set.
>
> - WATCH_INFO_TYPE_INFO. (Sub)type-specific information.
>
> - WATCH_INFO_FLAG_*. Flag bits overlain on the type-specific
> information. For use by the type.
>
> All the information in the header can be used in filtering messages at
> the point of writing into the buffer.
>
> (2) struct watch_queue_buffer.
>
> This describes the layout of the ring. Note that the first slots in
> the ring contain a special metadata entry that contains the ring
> pointers. The producer in the kernel knows to skip this and it has a
> proper header (WATCH_TYPE_META, WATCH_META_SKIP_NOTIFICATION) that
> indicates the size so that the ring consumer can handle it the same as
> any other record and just skip it.
>
> Note that this means that ring entries can never be split over the end
> of the ring, so if an entry would need to be split, a skip record is
> inserted to wrap the ring first; this is also WATCH_TYPE_META,
> WATCH_META_SKIP_NOTIFICATION.
>
> (3) WATCH_INFO_NOTIFICATIONS_LOST.
>
> This is a flag that can be set in the metadata header by the kernel to
> indicate that at least one message was lost since it was last cleared
> by userspace.
>
> Signed-off-by: David Howells <dhowells at redhat.com>
Reviewed-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
More information about the Linux-security-module-archive
mailing list