mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>, James Morris <jmorris@namei.org>,
	linux-kernel@vger.kernel.org, Kyle McMartin <kyle@mcmartin.ca>,
	Alexander Viro <viro@ftp.linux.org.uk>
Subject: Re: Upstream first policy
Date: Mon, 8 Mar 2010 19:08:57 +0000	[thread overview]
Message-ID: <20100308190857.400bde09@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <alpine.LFD.2.00.1003080948060.3989@localhost.localdomain>

> Things like "/etc/passwd" really are about the _pathname_, not the inode. 
> It really is the _path_ that is special, because that is fundamentally the 
> thing you trust.

Why can I trust the path ?

> But it's not actually _true_ in any deeper sense. You're really just 
> trying to enforce a pathname-based model using a inode/content based 
> security hammer.

Quite untrue. I've actually *used* path based security systems (DEC10
ACLs) and for almost every case its brain-dead.

Imagine a world where this happened

	echo "hello" > fred
	chmod 666 fred
	ls -l fred
	fred rw-rw-rw-
	mv fred bill
	ls -l bill
	bill rw-------

week later
	vi fred
	ls -l fred
	fred rw-rw-rw-

Your password file is a special case

> And when you base your security on inodes, you _do_ have problems with 
> things like /etc. Exactly because there are many different paths in that 
> directory, and they actually have _different_ security issues. A program 
> that is supposed to be able to edit/replace /etc/hosts is _not_ supposed 
> to be able to edit/replace /etc/passwd.

In a secure system I don't just care if its called /etc/passwd. I care
that whoever made changes to it was trusted to do so and furthermore that
the suid binary, the libraries it relies upon and the other points of
trust that matter. Real security is *not* a file permissions system its a
trust model including things like integrity validation.

Another reason this is true is how passwd is updated - the tool creates
a new file of some name like passwd.tmp and does processing into that,
then renames it over the top. If I break passwd.tmp then you'll trust the
result "because it's called passwd", while a system that keeps
permissions and labels attached to the object will not because someone
tampered with the object that became passwd.

> Notice how it's really fundamentally about the pathname? When you create a 
> new file and overwrite /etc/passwd with that file, the security rules 
> really do _not_ come from your newly created inode, they come from the 
> fact that you made the path "/etc/passwd" point to that inode.

No - they come from whatever created or modified the file. It doesn't
matter what an object is called if I need to know whether the data in it
is honest.

> You end up making up new ideas to handle this: it's why traditional BSD 
> UNIX security has the setgid and sticky bit on directories, and it's also 
> obviously why selinux ends up having special rules for "link" and "rename" 
> etc - exactly so that you can emulate security that is really 
> fundamentally about the pathname.

The directory bits move with the directory - they are object
permissions to retrofit delete permission (a gap in the original
Unix design) and a very crude inheritance hack.

They are not about paths. If you mv a file into a directory with these
properties they don't magically inherit the properties.

> the file. The _fundamental_ rule is about the pathname. The labeling comes 
> about BECAUSE YOU USED A HAMMER FOR A SCREW.
> 
> I really don't understand why some people are unable to admit this fact. 

Perhaps because
- They understand what they are talking about and have studied the
  research
- They've got a grasp of the mathematical/logical models that this is all
  based upon
- They know the difference between access control lists and security
  models
- They aren't so arrogant as to assume that using the capslock key
  overrides fifty years of research

??

Alan

  parent reply	other threads:[~2010-03-08 19:09 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-07 21:23 James Morris
2010-03-07 21:31 ` Linus Torvalds
2010-03-07 21:36   ` Linus Torvalds
2010-03-08  9:46 ` Ingo Molnar
2010-03-08 17:30   ` Alan Cox
2010-03-08 18:08     ` Linus Torvalds
2010-03-08 18:45       ` Al Viro
2010-03-08 18:53         ` Al Viro
2010-03-08 18:59         ` Linus Torvalds
2010-03-08 19:15           ` Linus Torvalds
2010-03-08 19:17           ` Alan Cox
2010-03-08 19:32             ` Linus Torvalds
2010-03-09  0:48               ` Kyle McMartin
2010-03-08 21:20             ` Chris Adams
2010-03-08 19:18           ` Al Viro
2010-03-09  1:18           ` Luca Barbieri
2010-03-09  1:25             ` Al Viro
2010-03-09  1:51               ` Luca Barbieri
2010-03-09  1:55                 ` Al Viro
2010-03-09  2:09                   ` Luca Barbieri
2010-03-08 19:08       ` Alan Cox [this message]
2010-03-08 19:18         ` Linus Torvalds
2010-03-08 19:27           ` Alan Cox
2010-03-08 19:34             ` Linus Torvalds
2010-03-09  7:29               ` Ingo Molnar
2010-03-09  8:46                 ` Dave Airlie
2010-03-09 14:58                   ` Ulrich Drepper
2010-03-08 23:02           ` Eric W. Biederman
2010-03-08 23:18             ` Eric Paris
2010-03-09 15:16               ` Florian Mickler
2010-03-09 22:49             ` Alan Cox
2010-03-11  3:52               ` Eric W. Biederman
2010-03-08 22:12       ` Ulrich Drepper
2010-03-08 23:12         ` Eric Paris
2010-03-08 23:21           ` Linus Torvalds
2010-03-08 23:18       ` Rik van Riel
2010-03-08 23:37         ` Linus Torvalds
2010-03-08 23:51           ` Rik van Riel
2010-03-09  0:10             ` Linus Torvalds
2010-03-09  3:26               ` Casey Schaufler
2010-03-09  3:58                 ` Linus Torvalds
2010-03-09 13:09                   ` Samir Bellabes
2010-03-09  0:15           ` Al Viro
2010-03-09  0:48             ` Al Viro
2010-03-09  1:49               ` Linus Torvalds
2010-03-09  2:05                 ` Al Viro
2010-03-09  2:18                   ` Linus Torvalds
2010-03-23 13:59     ` Pavel Machek
     [not found] <elwcV-406-1@gated-at.bofh.it>
     [not found] ` <elHL4-42q-5@gated-at.bofh.it>
     [not found]   ` <elP5U-6Ku-29@gated-at.bofh.it>
     [not found]     ` <elPyV-7zE-7@gated-at.bofh.it>
     [not found]       ` <elQbE-8ll-7@gated-at.bofh.it>
     [not found]       ` <elQv0-vu-13@gated-at.bofh.it>
     [not found]         ` <elQEG-Hn-33@gated-at.bofh.it>
2010-03-08 19:40           ` James Kosin
  -- strict thread matches above, loose matches on Subject: below --
2010-03-04 18:39 [git pull] drm request 3 Jesse Barnes
2010-03-04 18:51 ` Linus Torvalds
2010-03-04 18:56   ` Jesse Barnes
2010-03-04 19:08     ` Linus Torvalds
2010-03-04 19:25       ` Dave Airlie
2010-03-04 20:01         ` Linus Torvalds
2010-03-04 22:06           ` Dave Airlie
2010-03-05  0:08             ` Linus Torvalds
2010-03-05  0:28               ` Ben Skeggs
2010-03-05  0:41                 ` Linus Torvalds
2010-03-05  1:19                   ` Upstream first policy Kyle McMartin
2010-03-05  1:28                     ` Linus Torvalds

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=20100308190857.400bde09@lxorguk.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=jmorris@namei.org \
    --cc=kyle@mcmartin.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ftp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome