Skip to content

Commit 15845cb

Browse files
author
Christian Brauner
committed
test: add openat2() test for invalid upper 32 bit flag value
Test that openat2() rejects unknown flags in the upper 32 bit range. Link: https://lore.kernel.org/r/[email protected] Cc: Richard Guy Briggs <[email protected]> Cc: Aleksa Sarai <[email protected]> Cc: [email protected] Reviewed-by: Richard Guy Briggs <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent cfe8030 commit 15845cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/testing/selftests/openat2/openat2_test.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ struct flag_test {
155155
int err;
156156
};
157157

158-
#define NUM_OPENAT2_FLAG_TESTS 24
158+
#define NUM_OPENAT2_FLAG_TESTS 25
159159

160160
void test_openat2_flags(void)
161161
{
@@ -229,6 +229,11 @@ void test_openat2_flags(void)
229229
{ .name = "invalid how.resolve and O_PATH",
230230
.how.flags = O_PATH,
231231
.how.resolve = 0x1337, .err = -EINVAL },
232+
233+
/* currently unknown upper 32 bit rejected. */
234+
{ .name = "currently unknown bit (1 << 63)",
235+
.how.flags = O_RDONLY | (1ULL << 63),
236+
.how.resolve = 0, .err = -EINVAL },
232237
};
233238

234239
BUILD_BUG_ON(ARRAY_LEN(tests) != NUM_OPENAT2_FLAG_TESTS);

0 commit comments

Comments
 (0)