Re: Permissions of softlinks in /proc

david parsons (orc@pell.portland.or.us)
21 Nov 1999 20:56:18 -0800


In article <linux.kernel.19991122002653.A24@stud.somewhere>,
Guido Flohr <gufl0000@stud.uni-sb.de> wrote:

>And, hm, at the risk of sacrifying a holy cow, wouldn't it make sense for
>*all* symlinks to allow other modes than "lrwxrwxrwx"?

Sure. But you'll need to write the code and get it past the wall of
flame to demonstrate it first. I think (looking from a 10-year
distance from when I last hacked filesystems) that it would be
moderately straightforward to make the code changes for at least
ext2; you'd simply have to tweak acl.c (in 2.0.28+logo; dunno
where it lives in other kernels) so that ext2_permission wouldn't
puke out when the inode is S_ISLNK.

But, wall of flame aside, consider that it might not be as useful as
you'd want, since it would be about as barkingly nonportable as you
can buy without a prescription. At best (it being a wonderful idea
just waiting for someone to take down that wall of Standards(tm))
its going to be a Linux-specific thing for at least 5 years (1 year
to put it into all of the other Unices, 4 years to push out the
Unices that don't support it), and at worst (devfs) it will do
nothing except call down all the friendly fire you can eat.

>I can think of
>situations where I would like to allow other people to follow a certain
>symlink but want to hide its target. And it would also be absolutely
>straightforward to "chmod -w" a symlink to avoid somebody else
>removing it. Sure, that would require a new system call, just a thought.

I don't think it would require any new system call, just:

--- linux-2.0.28+logo/fs/ext2/acl.c.orig Sun Nov 21 20:54:54 1999
+++ linux-2.0.28+logo/fs/ext2/acl.c Sun Nov 21 20:55:21 1999
@@ -31,7 +31,7 @@
* Nobody gets write access to a file on a readonly-fs
*/
if ((mask & S_IWOTH) &&
- (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) &&
+ (S_ISREG(mode) || S_ISDIR(mode)) &&
IS_RDONLY(inode))
return -EROFS;
/*

____
david parsons \bi/ The important work is blowing up real good, but
\/ the silly one-line kernel patches are happy.

-
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.tux.org/lkml/