Messages in this thread Patch in this message | | | Date | Wed, 29 Jul 1998 21:20:27 -0400 (EDT) | From | Smilax Rotundifolia <> | Subject | [PATCH] procfs mount-time option |
| |
This patch will add a mount-time option to procfs.
mount -t proc -o mode=0xxxx none /proc
where xxxx are the octal bits for the /proc/<pid> directories. Since there are a lot of paranoids out there, this may prove quite useful. Maybe some would like to clean this patch up sometime?
mode=xxxx will NOT work properly is the first bit is greater than zero, so just do 0xxxx to be safe.
The default is still the same (0555) if you don't specify mode.
----------------------------------------- | | | Fenestrae delendae sunt. | | | | smilax@mindmeld.dyn.ml.org | ----------------------------------------- diff -ruN linux-old/fs/proc/inode.c linux/fs/proc/inode.c --- linux-old/fs/proc/inode.c Fri May 8 21:10:30 1998 +++ linux/fs/proc/inode.c Wed Jul 29 20:39:15 1998 @@ -99,13 +99,18 @@ NULL }; +struct proc_options { + mode_t mode; +}; -static int parse_options(char *options,uid_t *uid,gid_t *gid) +static int parse_options(char *options,uid_t *uid,gid_t *gid, + struct proc_options * opts) { char *this_char,*value; *uid = current->uid; *gid = current->gid; + opts->mode = S_IRUGO | S_IXUGO; if (!options) return 1; for (this_char = strtok(options,","); this_char; this_char = strtok(NULL,",")) { if ((value = strchr(this_char,'=')) != NULL) @@ -124,6 +129,16 @@ if (*value) return 0; } + else if (value && !strcmp(this_char,"mode")) { + char * vpnt = value; + unsigned int ivalue = simple_strtoul(vpnt, &vpnt, 0); + if (*vpnt) return 0; + switch(*this_char) { + case 'm': + opts->mode = ivalue; + break; + } + } else return 1; } return 1; @@ -310,6 +325,7 @@ int silent) { struct inode * root_inode; + struct proc_options opt; lock_super(s); s->s_blocksize = 1024; @@ -322,7 +338,8 @@ s->s_root = d_alloc_root(root_inode, NULL); if (!s->s_root) goto out_no_root; - parse_options(data, &root_inode->i_uid, &root_inode->i_gid); + parse_options(data, &root_inode->i_uid, &root_inode->i_gid, &opt); + proc_pid.mode = S_IFDIR | opt.mode; unlock_super(s); return s; | |