Re: [BUG] OOPS too easy by rm'ing in /proc

From: Willy Tarreau (willy@novworld.Novecom.Fr)
Date: Wed Aug 23 2000 - 18:14:21 EST


> I'll recompile one kernel and post an obvious patch to remove remove_proc_entry()
> soon if that seems to work. Anyway, it will still be possible to change the permissions
> in the subdirectories. Perhaps this is desired behaviour ...

Hmmm, I was wrong about the function referenced in fs/proc/root.c. It's proc_unlink()
which is referenced. The following patch simply removes it from the structure
"proc_dyna_dir_inode_operations" in kernel 2.2.17pre19. It works for me, but I repeat
that I don't know if this could break something. Testers welcome.

(also MIME-attached)

Cheers,

Willy

--- linux/fs/proc/root.c Wed Oct 27 02:53:42 1999
+++ linux/fs/proc/root.c Thu Aug 24 00:59:35 2000
@@ -29,7 +29,6 @@
 
 static int proc_root_readdir(struct file *, void *, filldir_t);
 static struct dentry *proc_root_lookup(struct inode *,struct dentry *);
-static int proc_unlink(struct inode *, struct dentry *);
 
 static unsigned char proc_alloc_map[PROC_NDYNAMIC / 8] = {0};
 
@@ -86,7 +85,7 @@
         NULL, /* create */
         proc_lookup, /* lookup */
         NULL, /* link */
- proc_unlink, /* unlink(struct inode *, struct dentry *) */
+ NULL, /* unlink(struct inode *, struct dentry *) */
         NULL, /* symlink */
         NULL, /* mkdir */
         NULL, /* rmdir */
@@ -988,17 +987,5 @@
                         break;
                 filp->f_pos++;
         }
- return 0;
-}
-
-static int proc_unlink(struct inode *dir, struct dentry *dentry)
-{
- struct proc_dir_entry * dp = dir->u.generic_ip;
-
-printk("proc_file_unlink: deleting %s/%s\n", dp->name, dentry->d_name.name);
-
- remove_proc_entry(dentry->d_name.name, dp);
- dentry->d_inode->i_nlink = 0;
- d_delete(dentry);
         return 0;
 }



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



This archive was generated by hypermail 2b29 : Wed Aug 23 2000 - 21:00:10 EST