igt/gem_exec_params: Drop drm master privileges only on drm master fds
PATCH v2 1/1 igt/gem_exec_params: Drop drm master privileges only on drm master fds
Subtest 'secure-non-master' tries to drop drm-master privileges on a non drm-master fd. Instead drop master privileges after the subtest acquires it so that other subtests are not affected by it.
v2:
- Require root privilege for the sub-test. (Chris)
--- tests/gem_exec_params.c | 5 +++++ 1 file changed, 5 insertions(+)
tests/gem_exec_params.c +5 -0
@@ -343,13 +343,18 @@ igt_main } igt_subtest("secure-non-master") { +igt_require (__igt_device_set_master (fd));/* Requires root privilege */ igt_device_drop_master (fd); + execbuf.flags =I915_EXEC_RENDER |I915_EXEC_SECURE ;RUN_FAIL (EPERM ); +igt_device_set_master (fd);igt_assert (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf) ==0 ); + +igt_device_drop_master (fd);/* Only needs temporary master */ }/* HANDLE_LUT and NO_RELOC are already exercised by gem_exec_lut_handle,
Signature · 6 lines
2.14.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoting Antonio Argenziano (2018-01-31 21:21:32)
Quoted 20 lines
Subtest 'secure-non-master' tries to drop drm-master privileges on a non drm-master fd. Instead drop master privileges after the subtest acquires it so that other subtests are not affected by it.
v2:
- Require root privilege for the sub-test. (Chris)Signed-off-by Antonio Argenziano <[email protected]>Cc Chris Wilson <[email protected]>Cc Daniel Vetter <[email protected]>Cc Joonas Lahtinen <[email protected]>--- tests/gem_exec_params.c | 5 +++++ 1 file changed, 5 insertions(+)tests/gem_exec_params.c +0
-0
tests/gem_exec_params.c igt_main · line 350
Quoted 8 lines
tests/gem_exec_params.c +2
-0@@ -343,13 +343,18 @@ igt_main } igt_subtest("secure-non-master") { +igt_require (__igt_device_set_master (fd));/* Requires root privilege */ igt_device_drop_master (fd); + execbuf.flags =I915_EXEC_RENDER |I915_EXEC_SECURE ;RUN_FAIL (EPERM );
Fwiw, I like the spacing around the second stanza better as that couples acquiring root with the successful test. So I'd like the igt_device_drop_master() next to the RUN_FAIL block.
igt_assert_eq(__gem_execbuf(fd, &execbuf), -EPERM);
tests/gem_exec_params.c igt_main · line 355
Quoted 5 lines
tests/gem_exec_params.c +1
-0+igt_device_set_master (fd);igt_assert (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf) ==0 );
gem_execbuf(fd, &execbuf);
tests/gem_exec_params.c igt_main · line 360
Quoted 5 lines
tests/gem_exec_params.c +2
-0+ +igt_device_drop_master (fd);/* Only needs temporary master */ }/* HANDLE_LUT and NO_RELOC are already exercised by gem_exec_lut_handle,
Preferably with the whitespace tweak, and with or without the migration to gem_execbuf/__gem_execbuf,
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 43 lines · Chris Wilson
Quoting Antonio Argenziano (2018-01-31 21:21:32)
Quoted 20 lines
Subtest 'secure-non-master' tries to drop drm-master privileges on a non drm-master fd. Instead drop master privileges after the subtest acquires it so that other subtests are not affected by it.
v2:
- Require root privilege for the sub-test. (Chris)Signed-off-by Antonio Argenziano <[email protected]>Cc Chris Wilson <[email protected]>Cc Daniel Vetter <[email protected]>Cc Joonas Lahtinen <[email protected]>--- tests/gem_exec_params.c | 5 +++++ 1 file changed, 5 insertions(+)tests/gem_exec_params.c +0
-0tests/gem_exec_params.c igt_main · line 350
Quoted 8 lines
tests/gem_exec_params.c +2
-0@@ -343,13 +343,18 @@ igt_main } igt_subtest("secure-non-master") { +igt_require (__igt_device_set_master (fd));/* Requires root privilege */ igt_device_drop_master (fd); + execbuf.flags =I915_EXEC_RENDER |I915_EXEC_SECURE ;RUN_FAIL (EPERM );Fwiw, I like the spacing around the second stanza better as that couples acquiring root with the successful test. So I'd like the
igt_device_drop_master()next to theRUN_FAILblock.
igt_assert_eq(__gem_execbuf(fd, &execbuf), -EPERM);tests/gem_exec_params.c igt_main · line 355
Quoted 5 lines
tests/gem_exec_params.c +1
-0+igt_device_set_master (fd);igt_assert (drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf) ==0 );
gem_execbuf(fd, &execbuf);
Quoted 8 lines
tests/gem_exec_params.c igt_main · line 360
Quoted 5 lines
tests/gem_exec_params.c +2
-0+ +igt_device_drop_master (fd);/* Only needs temporary master */ }/* HANDLE_LUT and NO_RELOC are already exercised by gem_exec_lut_handle, Preferably with the whitespace tweak, and with or without the migration to gem_execbuf/__gem_execbuf,
I'll do the whitespace change but split the transition to gem_execbuf in a separate patch since it affects the whole test because of RUN_FAIL.
Thanks,
Antonio
Quoted 3 lines
Reviewed-by Chris Wilson <[email protected]>-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev