[igt-dev] [PATCH i-g-t] lib/core_auth: mount namespace magic to make the test work everywhere

Daniel Vetter daniel at ffwll.ch
Thu Feb 14 15:32:16 UTC 2019


On Thu, Feb 14, 2019 at 12:26:22PM +0000, Chris Wilson wrote:
> Quoting Daniel Vetter (2019-02-13 18:33:09)
> > +       /* 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));
> > +       igt_system("mount --make-rprivate /");
> > +       igt_system("mount -t tmpfs none /dev/dri");
> 
> man mount(2)? I'm optimistic that translates to MS_PRIVATE.
> 
> Changing the propagation type of an existing mount
> 
>        If mountflags includes one of MS_SHARED, MS_PRIVATE, MS_SLAVE, or
>        MS_UNBINDABLE (all available since Linux 2.6.15), then the
>        propagation type of an existing mount is changed.  If more than one
>        of these flags is specified, an error results.
> 
>        The only flags that can be used with changing the propagation type
>        are MS_REC and MS_SILENT.
> 
> Seems like it should be just that :)

Yeah I unlazied and changed my cmdline hackery to proper syscalls in v2.
Took me a while to figure out that cmdline unshare does additional stuff
when you want a new namespace. And mount(2) is not the most intuitive
thing ever, but luckily mouting tmpfs is easy.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the igt-dev mailing list