Re: /proc dubious hack?

Chris Evans (chris@ferret.lmh.ox.ac.uk)
Wed, 21 Jan 1998 20:53:36 +0000 (GMT)


On Wed, 21 Jan 1998, Bill Hawes wrote:

> If your patch needs to make persistant changes to permissions, then it
> would probably be better to find a way to store this with the object
> being represented rather than in the temporary /proc structures.

That's what it does. The permission on a /proc/<pid> directory is stored
in struct task.

> In the case of /proc, where would an inode be written? The problem with
> a synthetic filesystem is that the objects may not have a persistant
> representation.

The problem is the code used to monitor _attempted_ changes to inodes (eg.
permissions) in proc_write_inode. This used to be called even if it did
nothing. Now it no longer is. The inode get forcibly set n_link = 0 on
iput before the VFS notices it's dirty and calls the procfs write_inode
hook :-(

Things are still a little inconsistent though. If a fd is held open on a
/proc file, you can change its permissions/owner etc and they stick until
all the fd's close! Example: /proc/kmsg. klogd always has it open.

Is that clearer?

Chris