All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Lord <lkml@rtr.ca>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: RFC: permit link(2)  to work across --bind mounts ?
Date: Tue, 18 Dec 2007 22:54:48 -0500	[thread overview]
Message-ID: <47689608.3030503@rtr.ca> (raw)
In-Reply-To: <20071218231404.GG8181@ftp.linux.org.uk>

Al Viro wrote:
> On Tue, Dec 18, 2007 at 11:00:16PM +0000, Al Viro wrote:
>> On Tue, Dec 18, 2007 at 05:46:21PM -0500, Mark Lord wrote:
>>> Why does link(2) not support hard-linking across bind mount points
>>> of the same underlying filesystem ?
>> Because it gives you a security boundary around a subtree.
> 
> PS: that had been discussed quite a few times, but to avoid searches:
> consider e.g. mount --bind /tmp /tmp; now you've got a situation when
> users can't create links to elsewhere no root fs, even though they
> have /tmp writable to them.  Similar technics works for other isolation
> needs - basically, you can confine rename/link to given subtree.  IOW,
> it's a deliberate feature.  Note that you can bind a bunch of trees
> into chroot and get predictable restrictions regardless of how the
> stuff might get rearranged a year later in the main tree, etc.
..

Thanks, Al.  That makes sense for a multi-user system, so I'm happy.

But.. pity there's no mount flag override for smaller systems,
where bind mounts might be more useful with link(2) actually working.

The patch is simple enough when needed, though.

Cheers

--- old/fs/namei.c	2007-12-15 12:33:13.000000000 -0500
+++ linux/fs/namei.c	2007-12-18 22:41:19.000000000 -0500
@@ -2398,7 +2398,7 @@
 	if (error)
 		goto out;
 	error = -EXDEV;
-	if (old_nd.mnt != nd.mnt)
+	if (old_nd.mnt->mnt_sb != nd.mnt->mnt_sb)
 		goto out_release;
 	new_dentry = lookup_create(&nd, 0);
 	error = PTR_ERR(new_dentry);

  reply	other threads:[~2007-12-19  3:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-18 22:46 RFC: permit link(2) to work across --bind mounts ? Mark Lord
2007-12-18 22:57 ` Mark Lord
2007-12-18 23:00 ` Al Viro
2007-12-18 23:14   ` Al Viro
2007-12-19  3:54     ` Mark Lord [this message]
2007-12-19  3:59       ` David Newall
2007-12-19 16:47         ` Mark Lord
2007-12-19 18:38           ` David Newall
2007-12-29  2:53         ` dean gaudet
2007-12-29  3:31           ` Jan Engelhardt
2007-12-29  6:02             ` dean gaudet
2007-12-29  6:48               ` Jan Engelhardt
2007-12-29  8:29           ` David Newall
2007-12-29 16:18             ` dean gaudet
2007-12-29 20:35               ` David Newall
2007-12-29 20:40                 ` dean gaudet
2007-12-30  3:43                   ` Valdis.Kletnieks
2007-12-30  3:55                     ` dean gaudet
2007-12-27  3:43 ` Rogelio M. Serrano Jr.
     [not found] <9BTqk-2ck-31@gated-at.bofh.it>
     [not found] ` <9BTJN-2Sv-21@gated-at.bofh.it>
     [not found]   ` <9BTTr-35L-13@gated-at.bofh.it>
2007-12-19 13:43     ` Bodo Eggert
2007-12-19 14:23       ` Al Viro
2007-12-19 15:42         ` Johannes Weiner
2007-12-19 16:44         ` Mark Lord
2007-12-20 20:55         ` Bodo Eggert
  -- strict thread matches above, loose matches on Subject: below --
2007-12-20  1:33 linux
2007-12-20  2:06 ` Mark Lord

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47689608.3030503@rtr.ca \
    --to=lkml@rtr.ca \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.