mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
selftests/landlock: Add audit test for whiteout object creation
Add audit_layout1.make_whiteout: This test looks similar to audit_layout1.make_char, but creates a whiteout object through mknod(). Since whiteout object creation is now guarded with LANDLOCK_ACCESS_FS_MAKE_REG rather than LANDLOCK_ACCESS_FS_MAKE_CHAR, it also needs to log the matching denial to audit. Signed-off-by: Günther Noack <gnoack@google.com> Link: https://patch.msgid.link/20260813093157.1436894-5-gnoack@google.com Signed-off-by: Mickaël Salaün <mic@digikod.net>
This commit is contained in:
parent
ee890889b3
commit
8c46c6acbe
|
|
@ -7622,6 +7622,25 @@ TEST_F(audit_layout1, make_char)
|
|||
EXPECT_EQ(1, records.domain);
|
||||
}
|
||||
|
||||
TEST_F(audit_layout1, make_whiteout)
|
||||
{
|
||||
struct audit_records records;
|
||||
|
||||
EXPECT_EQ(0, unlink(file1_s1d3));
|
||||
|
||||
enforce_fs(_metadata, ACCESS_ALL, NULL);
|
||||
|
||||
/* Whiteout creation is denied and logged as fs.make_reg. */
|
||||
EXPECT_EQ(-1, mknod(file1_s1d3, S_IFCHR | 0644, makedev(0, 0)));
|
||||
EXPECT_EQ(EACCES, errno);
|
||||
EXPECT_EQ(0, matches_log_fs(_metadata, self->audit_fd, "fs\\.make_reg",
|
||||
dir_s1d3));
|
||||
|
||||
EXPECT_EQ(0, audit_count_records(self->audit_fd, &records));
|
||||
EXPECT_EQ(0, records.access);
|
||||
EXPECT_EQ(1, records.domain);
|
||||
}
|
||||
|
||||
TEST_F(audit_layout1, make_dir)
|
||||
{
|
||||
struct audit_records records;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user