[Mesa-dev] [PATCH 58/88] glsl: disable on disk shader cache when running as root

Timothy Arceri timothy.arceri at collabora.com
Mon Sep 26 00:03:34 UTC 2016


On Sun, 2016-09-25 at 12:39 -0700, Eric Anholt wrote:
> Timothy Arceri <timothy.arceri at collabora.com> writes:
> 
> > 
> > ---
> >  src/compiler/glsl/cache.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/src/compiler/glsl/cache.c b/src/compiler/glsl/cache.c
> > index a6a9e47..dd53f4e 100644
> > --- a/src/compiler/glsl/cache.c
> > +++ b/src/compiler/glsl/cache.c
> > @@ -141,6 +141,10 @@ cache_create(void)
> >     struct stat sb;
> >     size_t size;
> >  
> > +   /* If running as root disable cache */
> > +   if (geteuid() == 0)
> > +      return NULL;
> > +
> 
> It looks like in other getenv code we're doing:
> 
> geteuid() != getuid
> 
> (it's not just root we care about, it's any time you're using a thing
> that lets you setuid into someone else)

Good point. I've updated this and will push to my shader-cache branch
shortly.


More information about the mesa-dev mailing list