Re: proc pid perm patch, 2.1.108?

Ragnar Hojland Espinosa (root@lightside.ddns.org)
Sat, 11 Jul 1998 20:38:11 +0200 (MET DST)


On Sat, 11 Jul 1998, Laszlo Vecsey wrote:

> Does anyone have a proc pid perm patch that applies cleanly to 2.1.108?
> LinuxHQ has a small patch that works for 2.0.x but no longer applies
> cleanly to the latest kernels.

Well, theres a proc pid perm patch.. not sure if it does what you want,
but it does work for me :) As you can see below, it gives you a
pids_umask option you can use when mounting /proc. Was for 2.1.88, but
should still work.

lightside:~# mount /proc /proc -t proc -o pids_umask=077

____/| Ragnar Hojland (ragnar@lightside.ddns.org) Fingerprint 94C4B
\ o.O| 2F0D27DE025BE2302C
=(_)= "Thou shalt not follow the NULL pointer for 104B78C56 B72F0822
U chaos and madness await thee at its end." hkp://keys.pgp.com

--- ./fs/proc/base.c.ORIG Mon Mar 2 23:48:05 1998
+++ ./fs/proc/base.c Tue Mar 3 00:56:43 1998
@@ -64,6 +64,8 @@ static void proc_pid_fill_inode(struct i
if (p->dumpable || ino == PROC_PID_INO) {
inode->i_uid = p->euid;
inode->i_gid = p->gid;
+
+ inode->i_mode &= ~inode->i_sb->u.proc_sb.options.pids_umask;
}
}
}
--- ./fs/proc/inode.c.ORIG Mon Mar 2 14:17:45 1998
+++ ./fs/proc/inode.c Tue Mar 3 01:00:48 1998
@@ -99,12 +99,13 @@ static struct super_operations proc_sops
};


-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_mount_options *m_options)
{
char *this_char,*value;

*uid = current->uid;
*gid = current->gid;
+ m_options->pids_umask = current->fs->umask;
if (!options) return 1;
for (this_char = strtok(options,","); this_char; this_char = strtok(NULL,",")) {
if ((value = strchr(this_char,'=')) != NULL)
@@ -123,6 +124,13 @@ static int parse_options(char *options,u
if (*value)
return 0;
}
+ else if (!strcmp(this_char,"pids_umask")) {
+ if (!value || !*value)
+ return 0;
+ m_options->pids_umask = simple_strtoul(value,&value,0);
+ if (*value)
+ return 0;
+ }
else return 1;
}
return 1;
@@ -202,6 +210,7 @@ struct super_block *proc_read_super(stru
int silent)
{
struct inode * root_inode;
+ struct proc_mount_options m_options;

lock_super(s);
s->s_blocksize = 1024;
@@ -214,7 +223,8 @@ struct super_block *proc_read_super(stru
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,&m_options);
+ s->u.proc_sb.options = m_options;
unlock_super(s);
return s;

--- ./include/linux/fs.h.ORIG Mon Mar 2 16:24:55 1998
+++ ./include/linux/fs.h Mon Mar 2 16:26:26 1998
@@ -514,6 +514,7 @@ extern int fasync_helper(struct file *,
#include <linux/smb_fs_sb.h>
#include <linux/hfs_fs_sb.h>
#include <linux/adfs_fs_sb.h>
+#include <linux/proc_fs_sb.h>

struct super_block {
kdev_t s_dev;
@@ -551,6 +552,7 @@ struct super_block {
struct smb_sb_info smbfs_sb;
struct hfs_sb_info hfs_sb;
struct adfs_sb_info adfs_sb;
+ struct proc_sb_info proc_sb;
void *generic_sbp;
} u;
};
--- ./include/linux/proc_fs_sb.h.ORIG Mon Mar 2 16:26:53 1998
+++ ./include/linux/proc_fs_sb.h Tue Mar 3 01:02:26 1998
@@ -0,0 +1,12 @@
+#ifndef __PROC_FS_SB
+#define __PROC_FS_SB
+
+struct proc_mount_options {
+ umode_t pids_umask;
+};
+
+struct proc_sb_info {
+ struct proc_mount_options options;
+};
+
+#endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html