From: Kees Cook <kees.cook@canonical.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org,
Randy Dunlap <rdunlap@xenotime.net>,
Andrew Morton <akpm@linux-foundation.org>,
Jiri Kosina <jkosina@suse.cz>,
Dave Young <hidave.darkstar@gmail.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
James Morris <jmorris@namei.org>, Eric Paris <eparis@redhat.com>,
David Howells <dhowells@redhat.com>, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Tim Gardner <tim.gardner@canonical.com>,
"Serge E. Hallyn" <serue@us.ibm.com>
Subject: Re: [PATCH v2] fs: block cross-uid sticky symlinks
Date: Sun, 30 May 2010 21:12:04 -0700 [thread overview]
Message-ID: <20100531041204.GR6056@outflux.net> (raw)
In-Reply-To: <m17hmkg25e.fsf@fess.ebiederm.org>
Hi Eric,
On Sun, May 30, 2010 at 08:50:53PM -0700, Eric W. Biederman wrote:
> The name of the sysctl is horrible it is a double negative, which
> makes thinking about it hard.
Hmm, I see your point, the "safe" value is "weak: not". I was trying to
be descriptive without needing a "true" value, but I guess that's silly;
we already have things like randomize_va_space set to "2" by default, etc.
What would you suggest instead? "protected_sticky_symlinks" (and reverse
the default and test logic)?
> Why not simply put each user in a different mount namespace and have separate
> /tmp directories per user? That works today, with no kernel changes.
The key here is "no kernel changes" -- trying to isolate every user
and service from each other using different mount namespaces will not
work quickly in current distributions. Even doing bind-mount tricks
to keep /tmp away from different users is overkill, especially when
you have situations like "screen" using a common /tmp directory tree
(in the setuid version), etc. Things (correctly) expect to share /tmp
in some cases. However, this one kernel change will allow everything
to continue without userspace overhead and without breaking anything
terribly. Using containers will probably be the future, but I want to
solve this in the general case today.
> Placing this in cap_inode_follow_link is horrible naming. There is nothing
> capabilities about this. Either this needs to go into one or several
> of the security modules or this needs to go into the core vfs.
My thinking was that most of the LSMs call down to commoncaps first,
so it's a single place to put this. When I was looking at this code
originally, I thought that if it doesn't go in security_inode_follow_link,
then a new function would be added to the VFS and both callers
of security_inode_follow_link would need to call it just before
security_inode_follow_link. It seemed like putting it in there reduced
duplication of logic.
However, on closer examination, it seems that this code could live in
__do_follow_link instead.
fs/namei.c:
...
error = security_inode_follow_link(path.dentry, &nd);
if (error)
goto exit_dput;
error = __do_follow_link(&path, &nd, &cookie);
...
err = security_inode_follow_link(path->dentry, nd);
if (err)
goto loop;
current->link_count++;
current->total_link_count++;
nd->depth++;
err = __do_follow_link(path, nd, &cookie);
...
What would you suggest for the best approach here?
> I can't argue with taking action to close the too frequently security
> issues in /tmp, but this changes appears to be unnecessary, difficult
> to maintain, and difficult to understand.
Well, we disagree about "unnecessary". :) Finding an easy to maintain
solution is my goal here, and if it's difficult to understand, then I need
to fix that too. What could use better clarification?
Thanks!
-Kees
--
Kees Cook
Ubuntu Security Team
next prev parent reply other threads:[~2010-05-31 4:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-31 3:04 Kees Cook
2010-05-31 3:50 ` Eric W. Biederman
2010-05-31 4:12 ` Kees Cook [this message]
2010-05-31 3:54 ` Eric Paris
2010-05-31 4:23 ` Kees Cook
2010-05-31 10:23 ` Alan Cox
2010-05-31 17:50 ` Kees Cook
2010-05-31 18:09 ` Alan Cox
2010-05-31 19:07 ` Kees Cook
2010-05-31 19:52 ` Al Viro
2010-05-31 22:00 ` Kees Cook
2010-05-31 19:27 ` Al Viro
2010-05-31 10:35 ` Christoph Hellwig
2010-05-31 17:57 ` Kees Cook
2010-05-31 23:09 ` James Morris
2010-06-01 3:24 ` Kees Cook
2010-06-01 7:55 ` Christoph Hellwig
2010-06-01 11:55 ` Eric Paris
2010-06-01 14:52 ` Kees Cook
2010-06-01 15:34 ` Eric Paris
2010-06-01 17:31 ` tytso
2010-06-01 15:00 ` Kees Cook
2010-05-31 10:47 ` tytso
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=20100531041204.GR6056@outflux.net \
--to=kees.cook@canonical.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=ebiederm@xmission.com \
--cc=eparis@redhat.com \
--cc=hidave.darkstar@gmail.com \
--cc=jkosina@suse.cz \
--cc=jmorris@namei.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rdunlap@xenotime.net \
--cc=schwidefsky@de.ibm.com \
--cc=serue@us.ibm.com \
--cc=tim.gardner@canonical.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®