[lkml]   [2001]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [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

On Friday July 13, 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/ 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??

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:17    [W:0.079 / U:2.028 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site