Searched hist:"225351 abe34407421a5ee34896ccca92a0544b5e" (Results 1 – 1 of 1) sorted by relevance
/openbmc/linux/tools/testing/selftests/landlock/ |
H A D | fs_test.c | diff 225351abe34407421a5ee34896ccca92a0544b5e Tue Oct 18 13:22:10 CDT 2022 Günther Noack <gnoack3000@gmail.com> selftests/landlock: Test file truncation support
These tests exercise the following truncation operations:
* truncate() (truncate by path) * ftruncate() (truncate by file descriptor) * open with the O_TRUNC flag * special case: creat(), which is open with O_CREAT|O_WRONLY|O_TRUNC.
in the following scenarios:
* Files with read, write and truncate rights. * Files with read and truncate rights. * Files with the truncate right. * Files without the truncate right.
In particular, the following scenarios are enforced with the test:
* open() with O_TRUNC requires the truncate right, if it truncates a file. open() already checks security_path_truncate() in this case, and it required no additional check in the Landlock LSM's file_open hook. * creat() requires the truncate right when called with an existing filename. * creat() does *not* require the truncate right when it's creating a new file. * ftruncate() requires that the file was opened by a thread that had the truncate right for the file at the time of open(). (The rights are carried along with the opened file.)
Signed-off-by: Günther Noack <gnoack3000@gmail.com> Link: https://lore.kernel.org/r/20221018182216.301684-6-gnoack3000@gmail.com Signed-off-by: Mickaël Salaün <mic@digikod.net>
|