Skip to content

Commit

Permalink
selftests: openat2: add RESOLVE_ conflict test
Browse files Browse the repository at this point in the history
Now that we reject conflicting RESOLVE_ flags, add a selftest to avoid
regressions.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Link: https://lore.kernel.org/r/20201027235044.5240-3-cyphar@cyphar.com
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Aleksa Sarai authored and Christian Brauner committed Dec 3, 2020
1 parent 398840f commit 4e62d55
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/testing/selftests/openat2/openat2_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ struct flag_test {
int err;
};

#define NUM_OPENAT2_FLAG_TESTS 23
#define NUM_OPENAT2_FLAG_TESTS 24

void test_openat2_flags(void)
{
Expand Down Expand Up @@ -210,6 +210,12 @@ void test_openat2_flags(void)
.how.flags = O_TMPFILE | O_RDWR,
.how.mode = 0x0000A00000000000ULL, .err = -EINVAL },

/* ->resolve flags must not conflict. */
{ .name = "incompatible resolve flags (BENEATH | IN_ROOT)",
.how.flags = O_RDONLY,
.how.resolve = RESOLVE_BENEATH | RESOLVE_IN_ROOT,
.err = -EINVAL },

/* ->resolve must only contain RESOLVE_* flags. */
{ .name = "invalid how.resolve and O_RDONLY",
.how.flags = O_RDONLY,
Expand Down

0 comments on commit 4e62d55

Please sign in to comment.