[lxc-devel] [PATCH] Set umask before populating /dev and restore it after.
Michael H. Warfield
mhw at WittsEnd.com
Tue Jan 8 18:28:51 UTC 2013
That does, in fact, catch my case of setting autodev on with a
non-systemd container (F14 in my case). That case is shot. Good catch.
Regards,
Mike
On Tue, 2013-01-08 at 09:08 +0800, Alexander Vladimirov wrote:
> According to docs, mknod clears each permission bit whose
> corresponding bit in the process umask is set, so we should fix it
> before creating device nodes.
> ---
> src/lxc/conf.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index 85d72c9..c0a270f 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -963,6 +963,7 @@ static int setup_autodev(char *root)
> struct lxc_devs *d;
> char path[MAXPATHLEN];
> int i;
> + mode_t cmask;
>
> INFO("Creating initial consoles under %s/dev\n", root);
>
> @@ -974,6 +975,7 @@ static int setup_autodev(char *root)
> run_makedev(path);
>
> INFO("Populating /dev under %s\n", root);
> + cmask = umask(S_IXUSR | S_IXGRP | S_IXOTH);
> for (i = 0; i < sizeof(lxc_devs) / sizeof(lxc_devs[0]); i++) {
> d = &lxc_devs[i];
> ret = snprintf(path, MAXPATHLEN, "%s/dev/%s", root, d->name);
> @@ -985,6 +987,7 @@ static int setup_autodev(char *root)
> return -1;
> }
> }
> + umask(cmask);
>
> INFO("Populated /dev under %s\n", root);
> return 0;
> --
> 1.8.1
>
>
> ------------------------------------------------------------------------------
> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
> and more. Get SQL Server skills now (including 2012) with LearnDevNow -
> 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only - learn more at:
> http://p.sf.net/sfu/learnmore_122512
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
>
--
Michael H. Warfield (AI4NB) | (770) 985-6132 | mhw at WittsEnd.com
/\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/
NIC whois: MHW9 | An optimist believes we live in the best of all
PGP Key: 0x674627FF | possible worlds. A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130108/8e4ef2f9/attachment.pgp>
More information about the lxc-devel
mailing list