From: Petri Latvala <petri.latvala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>,
Emil Velikov <emil.velikov@collabora.com>
Subject: [igt-dev] [PATCH i-g-t] Revert "tests/core_unauth_vs_render: new test for the relaxed DRM_AUTH handling"
Date: Wed, 15 May 2019 13:19:56 +0300 [thread overview]
Message-ID: <20190515101956.935-1-petri.latvala@intel.com> (raw)
The kernel patch for relaxed DRM_AUTH handling caused a regression,
highlighting bug in the RADV implementation, and was reverted. The
patch will be reinstated, likely in different form, although until
then disable the test.
See the thread for details.
https://lists.freedesktop.org/archives/dri-devel/2019-April/215018.html
This reverts commit 90f78ac704718a4dc089ca99041f032191c6f8b1.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110467
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
Rather than adding #if 0
(https://patchwork.freedesktop.org/series/59945/) better to completely
revert for now.
---
tests/core_auth.c | 114 ----------------------------------------------
1 file changed, 114 deletions(-)
diff --git a/tests/core_auth.c b/tests/core_auth.c
index 49cad7cd..9c240fdb 100644
--- a/tests/core_auth.c
+++ b/tests/core_auth.c
@@ -1,6 +1,5 @@
/*
* Copyright 2015 David Herrmann <dh.herrmann@gmail.com>
- * Copyright 2018 Collabora, Ltd
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -43,7 +42,6 @@
#include <sys/time.h>
#include <sys/poll.h>
#include <sys/resource.h>
-#include <sys/sysmacros.h>
#include "drm.h"
#ifndef __linux__
@@ -192,105 +190,6 @@ static void test_basic_auth(int master)
close(slave);
}
-static bool has_prime_import(int fd)
-{
- uint64_t value;
-
- if (drmGetCap(fd, DRM_CAP_PRIME, &value))
- return false;
-
- return value & DRM_PRIME_CAP_IMPORT;
-}
-
-static void check_auth_sanity(int master)
-{
- uint32_t handle;
-
- igt_assert(check_auth(master) == true);
- igt_require(has_prime_import(master));
-
- igt_assert(drmPrimeFDToHandle(master, -1, &handle) < 0);
-
- /* IOCTL requires authenticated master as done in drm_permit.
- * As we get past that, we'll fail due to the invalid FD.
- *
- * Note: strictly speaking this is unrelated to the goal of
- * the test, although danvet requested it.
- */
- igt_assert(errno == EBADF);
-}
-
-static bool has_render_node(int fd)
-{
- char node_name[80];
- struct stat sbuf;
-
- if (fstat(fd, &sbuf))
- return false;
-
- sprintf(node_name, "/dev/dri/renderD%d", minor(sbuf.st_rdev) | 0x80);
- if (stat(node_name, &sbuf))
- return false;
-
- return true;
-}
-
-/*
- * Testcase: Render capable, unauthenticated master doesn't throw -EACCES for
- * DRM_RENDER_ALLOW ioctls.
- */
-static void test_unauth_vs_render(int master)
-{
- int slave;
- uint32_t handle;
- struct stat statbuf;
- bool has_render;
-
- /* need to check for render nodes before we wreak the filesystem */
- has_render = has_render_node(master);
-
- /* create a card node matching master which (only) we can access as
- * non-root */
- do_or_die(fstat(master, &statbuf));
- do_or_die(unshare(CLONE_NEWNS));
- do_or_die(mount(NULL, "/", NULL, MS_PRIVATE | MS_REC, NULL));
- do_or_die(mount("none", "/dev/dri", "tmpfs", 0, NULL));
- umask(0);
- do_or_die(mknod("/dev/dri/card", S_IFCHR | 0666, statbuf.st_rdev));
-
- igt_drop_root();
-
- slave = open("/dev/dri/card", O_RDWR);
-
- igt_assert(slave >= 0);
-
- /*
- * The second open() happens without CAP_SYS_ADMIN, thus it will NOT
- * be authenticated.
- */
- igt_assert(check_auth(slave) == false);
-
- /* Issuing the following ioctl will fail, no doubt about it. */
- igt_assert(drmPrimeFDToHandle(slave, -1, &handle) < 0);
-
- /*
- * Updated kernels allow render capable, unauthenticated master to
- * issue DRM_AUTH ioctls (like FD2HANDLE above), as long as they are
- * annotated as DRM_RENDER_ALLOW.
- *
- * Otherwise, errno is set to -EACCES
- *
- * Note: We are _not_ interested in the FD2HANDLE specific errno,
- * yet the EBADF check is added on the explicit request by danvet.
- */
- if (has_render)
- igt_assert(errno == EBADF);
- else
- igt_assert(errno == EACCES);
-
- close(slave);
-}
-
igt_main
{
int master;
@@ -329,17 +228,4 @@ igt_main
igt_subtest("many-magics")
test_many_magics(master);
}
-
- igt_subtest_group {
- igt_fixture
- master = drm_open_driver(DRIVER_ANY);
-
- igt_subtest("unauth-vs-render") {
- check_auth_sanity(master);
-
- igt_fork(child, 1)
- test_unauth_vs_render(master);
- igt_waitchildren();
- }
- }
}
--
2.19.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-05-15 10:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 10:19 Petri Latvala [this message]
2019-05-15 10:45 ` [igt-dev] ✓ Fi.CI.BAT: success for Revert "tests/core_unauth_vs_render: new test for the relaxed DRM_AUTH handling" Patchwork
2019-05-15 12:11 ` [igt-dev] [PATCH i-g-t] " Emil Velikov
2019-05-15 13:55 ` Daniel Vetter
2019-05-15 13:40 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190515101956.935-1-petri.latvala@intel.com \
--to=petri.latvala@intel.com \
--cc=emil.velikov@collabora.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox