Skip to contentSkip to conversation

strange avc messages on oom

DISCUSSION Russell Coker 3 participants 5 messages May 4, 2003 – May 5, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

The following messages appeared after a kde process went into a loop and used all available memory. The kde process names /usr/bin/kdeinit had the context rjc:user_r:user_t. I don't know what pid 1169 was, but after logging out (killing all KDE processes) it was gone.

avc: denied { sys_admin } for pid=1169 exe=/usr/bin/kdeinit capability=21 scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t tclass=capability

avc: denied { sys_rawio } for pid=1169 exe=/usr/bin/kdeinit capability=17 scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t tclass=capability

avc: denied { sys_admin } for pid=1169 exe=/usr/bin/kdeinit capability=21 scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t tclass=capability
Out of Memory: Killed process 17695 (kdeinit).

Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
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.
#1 lore raw
Quoted 4 lines · Russell Coker

The following messages appeared after a kde process went into a loop and used all available memory. The kde process names /usr/bin/kdeinit had the context rjc:user_r:user_t. I don't know what pid 1169 was, but after logging out (killing all KDE processes) it was gone.

It just happened again. As you can see the PID and file name match up. The context does not match, and the operations requested don't match up with either.

root@lyta:~# dmesg | tail | grep ...
avc:  denied  { sys_admin } for  pid=9656 exe=/usr/bin/kalarmd capability=21 
scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t 
tclass=capability
avc:  denied  { sys_rawio } for  pid=9656 exe=/usr/bin/kalarmd capability=17 
scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t 
tclass=capability
avc:  denied  { sys_admin } for  pid=9656 exe=/usr/bin/kalarmd capability=21 
scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t 
tclass=capability
avc:  denied  { sys_rawio } for  pid=9656 exe=/usr/bin/kalarmd capability=17 
scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t 
tclass=capability
avc:  denied  { sys_admin } for  pid=9656 exe=/usr/bin/kalarmd capability=21 
scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t 
tclass=capability
Out of Memory: Killed process 10439 (kdeinit).
root@lyta:~# !ps
ps ax --context | grep 9656
 9656    576 rjc:user_r:user_t                        kalarmd --login
10465    575 rjc:sysadm_r:sysadm_t                    grep 9656
root@lyta:~#
Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
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.
#2 lore raw
In reply to Russell Coker
Quoted 4 lines · Russell Coker

avc: denied { sys_admin } for pid=1169 exe=/usr/bin/kdeinit capability=21 scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t tclass=capability

Quoted 8 lines

avc: denied { sys_rawio } for pid=1169 exe=/usr/bin/kdeinit capability=17 scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t tclass=capability

avc: denied { sys_admin } for pid=1169 exe=/usr/bin/kdeinit capability=21 scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t tclass=capability
Out of Memory: Killed process 17695 (kdeinit).

Do you have nscd loaded?

Just a guess: maybe the kernel is trying to swap code to/from the swap paritions, but for some reason in out-of-memory conditions cannot get the correct context, so just uses the existing context instead?

When the kernel reads/writes the swap parition, are these accesses checked by SE-Linux first?

Signature · 6 lines
Brian May <[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.
#3 lore raw
Quoted 1 line · Brian May

Do you have nscd loaded?

Yes, but it is not doing anything out of the ordinary.

Quoted 3 lines

Just a guess: maybe the kernel is trying to swap code to/from the swap paritions, but for some reason in out-of-memory conditions cannot get the correct context, so just uses the existing context instead?

Maybe, if so it's a bug.

Quoted 2 lines

When the kernel reads/writes the swap parition, are these accesses checked by SE-Linux first?

I don't know.

Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
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.
#4 lore raw
In reply to Russell Coker
Quoted 9 lines · Russell Coker

The following messages appeared after a kde process went into a loop and used all available memory. The kde process names /usr/bin/kdeinit had the context rjc:user_r:user_t. I don't know what pid 1169 was, but after logging out (killing all KDE processes) it was gone.

avc: denied { sys_admin } for pid=1169 exe=/usr/bin/kdeinit capability=21 scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t tclass=capability

Quoted 8 lines

avc: denied { sys_rawio } for pid=1169 exe=/usr/bin/kdeinit capability=17 scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t tclass=capability

avc: denied { sys_admin } for pid=1169 exe=/usr/bin/kdeinit capability=21 scontext=system_u:system_r:nscd_t tcontext=system_u:system_r:nscd_t tclass=capability
Out of Memory: Killed process 17695 (kdeinit).

The OOM killer (mm/oom_kill.c) performs CAP_SYS_ADMIN and CAP_SYS_RAWIO checks against each process as part of selecting a good process to kill when the system runs out of memory. The scontext and tcontext are the ones passed to the actual permission check, and correspond to the process that is being checked for capability checks. The pid and exe information are always derived from the current process, which in this case is not actually the one being checked. A similar issue shows up for some of the networking checks performed during network input processing. However, in the common case, the current process is relevant.

It would be possible to have the hook functions explicitly save the relevant process (task) in the audit data structure prior to invoking the permission check, and have the audit code use that passed information rather than relying on the current process.

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.