* [igt-dev] [PATCH i-g-t] tests/core_auth: Merge getclient subtests
@ 2019-01-23 11:31 Daniel Vetter
2019-01-23 11:55 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Daniel Vetter @ 2019-01-23 11:31 UTC (permalink / raw)
To: IGT development; +Cc: Emil Velikov, Daniel Vetter
Emil has another auth test which could use the check_auth function, so
best to merge them all.
We need a subtest group and put the tests which need to fully control
who's master and how many open drm fd there are first.
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
tests/Makefile.sources | 1 -
tests/core_auth.c | 75 +++++++++++++++++++++++---
tests/core_get_client_auth.c | 102 -----------------------------------
tests/meson.build | 1 -
4 files changed, 68 insertions(+), 111 deletions(-)
delete mode 100644 tests/core_get_client_auth.c
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 0de5154c5f4b..1de7762fda95 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -13,7 +13,6 @@ AMDGPU_TESTS = \
TESTS_progs = \
core_auth \
- core_get_client_auth \
core_getclient \
core_getstats \
core_getversion \
diff --git a/tests/core_auth.c b/tests/core_auth.c
index cedcff923937..0c016a37f654 100644
--- a/tests/core_auth.c
+++ b/tests/core_auth.c
@@ -42,8 +42,44 @@
#include <sys/resource.h>
#include "drm.h"
+#ifdef __linux__
+# include <sys/syscall.h>
+#else
+# include <pthread.h>
+#endif
+
IGT_TEST_DESCRIPTION("Call drmGetMagic() and drmAuthMagic() and see if it behaves.");
+static bool
+is_local_tid(pid_t tid)
+{
+#ifndef __linux__
+ return pthread_self() == tid;
+#else
+ /* On Linux systems, drmGetClient() would return the thread ID
+ instead of the actual process ID */
+ return syscall(SYS_gettid) == tid;
+#endif
+}
+
+
+static bool check_auth(int fd)
+{
+ pid_t client_pid;
+ int i, auth, pid, uid;
+ unsigned long magic, iocs;
+ bool is_authenticated = false;
+
+ client_pid = getpid();
+ for (i = 0; !is_authenticated; i++) {
+ if (drmGetClient(fd, i, &auth, &pid, &uid, &magic, &iocs) != 0)
+ break;
+ is_authenticated = auth && (pid == client_pid || is_local_tid(pid));
+ }
+ return is_authenticated;
+}
+
+
static int magic_cmp(const void *p1, const void *p2)
{
return *(const drm_magic_t*)p1 < *(const drm_magic_t*)p2;
@@ -158,13 +194,38 @@ igt_main
{
int master;
- igt_fixture
- master = drm_open_driver_master(DRIVER_ANY);
+ /* root (which we run igt as) should always be authenticated */
+ igt_subtest("getclient-simple") {
+ int fd = drm_open_driver(DRIVER_ANY);
- igt_subtest("basic-auth")
- test_basic_auth(master);
+ igt_assert(check_auth(fd) == true);
- /* this must be last, we adjust the rlimit */
- igt_subtest("many-magics")
- test_many_magics(master);
+ close(fd);
+ }
+
+ igt_subtest("getclient-master-drop") {
+ int fd = drm_open_driver(DRIVER_ANY);
+ int fd2 = drm_open_driver(DRIVER_ANY);
+
+ igt_assert(check_auth(fd2) == true);
+
+ close(fd);
+
+ igt_assert(check_auth(fd2) == true);
+
+ close(fd2);
+ }
+
+ /* above tests require that no drm fd is open */
+ igt_subtest_group {
+ igt_fixture
+ master = drm_open_driver_master(DRIVER_ANY);
+
+ igt_subtest("basic-auth")
+ test_basic_auth(master);
+
+ /* this must be last, we adjust the rlimit */
+ igt_subtest("many-magics")
+ test_many_magics(master);
+ }
}
diff --git a/tests/core_get_client_auth.c b/tests/core_get_client_auth.c
deleted file mode 100644
index 9c64699d83a9..000000000000
--- a/tests/core_get_client_auth.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright © 2012,2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- * Daniel Vetter <daniel.vetter@ffwll.ch>
- *
- * Based upon code from libva/va/drm/va_drm_auth.c:
- */
-
-/*
- * Testcase: Check that the hollowed-out get_client ioctl still works for libva
- *
- * Oh dear, libva, why do you do such funny things?
- */
-
-#include "igt.h"
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef __linux__
-# include <sys/syscall.h>
-#else
-# include <pthread.h>
-#endif
-
-#include "drm.h"
-
-/* Checks whether the thread id is the current thread */
-static bool
-is_local_tid(pid_t tid)
-{
-#ifndef __linux__
- return pthread_self() == tid;
-#else
- /* On Linux systems, drmGetClient() would return the thread ID
- instead of the actual process ID */
- return syscall(SYS_gettid) == tid;
-#endif
-}
-
-
-static bool check_auth(int fd)
-{
- pid_t client_pid;
- int i, auth, pid, uid;
- unsigned long magic, iocs;
- bool is_authenticated = false;
-
- client_pid = getpid();
- for (i = 0; !is_authenticated; i++) {
- if (drmGetClient(fd, i, &auth, &pid, &uid, &magic, &iocs) != 0)
- break;
- is_authenticated = auth && (pid == client_pid || is_local_tid(pid));
- }
- return is_authenticated;
-}
-
-
-igt_main
-{
- /* root (which we run igt as) should always be authenticated */
- igt_subtest("simple") {
- int fd = drm_open_driver(DRIVER_ANY);
-
- igt_assert(check_auth(fd) == true);
-
- close(fd);
- }
-
- igt_subtest("master-drop") {
- int fd = drm_open_driver(DRIVER_ANY);
- int fd2 = drm_open_driver(DRIVER_ANY);
-
- igt_assert(check_auth(fd2) == true);
-
- close(fd);
-
- igt_assert(check_auth(fd2) == true);
-
- close(fd2);
- }
-}
diff --git a/tests/meson.build b/tests/meson.build
index b8a6e61b3404..6a23811f4f58 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,6 +1,5 @@
test_progs = [
'core_auth',
- 'core_get_client_auth',
'core_getclient',
'core_getstats',
'core_getversion',
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for tests/core_auth: Merge getclient subtests
2019-01-23 11:31 [igt-dev] [PATCH i-g-t] tests/core_auth: Merge getclient subtests Daniel Vetter
@ 2019-01-23 11:55 ` Patchwork
2019-01-23 13:13 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-01-23 17:35 ` [igt-dev] [PATCH i-g-t] " Emil Velikov
2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2019-01-23 11:55 UTC (permalink / raw)
To: Daniel Vetter; +Cc: igt-dev
== Series Details ==
Series: tests/core_auth: Merge getclient subtests
URL : https://patchwork.freedesktop.org/series/55634/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5469 -> IGTPW_2279
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/55634/revisions/1/mbox/
Known issues
------------
Here are the changes found in IGTPW_2279 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live_execlists:
- fi-apl-guc: PASS -> INCOMPLETE [fdo#103927]
* igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
- fi-byt-clapper: PASS -> FAIL [fdo#103191] / [fdo#107362]
#### Possible fixes ####
* igt@kms_busy@basic-flip-b:
- fi-gdg-551: FAIL [fdo#103182] -> PASS
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
Participating hosts (44 -> 40)
------------------------------
Additional (1): fi-hsw-peppy
Missing (5): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-icl-y
Build changes
-------------
* IGT: IGT_4785 -> IGTPW_2279
CI_DRM_5469: 388cbc6121c1bd3d9846789bfef0a3e08c346461 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2279: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2279/
IGT_4785: 70749c70926f12043d3408b160606e1e6238ed3a @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Testlist changes ==
+igt@core_auth@getclient-master-drop
+igt@core_auth@getclient-simple
-igt@core_get_client_auth@master-drop
-igt@core_get_client_auth@simple
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2279/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* [igt-dev] ✓ Fi.CI.IGT: success for tests/core_auth: Merge getclient subtests
2019-01-23 11:31 [igt-dev] [PATCH i-g-t] tests/core_auth: Merge getclient subtests Daniel Vetter
2019-01-23 11:55 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2019-01-23 13:13 ` Patchwork
2019-01-23 17:35 ` [igt-dev] [PATCH i-g-t] " Emil Velikov
2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2019-01-23 13:13 UTC (permalink / raw)
To: Daniel Vetter; +Cc: igt-dev
== Series Details ==
Series: tests/core_auth: Merge getclient subtests
URL : https://patchwork.freedesktop.org/series/55634/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5469_full -> IGTPW_2279_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/55634/revisions/1/mbox/
Known issues
------------
Here are the changes found in IGTPW_2279_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_softpin@softpin:
- shard-apl: PASS -> INCOMPLETE [fdo#103927]
* igt@kms_available_modes_crc@available_mode_test_crc:
- shard-apl: PASS -> FAIL [fdo#106641]
* igt@kms_busy@extended-pageflip-hang-newfb-render-b:
- shard-apl: PASS -> DMESG-WARN [fdo#107956]
* igt@kms_cursor_crc@cursor-256x256-random:
- shard-glk: PASS -> FAIL [fdo#103232] +1
* igt@kms_cursor_crc@cursor-64x21-sliding:
- shard-apl: PASS -> FAIL [fdo#103232] +1
- shard-kbl: PASS -> FAIL [fdo#103232]
* igt@kms_draw_crc@draw-method-xrgb8888-mmap-wc-ytiled:
- shard-glk: PASS -> FAIL [fdo#103184]
* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
- shard-glk: PASS -> FAIL [fdo#105363]
* igt@kms_plane_multiple@atomic-pipe-c-tiling-x:
- shard-glk: PASS -> FAIL [fdo#103166] +1
* igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
- shard-apl: PASS -> FAIL [fdo#103166] +3
- shard-kbl: PASS -> FAIL [fdo#103166] +1
* igt@kms_setmode@basic:
- shard-apl: PASS -> FAIL [fdo#99912]
#### Possible fixes ####
* igt@kms_color@pipe-c-legacy-gamma:
- shard-apl: FAIL [fdo#104782] -> PASS
* igt@kms_cursor_crc@cursor-128x42-random:
- shard-glk: FAIL [fdo#103232] -> PASS +2
* igt@kms_cursor_crc@cursor-256x85-sliding:
- shard-apl: FAIL [fdo#103232] -> PASS +5
* igt@kms_cursor_crc@cursor-64x64-dpms:
- shard-kbl: FAIL [fdo#103232] -> PASS +2
* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-glk: FAIL [fdo#105363] -> PASS
* igt@kms_plane@pixel-format-pipe-b-planes-source-clamping:
- shard-glk: FAIL [fdo#108948] -> PASS
* igt@kms_plane_alpha_blend@pipe-b-alpha-opaque-fb:
- shard-glk: FAIL [fdo#108145] -> PASS +1
* igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
- shard-apl: FAIL [fdo#103166] -> PASS
* igt@kms_plane_multiple@atomic-pipe-a-tiling-yf:
- shard-glk: FAIL [fdo#103166] -> PASS
* igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-apl: DMESG-FAIL [fdo#108950] -> PASS
* igt@perf_pmu@rc6-runtime-pm-long:
- shard-kbl: FAIL [fdo#105010] -> PASS
* igt@sw_sync@sync_multi_consumer:
- shard-apl: INCOMPLETE [fdo#103927] -> PASS
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103184]: https://bugs.freedesktop.org/show_bug.cgi?id=103184
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[fdo#105010]: https://bugs.freedesktop.org/show_bug.cgi?id=105010
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
[fdo#108950]: https://bugs.freedesktop.org/show_bug.cgi?id=108950
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
Participating hosts (6 -> 4)
------------------------------
Missing (2): shard-skl shard-iclb
Build changes
-------------
* IGT: IGT_4785 -> IGTPW_2279
* Piglit: piglit_4509 -> None
CI_DRM_5469: 388cbc6121c1bd3d9846789bfef0a3e08c346461 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2279: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2279/
IGT_4785: 70749c70926f12043d3408b160606e1e6238ed3a @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2279/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] tests/core_auth: Merge getclient subtests
2019-01-23 11:31 [igt-dev] [PATCH i-g-t] tests/core_auth: Merge getclient subtests Daniel Vetter
2019-01-23 11:55 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-01-23 13:13 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2019-01-23 17:35 ` Emil Velikov
2019-01-23 19:59 ` Daniel Vetter
2 siblings, 1 reply; 5+ messages in thread
From: Emil Velikov @ 2019-01-23 17:35 UTC (permalink / raw)
To: Daniel Vetter; +Cc: IGT development, Daniel Vetter
On Wed, 23 Jan 2019 at 11:31, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>
> Emil has another auth test which could use the check_auth function, so
> best to merge them all.
>
> We need a subtest group and put the tests which need to fully control
> who's master and how many open drm fd there are first.
>
> Cc: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Ack. on the idea. Pointing out some bits that seem off below.
I would _not_ bother with any of them here, although they may be worth
addressing at some point.
> + igt_subtest("getclient-master-drop") {
> + int fd = drm_open_driver(DRIVER_ANY);
> + int fd2 = drm_open_driver(DRIVER_ANY);
> +
> + igt_assert(check_auth(fd2) == true);
> +
> + close(fd);
> +
> + igt_assert(check_auth(fd2) == true);
> +
> + close(fd2);
Either a comment is missing here, something seems wrong ... not sure.
- test is called "master-drop", yet we check the authentication being
"dropped".
- authentication is always set because we run as root
- two clients are present, yet we only ever check one of them
- there is no means to drop authentication for a given client - be
that userspace or in-kernel API
HTH
Emil
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] tests/core_auth: Merge getclient subtests
2019-01-23 17:35 ` [igt-dev] [PATCH i-g-t] " Emil Velikov
@ 2019-01-23 19:59 ` Daniel Vetter
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2019-01-23 19:59 UTC (permalink / raw)
To: Emil Velikov; +Cc: IGT development, Daniel Vetter
On Wed, Jan 23, 2019 at 6:38 PM Emil Velikov <emil.l.velikov@gmail.com> wrote:
>
> On Wed, 23 Jan 2019 at 11:31, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> >
> > Emil has another auth test which could use the check_auth function, so
> > best to merge them all.
> >
> > We need a subtest group and put the tests which need to fully control
> > who's master and how many open drm fd there are first.
> >
> > Cc: Emil Velikov <emil.l.velikov@gmail.com>
>
> Acked-by: Emil Velikov <emil.velikov@collabora.com>
>
> Ack. on the idea. Pointing out some bits that seem off below.
> I would _not_ bother with any of them here, although they may be worth
> addressing at some point.
>
> > + igt_subtest("getclient-master-drop") {
> > + int fd = drm_open_driver(DRIVER_ANY);
> > + int fd2 = drm_open_driver(DRIVER_ANY);
> > +
> > + igt_assert(check_auth(fd2) == true);
> > +
> > + close(fd);
> > +
> > + igt_assert(check_auth(fd2) == true);
> > +
> > + close(fd2);
> Either a comment is missing here, something seems wrong ... not sure.
> - test is called "master-drop", yet we check the authentication being
> "dropped".
> - authentication is always set because we run as root
> - two clients are present, yet we only ever check one of them
> - there is no means to drop authentication for a given client - be
> that userspace or in-kernel API
Took me a while to find this, since the igt commit references the
wrong kernel commit, but this is all about:
commit 3cb01a980461506f9ec4e4e1dc2dab6314236fb7
Author: David Herrmann <dh.herrmann@gmail.com>
Date: Tue Jul 22 17:12:26 2014 +0200
drm: don't de-authenticate clients on master-close
but yeah the testcase is pretty funky, and there's an obvious gap of
opening the device as non-root and double-checking we're not
authenticated - I started typing a patch for adding such a new
subtest, hence my remarks in the other thread.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-01-23 19:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-23 11:31 [igt-dev] [PATCH i-g-t] tests/core_auth: Merge getclient subtests Daniel Vetter
2019-01-23 11:55 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-01-23 13:13 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-01-23 17:35 ` [igt-dev] [PATCH i-g-t] " Emil Velikov
2019-01-23 19:59 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox