summaryrefslogtreecommitdiff
path: root/graphics/mesa/patches/patch-src_loader_loader_c
blob: c917f92cb98ae16a16bacb9619078a3e5491ffcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Index: src/loader/loader.c
--- src/loader/loader.c.orig
+++ src/loader/loader.c
@@ -561,7 +561,7 @@ loader_get_driver_for_fd(int fd)
     * user's problem, but this allows vc4 simulator to run on an i965 host,
     * and may be useful for some touch testing of i915 on an i965 host.
     */
-   if (geteuid() == getuid()) {
+   if (issetugid() == 0 && geteuid() == getuid()) {
       const char *override = os_get_option("MESA_LOADER_DRIVER_OVERRIDE");
       if (override)
          return strdup(override);
@@ -625,7 +625,7 @@ loader_open_driver_lib(const char *driver_name,
    const char *search_paths, *next, *end;
 
    search_paths = NULL;
-   if (geteuid() == getuid() && search_path_vars) {
+   if (issetugid() == 0 && geteuid() == getuid() && search_path_vars) {
       for (int i = 0; search_path_vars[i] != NULL; i++) {
          search_paths = getenv(search_path_vars[i]);
          if (search_paths)