All of lore.kernel.org
 help / color / mirror / Atom feed
* selinux_inode_setsecurity and fsetxattr
@ 2008-01-18 16:40 Casey Schaufler
  2008-01-18 18:33 ` Stephen Smalley
  0 siblings, 1 reply; 5+ messages in thread
From: Casey Schaufler @ 2008-01-18 16:40 UTC (permalink / raw)
  To: SELinux List


I was looking in selinux_inode_setsecurity for my own
neffarious purposes and was curious what prevents a program
that has a file open from setting the context on the file
using fsetxattr. I confess that I haven't tried it to see
how it actually behaves.


Casey Schaufler
casey@schaufler-ca.com

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: selinux_inode_setsecurity and fsetxattr
  2008-01-18 16:40 selinux_inode_setsecurity and fsetxattr Casey Schaufler
@ 2008-01-18 18:33 ` Stephen Smalley
  2008-01-18 18:38   ` Casey Schaufler
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2008-01-18 18:33 UTC (permalink / raw)
  To: casey; +Cc: SELinux List


On Fri, 2008-01-18 at 08:40 -0800, Casey Schaufler wrote:
> I was looking in selinux_inode_setsecurity for my own
> neffarious purposes and was curious what prevents a program
> that has a file open from setting the context on the file
> using fsetxattr. I confess that I haven't tried it to see
> how it actually behaves.

Sorry, what's your question?  Of course you can relabel a file via
fsetxattr (if you pass the permission check, which is a different hook
called earlier).

-- 
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: selinux_inode_setsecurity and fsetxattr
  2008-01-18 18:33 ` Stephen Smalley
@ 2008-01-18 18:38   ` Casey Schaufler
  2008-01-18 18:46     ` Stephen Smalley
  0 siblings, 1 reply; 5+ messages in thread
From: Casey Schaufler @ 2008-01-18 18:38 UTC (permalink / raw)
  To: Stephen Smalley, casey; +Cc: SELinux List


--- Stephen Smalley <sds@tycho.nsa.gov> wrote:

> 
> On Fri, 2008-01-18 at 08:40 -0800, Casey Schaufler wrote:
> > I was looking in selinux_inode_setsecurity for my own
> > neffarious purposes and was curious what prevents a program
> > that has a file open from setting the context on the file
> > using fsetxattr. I confess that I haven't tried it to see
> > how it actually behaves.
> 
> Sorry, what's your question?  Of course you can relabel a file via
> fsetxattr (if you pass the permission check, which is a different hook
> called earlier).

In the case of fsetxattr, which hook would that be?


Casey Schaufler
casey@schaufler-ca.com

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: selinux_inode_setsecurity and fsetxattr
  2008-01-18 18:38   ` Casey Schaufler
@ 2008-01-18 18:46     ` Stephen Smalley
  2008-01-18 18:56       ` Casey Schaufler
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2008-01-18 18:46 UTC (permalink / raw)
  To: casey; +Cc: SELinux List


On Fri, 2008-01-18 at 10:38 -0800, Casey Schaufler wrote:
> --- Stephen Smalley <sds@tycho.nsa.gov> wrote:
> 
> > 
> > On Fri, 2008-01-18 at 08:40 -0800, Casey Schaufler wrote:
> > > I was looking in selinux_inode_setsecurity for my own
> > > neffarious purposes and was curious what prevents a program
> > > that has a file open from setting the context on the file
> > > using fsetxattr. I confess that I haven't tried it to see
> > > how it actually behaves.
> > 
> > Sorry, what's your question?  Of course you can relabel a file via
> > fsetxattr (if you pass the permission check, which is a different hook
> > called earlier).
> 
> In the case of fsetxattr, which hook would that be?

All three setxattr system calls ultimately call vfs_setxattr(), which
calls security_inode_setxattr() to check security module permissions.
If it passes that check, then it proceeds to the actual processing,
which follows different paths depending on whether the fs implements a
setxattr operation or not.

security_inode_setsecurity() is just the low level primitive for setting
the value in the in-core security structure and can be called either
from the vfs (as the fallback) or from the individual fs op (as in
tmpfs).  Originally only the latter before the vfs fallbacks were
introduced.

-- 
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: selinux_inode_setsecurity and fsetxattr
  2008-01-18 18:46     ` Stephen Smalley
@ 2008-01-18 18:56       ` Casey Schaufler
  0 siblings, 0 replies; 5+ messages in thread
From: Casey Schaufler @ 2008-01-18 18:56 UTC (permalink / raw)
  To: Stephen Smalley, casey; +Cc: SELinux List


--- Stephen Smalley <sds@tycho.nsa.gov> wrote:

> 
> On Fri, 2008-01-18 at 10:38 -0800, Casey Schaufler wrote:
> > --- Stephen Smalley <sds@tycho.nsa.gov> wrote:
> > 
> > > 
> > > On Fri, 2008-01-18 at 08:40 -0800, Casey Schaufler wrote:
> > > > I was looking in selinux_inode_setsecurity for my own
> > > > neffarious purposes and was curious what prevents a program
> > > > that has a file open from setting the context on the file
> > > > using fsetxattr. I confess that I haven't tried it to see
> > > > how it actually behaves.
> > > 
> > > Sorry, what's your question?  Of course you can relabel a file via
> > > fsetxattr (if you pass the permission check, which is a different hook
> > > called earlier).
> > 
> > In the case of fsetxattr, which hook would that be?
> 
> All three setxattr system calls ultimately call vfs_setxattr(), which
> calls security_inode_setxattr() to check security module permissions.
> If it passes that check, then it proceeds to the actual processing,
> which follows different paths depending on whether the fs implements a
> setxattr operation or not.
> 
> security_inode_setsecurity() is just the low level primitive for setting
> the value in the in-core security structure and can be called either
> from the vfs (as the fallback) or from the individual fs op (as in
> tmpfs).  Originally only the latter before the vfs fallbacks were
> introduced.

Thank you. That was what I was looking for.


Casey Schaufler
casey@schaufler-ca.com

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-01-18 18:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-18 16:40 selinux_inode_setsecurity and fsetxattr Casey Schaufler
2008-01-18 18:33 ` Stephen Smalley
2008-01-18 18:38   ` Casey Schaufler
2008-01-18 18:46     ` Stephen Smalley
2008-01-18 18:56       ` Casey Schaufler

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.