All of lore.kernel.org
 help / color / mirror / Atom feed
* dynamic context transitions from kernel space
@ 2009-04-15 10:48 Fedor Sakharov
  2009-04-15 12:59 ` Stephen Smalley
  0 siblings, 1 reply; 2+ messages in thread
From: Fedor Sakharov @ 2009-04-15 10:48 UTC (permalink / raw)
  To: selinux

Hello,

Is it possible to somehow use the setcon() from the kernel space? Or is 
there any other way of changing the current context of the process from 
kernel? I need this for building a module that would monitor the 
execution of app and switch it's rights depending on the current branch 
of code being executed.

Fedor Sakharov

--
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] 2+ messages in thread

* Re: dynamic context transitions from kernel space
  2009-04-15 10:48 dynamic context transitions from kernel space Fedor Sakharov
@ 2009-04-15 12:59 ` Stephen Smalley
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Smalley @ 2009-04-15 12:59 UTC (permalink / raw)
  To: Fedor Sakharov; +Cc: selinux

On Wed, 2009-04-15 at 14:48 +0400, Fedor Sakharov wrote:
> Hello,
> 
> Is it possible to somehow use the setcon() from the kernel space? Or is 
> there any other way of changing the current context of the process from 
> kernel? I need this for building a module that would monitor the 
> execution of app and switch it's rights depending on the current branch 
> of code being executed.

setcon(3) is a libselinux function that just writes the context string
to /proc/self/attr/current.  Within the kernel, the proc filesystem
invokes the security_setprocattr() LSM hook interface, which then calls
selinux_setprocattr() if SELinux is enabled.

I doubt you want to just call security_setprocattr() though.  You may
wish to look at the example of cachefiles and how it overrides
credentials.

-- 
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] 2+ messages in thread

end of thread, other threads:[~2009-04-15 12:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-15 10:48 dynamic context transitions from kernel space Fedor Sakharov
2009-04-15 12:59 ` Stephen Smalley

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.