process:share condition on 2.6.x kernel
Hello, all.
I noticed that the condition of 'process:share' is never checked in 2.6.x kernel. Is it expected, or unexpected ?
Stephen D. Smalley wrote about the condition of 'share' in 23/Jan/2003. See, http://www.nsa.gov/selinux/list-archive/0301/3782.cfm
Quoted 8 lines
Quoted 2 lines
Is there a short answer of what process "share" permission controls? Nothing obvious in any reports. Thanks Frank
It is mentioned in the module technical report. It is checked when a process SID would change (due to an execve or
execve_secure) and the process shares state with its parent due to the prior use of clone(2) to create the process. See the man page for clone for detailed information about what can be shared.
The 'share' condition is checked in selinux_bprm_apply_creds() as an extension of execve() system call when the domain-transration is happened and LSM_UNSAFE_SHARE bit in the 'unsafe' variable is set.
Obviously, the domain-transition can happen according to the security-policy. But LSM_UNSAFE_SHARE bit is never set in 2.6.x, thus the 'share' condition is never evaluated, namely always ignored.
In 2.6.x implementation, de_thread() function is called from load_binary() method of the ELF,aout and so on when execve() is called.
When the current process contains some threads, de_thread() kills all the threads except 'current' in the same threads-group.
Then, compute_creds() function is called for the calculation of LSM_UNSAFE_SHARE. But the current process has already only a thread, so LSM_UNSAFE_SHARE is always unset.
The 'share' condition is ignored in 2.6.x in the result.
I think the 'share' condition is one of the historical inheritances and harmless, so this condition should be documented as it's a deprecated condition.
Is my understanding correct?
Thanks.
--------
Kai Gai <[email protected]>
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 17 lines · Kaigai Kohei
The 'share' condition is checked in
selinux_bprm_apply_creds()as an extension ofexecve()system call when the domain-transration is happened andLSM_UNSAFE_SHAREbit in the 'unsafe' variable is set.Obviously, the domain-transition can happen according to the security-policy. But
LSM_UNSAFE_SHAREbit is never set in 2.6.x, thus the 'share' condition is never evaluated, namely always ignored.In 2.6.x implementation,
de_thread()function is called fromload_binary()method of the ELF,aout and so on whenexecve()is called.
When the current process contains some threads,de_thread()kills all the threads except 'current' in the same threads-group.
Then,compute_creds()function is called for the calculation ofLSM_UNSAFE_SHARE. But the current process has already only a thread, soLSM_UNSAFE_SHAREis always unset.
The 'share' condition is ignored in 2.6.x in the result.
Quoted 4 lines
I think the 'share' condition is one of the historical inheritances and harmless, so this condition should be documented as it's a deprecated condition.
Is my understanding correct?
No. They can share state without being part of the same thread group, e.g. trying calling clone(2) with CLONE_FS and then exec'ing a domain-changing program.
Signature · 8 lines
Stephen Smalley <[email protected]> National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.