Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: openat2: add RESOLVE_ conflict test

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>

authored by

Aleksa Sarai and committed by
Christian Brauner
4e62d55d 398840f8

+7 -1
+7 -1
tools/testing/selftests/openat2/openat2_test.c
··· 155 155 int err; 156 156 }; 157 157 158 - #define NUM_OPENAT2_FLAG_TESTS 23 158 + #define NUM_OPENAT2_FLAG_TESTS 24 159 159 160 160 void test_openat2_flags(void) 161 161 { ··· 209 209 { .name = "invalid (very large) how.mode and O_TMPFILE", 210 210 .how.flags = O_TMPFILE | O_RDWR, 211 211 .how.mode = 0x0000A00000000000ULL, .err = -EINVAL }, 212 + 213 + /* ->resolve flags must not conflict. */ 214 + { .name = "incompatible resolve flags (BENEATH | IN_ROOT)", 215 + .how.flags = O_RDONLY, 216 + .how.resolve = RESOLVE_BENEATH | RESOLVE_IN_ROOT, 217 + .err = -EINVAL }, 212 218 213 219 /* ->resolve must only contain RESOLVE_* flags. */ 214 220 { .name = "invalid how.resolve and O_RDONLY",