[Mesa-dev] [PATCH 22/32] glsl: disable on disk shader cache when running as another user

Nicolai Hähnle nhaehnle at gmail.com
Thu Feb 16 11:33:14 UTC 2017


On 14.02.2017 01:52, Timothy Arceri wrote:
> From: Timothy Arceri <timothy.arceri at collabora.com>
>
> ---
>  src/util/disk_cache.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
> index 047a016..f26b81d 100644
> --- a/src/util/disk_cache.c
> +++ b/src/util/disk_cache.c
> @@ -142,6 +142,10 @@ disk_cache_create(void)
>     struct stat sb;
>     size_t size;
>
> +   /* If running as a users other than the real user disable cache */
> +   if (geteuid() != getuid())
> +      return NULL;

I've been wondering if this is really the authoritatively correct way to 
do this. I know this is how the loader does it, for example, but I 
recently stumbled over code in the X server that has some additional 
checks and uses extra functions, including optionally a function called 
issetugid(), in hw/xfree86/common/xf86Init.c.

Any idea about an authoritative source on this? I don't want to 
cargo-cult something overly complex, but at the same time, the above 
really does check less (e.g., it doesn't look at gids).

Cheers,
Nicolai

> +
>     /* A ralloc context for transient data during this invocation. */
>     local = ralloc_context(NULL);
>     if (local == NULL)
>



More information about the mesa-dev mailing list