linux/include
Amir Goldstein b4b2ff4f61 fanotify: allow to set errno in FAN_DENY permission response
With FAN_DENY response, user trying to perform the filesystem operation
gets an error with errno set to EPERM.

It is useful for hierarchical storage management (HSM) service to be able
to deny access for reasons more diverse than EPERM, for example EAGAIN,
if HSM could retry the operation later.

Allow fanotify groups with priority FAN_CLASSS_PRE_CONTENT to responsd
to permission events with the response value FAN_DENY_ERRNO(errno),
instead of FAN_DENY to return a custom error.

Limit custom error values to errors expected on read(2)/write(2) and
open(2) of regular files. This list could be extended in the future.
Userspace can test for legitimate values of FAN_DENY_ERRNO(errno) by
writing a response to an fanotify group fd with a value of FAN_NOFD in
the fd field of the response.

The change in fanotify_response is backward compatible, because errno is
written in the high 8 bits of the 32bit response field and old kernels
reject respose value with high bits set.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/1e5fb6af84b69ca96b5c849fa5f10bdf4d1dc414.1731684329.git.josef@toxicpanda.com
2024-12-10 12:03:17 +01:00
..
acpi common: switch back from remove_new() to remove() callback 2024-11-25 17:31:39 -08:00
asm-generic RISC-V Paches for the 6.13 Merge Window, Part 1 2024-11-27 11:19:09 -08:00
clocksource
crypto This update includes the following changes: 2024-11-19 10:28:41 -08:00
cxl
drm drm for 6.13-rc1 2024-11-21 14:56:17 -08:00
dt-bindings The core framework gained a clk provider helper, a clk consumer helper, and 2024-11-22 17:02:25 -08:00
keys
kunit The core framework gained a clk provider helper, a clk consumer helper, and 2024-11-22 17:02:25 -08:00
kvm Merge branch kvm-arm64/nv-pmu into kvmarm/next 2024-11-11 18:49:02 +00:00
linux fanotify: allow to set errno in FAN_DENY permission response 2024-12-10 12:03:17 +01:00
math-emu
media media: replace obsolete hans.verkuil@cisco.com alias 2024-11-08 13:38:09 +01:00
memory
misc
net Networking changes for 6.13. 2024-11-21 08:28:08 -08:00
pcmcia
ras
rdma
rv
scsi Random number generator updates for Linux 6.13-rc1. 2024-11-19 10:43:44 -08:00
soc The core framework gained a clk provider helper, a clk consumer helper, and 2024-11-22 17:02:25 -08:00
sound ASoC: Updates for v6.13 2024-11-18 14:34:54 +01:00
target
trace Add Rust support for trace events: 2024-11-25 15:44:29 -08:00
uapi fanotify: allow to set errno in FAN_DENY permission response 2024-12-10 12:03:17 +01:00
ufs scsi: ufs: ufs-mediatek: Configure individual LU queue flags 2024-11-06 20:42:17 -05:00
vdso
video - Improved handling of LCD power states and interactions with the fbdev subsystem. 2024-11-22 16:29:57 -08:00
xen