aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/openat2/openat2_test.c
diff options
context:
space:
mode:
authorAleksa Sarai <cyphar@cyphar.com>2020-10-28 10:50:44 +1100
committerChristian Brauner <christian.brauner@ubuntu.com>2020-12-03 10:16:28 +0100
commit4e62d55d77bbdb33d821f5e16306caab38d42267 (patch)
tree63bec131800ae0d0af7149ef1451b3225157bce0 /tools/testing/selftests/openat2/openat2_test.c
parentopenat2: reject RESOLVE_BENEATH|RESOLVE_IN_ROOT (diff)
downloadlinux-dev-4e62d55d77bbdb33d821f5e16306caab38d42267.tar.xz
linux-dev-4e62d55d77bbdb33d821f5e16306caab38d42267.zip
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>
Diffstat (limited to 'tools/testing/selftests/openat2/openat2_test.c')
-rw-r--r--tools/testing/selftests/openat2/openat2_test.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/testing/selftests/openat2/openat2_test.c b/tools/testing/selftests/openat2/openat2_test.c
index b386367c606b..381d874cce99 100644
--- a/tools/testing/selftests/openat2/openat2_test.c
+++ b/tools/testing/selftests/openat2/openat2_test.c
@@ -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)
{
@@ -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,