Message ID | 20210528092417.3942079-4-brauner@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | openat2: flag fixes | expand |
On 2021-05-28 11:24, Christian Brauner wrote: > From: Christian Brauner <christian.brauner@ubuntu.com> > > Test that openat2() rejects unknown flags in the upper 32 bit range. > > Cc: Richard Guy Briggs <rgb@redhat.com> > Cc: Aleksa Sarai <cyphar@cyphar.com> > Cc: linux-fsdevel@vger.kernel.org > Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Reviewed-by: Richard Guy Briggs <rgb@redhat.com> > --- > /* v2 */ > - Richard Guy Briggs <rgb@redhat.com>: > - Rename test to clarify what it actually tests. > --- > tools/testing/selftests/openat2/openat2_test.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/openat2/openat2_test.c b/tools/testing/selftests/openat2/openat2_test.c > index 381d874cce99..d7ec1e7da0d0 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 24 > +#define NUM_OPENAT2_FLAG_TESTS 25 > > void test_openat2_flags(void) > { > @@ -229,6 +229,11 @@ void test_openat2_flags(void) > { .name = "invalid how.resolve and O_PATH", > .how.flags = O_PATH, > .how.resolve = 0x1337, .err = -EINVAL }, > + > + /* currently unknown upper 32 bit rejected. */ > + { .name = "currently unknown bit (1 << 63)", > + .how.flags = O_RDONLY | (1ULL << 63), > + .how.resolve = 0, .err = -EINVAL }, > }; > > BUILD_BUG_ON(ARRAY_LEN(tests) != NUM_OPENAT2_FLAG_TESTS); > -- > 2.27.0 > - RGB -- Richard Guy Briggs <rgb@redhat.com> Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada IRC: rgb, SunRaycer Voice: +1.647.777.2635, Internal: (81) 32635
diff --git a/tools/testing/selftests/openat2/openat2_test.c b/tools/testing/selftests/openat2/openat2_test.c index 381d874cce99..d7ec1e7da0d0 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 24 +#define NUM_OPENAT2_FLAG_TESTS 25 void test_openat2_flags(void) { @@ -229,6 +229,11 @@ void test_openat2_flags(void) { .name = "invalid how.resolve and O_PATH", .how.flags = O_PATH, .how.resolve = 0x1337, .err = -EINVAL }, + + /* currently unknown upper 32 bit rejected. */ + { .name = "currently unknown bit (1 << 63)", + .how.flags = O_RDONLY | (1ULL << 63), + .how.resolve = 0, .err = -EINVAL }, }; BUILD_BUG_ON(ARRAY_LEN(tests) != NUM_OPENAT2_FLAG_TESTS);