Messages in this thread Patch in this message | | | From | Neil Brown <> | Date | Fri, 13 Jul 2001 22:03:08 +1000 (EST) | Subject | Re: [NFS] [PATCH] Bug in NFS - should umask be allowed to set umask??? |
| |
[ Background for Linus who has been added to the To: list Abramo noticed that knfsd appeared to be running with a umask of 022. I commented that nfsd has the same umask as /sbin/init as they share current->fs, courtesy of daemonize(). I asked what "init" he was running]
On Friday July 13, abramo@alsa-project.org wrote: > $ rpm -qf /sbin/init > SysVinit-2.78-17
Ok, I found SysVinit-2.78-15 which is probably close enough, managed to find a redhat system to explode it on, and found this patch:
--- sysvinit-2.78/src/init.c.foo Wed Apr 4 01:42:27 2001 +++ sysvinit-2.78/src/init.c Wed Apr 4 01:42:49 2001 @@ -2451,6 +2451,8 @@ p = argv[0]; + umask(022); + /* * Is this telinit or init ? */ @@ -2523,8 +2525,6 @@ /* Check syntax. */ if (argc - optind != 1 || strlen(argv[optind]) != 1) Usage(p); if (!strchr("0123456789SsQqAaBbCcUu", argv[optind][0])) Usage(p); - - umask(022); /* Open the fifo and write a command. */ memset(&request, 0, sizeof(request));
what this does is that instead of just setting umask when running as "telinit", init always sets umask to 022. This is setting the umask for nfsd. This completely explains your observations. So we have several options:
1/ Claim that redhat is broken. Leave them to fix SysVinit. 2/ Have nfsd over-write the umask setting that /sbin/init imposed. This is effectively what your patch does. 3/ Decide that it is inappropriate for nfsd to share the current->fs fs_struct with init. Unfortunately this means changing or replacing daemonize().
None of these seem ideal. (3) is probably most correct (i.e. protect the kernel from user space mucking about) but is the most work.
Suggestions please ??? Linus??
NeilBrown - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |