fsnotify: generate pre-content permission event on truncate
authorAmir Goldstein <amir73il@gmail.com>
Fri, 15 Nov 2024 15:30:22 +0000 (10:30 -0500)
committerJan Kara <jack@suse.cz>
Tue, 10 Dec 2024 11:03:17 +0000 (12:03 +0100)
commit4acf3bc76e521b47acebcefc6312c97992f4ca29
treeae148909ac181f0784eb79c68122a5867cf41269
parent9740d17162deca7138fad7dcf3ef52324832c32b
fsnotify: generate pre-content permission event on truncate

Generate FS_PRE_ACCESS event before truncate, without sb_writers held.

Move the security hooks also before sb_start_write() to conform with
other security hooks (e.g. in write, fallocate).

The event will have a range info of the page surrounding the new size
to provide an opportunity to fill the conetnt at the end of file before
truncating to non-page aligned size.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/23af8201db6ac2efdea94f09ab067d81ba5de7a7.1731684329.git.josef@toxicpanda.com
fs/open.c
include/linux/fsnotify.h