Re: Upstream first policy

From: Linus Torvalds
Date: Mon Mar 08 2010 - 18:38:59 EST




On Mon, 8 Mar 2010, Rik van Riel wrote:
>
> On the other hand, '/etc/shadow' has the opposite constraint,
> where the system will not trust most of the applications with
> the data from that file.

Umm. No.

/etc/shadow is in no way at all different from /etc/passwd. Both of them
have pathname-based security issues. The fact that both of them _also_
have content-based security issues is an independent issue that I just
assumed everybody would take for granted.

Clearly I assumed too much.

So I was assuming that everybody realized that the normal inode-based UNIX
security obviously means that you can only open /etc/passwd read-only as
any normal user (and not open /etc/shadow at all: but that is in _no_ way
different from /etc/passwd).

That's an example of non-pathname-based security, where you actually mark
the content itself restricted some way. It's very naturally done with
labels on the inode itself. It's what UNIX has _always_ done

Nobody has ever suggested removing that. That would be crazy.

But that thing is _independent_ from the other totally unrelated issue,
namely the fact that "/etc/passwd" is a special name in the namespace. In
other words, there is "content security", but then there is also
"namespace security".

Of course, you can make /etc unwritable, and that is indeed the
traditional UNIX model of handling namespace security: by just
implementing it as "content security" of the directory.

The sgid and sticky bits can be used to further try to make it more
fine-grained (exactly becuase it is _not_ sufficient to say "you can't
read or write this directory" on a whole-directory basis), and obviously
SELinux has extensions of its own too.

Can you really not see the difference between security of naming thigns
certain things (like "/etc/passwd") - pathname based issues - and the
separate security of limiting access to any named device - actual markings
on the inode itself?

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/