Skip to contentSkip to conversation

kernel daemons runs in init_t

DISCUSSION Carsten Grohmann 3 participants 7 messages Aug 28, 2002 – Aug 29, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

with the new release, all kernel daemons runs in the init_t domain. Is this a new feature or my mistake?
But I don't found any anormaly.

Carsten

--
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 3 lines · Carsten Grohmann

with the new release, all kernel daemons runs in the init_t domain. Is this a new feature or my mistake?
But I don't found any anormaly.

That does not appear to be the case. Below I have pasted ps output from one of my machines. kernel_t is used for threads started by the kernel itself, a raid1d thread is running as kernel_t because it was started from an initrd script (which entirely runs as kernel_t because I haven't finished my initrd policy), the other raid1d threads for my other RAID-1 arrays are in fsadm_t becase they are started by /sbin/raidstart which has context system_u:object_r:fsadm_exec_t and runs in fsadm_t. kSpeedSARd is started at module load time and runs in insmod_t.

Some other threads appear to have been started by /sbin/init which is why they have init_t.

  PID    SID CONTEXT                                  COMMAND
    1      7 system_u:system_r:init_t                 init [2]
    2      1 system_u:system_r:kernel_t               [keventd]
    3      1 system_u:system_r:kernel_t               [kapmd]
    4      7 system_u:system_r:init_t                 [ksoftirqd_CPU0]
    5      7 system_u:system_r:init_t                 [kswapd]
    6      7 system_u:system_r:init_t                 [bdflush]
    7      7 system_u:system_r:init_t                 [kupdated]
   19      1 system_u:system_r:kernel_t               [mdrecoveryd]
   22      7 system_u:system_r:init_t                 [khubd]
   31      1 system_u:system_r:kernel_t               [raid1d]
   40      1 system_u:system_r:kernel_t               [kreiserfsd]
  246    330 system_u:system_r:insmod_t               [kSpeedSARd]
  288    331 system_u:system_r:fsadm_t                [raid1d]
  298    331 system_u:system_r:fsadm_t                [raid1d]
Signature · 3 lines
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line

From field.

--
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
Quoted 7 lines · Russell Coker
  PID    SID CONTEXT                                  COMMAND
    1      7 system_u:system_r:init_t                 init [2]
    2      1 system_u:system_r:kernel_t               [keventd]
    3      1 system_u:system_r:kernel_t               [kapmd]
    4      7 system_u:system_r:init_t                 [ksoftirqd_CPU0]
    5      7 system_u:system_r:init_t                 [kswapd]
    6      7 system_u:system_r:init_t                 [bdflush]
Quoted 8 lines
    7      7 system_u:system_r:init_t                 [kupdated]
   19      1 system_u:system_r:kernel_t               [mdrecoveryd]
   22      7 system_u:system_r:init_t                 [khubd]
   31      1 system_u:system_r:kernel_t               [raid1d]
   40      1 system_u:system_r:kernel_t               [kreiserfsd]
  246    330 system_u:system_r:insmod_t               [kSpeedSARd]
  288    331 system_u:system_r:fsadm_t                [raid1d]
  298    331 system_u:system_r:fsadm_t                [raid1d]

I see something more like what Carsten describes:

    2      7 system_u:system_r:init_t                 [keventd]
    3      7 system_u:system_r:init_t                 [ksoftirqd_CPU0]
    4      7 system_u:system_r:init_t                 [kswapd]
    5      7 system_u:system_r:init_t                 [bdflush]
    6      7 system_u:system_r:init_t                 [kupdated]
    8      7 system_u:system_r:init_t                 [khubd]
   11      7 system_u:system_r:init_t                 [kjournald]
  133      7 system_u:system_r:init_t                 [kjournald]

The ps -el output shows all of these "processes" having a PPID of 1, i.e. init.

In part, the change may be due to the new hook in the kernel reparent_to_init function. This would affect the kjournald and khubd threads, since they call this function. But I don't think it fully explains the change, and it doesn't explain why you see kernel_t on some of the same threads.

--
Stephen D. Smalley, NAI Labs
[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 27 lines · Stephen Smalley
Quoted 7 lines · Russell Coker
  PID    SID CONTEXT                                  COMMAND
    1      7 system_u:system_r:init_t                 init [2]
    2      1 system_u:system_r:kernel_t               [keventd]
    3      1 system_u:system_r:kernel_t               [kapmd]
    4      7 system_u:system_r:init_t                 [ksoftirqd_CPU0]
    5      7 system_u:system_r:init_t                 [kswapd]
    6      7 system_u:system_r:init_t                 [bdflush]
Quoted 8 lines
    7      7 system_u:system_r:init_t                 [kupdated]
   19      1 system_u:system_r:kernel_t               [mdrecoveryd]
   22      7 system_u:system_r:init_t                 [khubd]
   31      1 system_u:system_r:kernel_t               [raid1d]
   40      1 system_u:system_r:kernel_t               [kreiserfsd]
  246    330 system_u:system_r:insmod_t               [kSpeedSARd]
  288    331 system_u:system_r:fsadm_t                [raid1d]
  298    331 system_u:system_r:fsadm_t                [raid1d]

I see something more like what Carsten describes:

    2      7 system_u:system_r:init_t                 [keventd]
    3      7 system_u:system_r:init_t                 [ksoftirqd_CPU0]
    4      7 system_u:system_r:init_t                 [kswapd]
    5      7 system_u:system_r:init_t                 [bdflush]
    6      7 system_u:system_r:init_t                 [kupdated]
    8      7 system_u:system_r:init_t                 [khubd]
   11      7 system_u:system_r:init_t                 [kjournald]
  133      7 system_u:system_r:init_t                 [kjournald]
Quoted 8 lines

The ps -el output shows all of these "processes" having a PPID of 1, i.e. init.

In part, the change may be due to the new hook in the kernel reparent_to_init function. This would affect the kjournald and khubd threads, since they call this function. But I don't think it fully explains the change, and it doesn't explain why you see kernel_t on some of the same threads.

I have just changed my policy to get the initrd thing working properly. Now I have a 20K policydb for the initrd which covers everything it does, so I get no AVC messages during the boot up and all the kernel threads are in the right context. See below:

PID SID CONTEXT COMMAND

    1      7 system_u:system_r:init_t                 init [2]
    2      7 system_u:system_r:init_t                 [keventd]
    3      7 system_u:system_r:init_t                 [kapmd]
    4      7 system_u:system_r:init_t                 [ksoftirqd_CPU0]
    5      7 system_u:system_r:init_t                 [kswapd]
    6      7 system_u:system_r:init_t                 [bdflush]
    7      7 system_u:system_r:init_t                 [kupdated]
   27     39 system_u:system_r:mount_t                [kreiserfsd]
  152      7 system_u:system_r:init_t                 [khubd]

I'll send a patch for this sometime soon, but it'll have to be cleaned up a bit first.

Signature · 3 lines
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line

From field.

--
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 Stephen Smalley
Quoted 10 lines · Russell Coker

PID SID CONTEXT COMMAND

    1      7 system_u:system_r:init_t                 init [2]
    2      7 system_u:system_r:init_t                 [keventd]
    3      7 system_u:system_r:init_t                 [kapmd]
    4      7 system_u:system_r:init_t                 [ksoftirqd_CPU0]
    5      7 system_u:system_r:init_t                 [kswapd]
    6      7 system_u:system_r:init_t                 [bdflush]
    7      7 system_u:system_r:init_t                 [kupdated]
   27     39 system_u:system_r:mount_t                [kreiserfsd]
  152      7 system_u:system_r:init_t                 [khubd]

Sorry I should have noted that the above is not from the same machine as the first one (this time it's a machine without software RAID and without speedtouch device driver). But apart from that it's quite a similar setup.

Signature · 3 lines
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line

From field.

--
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.

#5 lore raw
In reply to Carsten Grohmann
Quoted 3 lines · Carsten Grohmann

with the new release, all kernel daemons runs in the init_t domain. Is this a new feature or my mistake?
But I don't found any anormaly.

As I explained previously, it depends on the parent of the kernel thread. If the kernel thread's PPID is 1 (init), it should also be labeled with init_t. If the kernel thread's PPID is 0 (kernel), then it should also be labeled with kernel_t.

--
Stephen D. Smalley, NAI Labs
[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.

#6 lore raw

Am Mittwoch, 28. August 2002 22:08 schrieb Stephen Smalley:

Quoted 9 lines · Carsten Grohmann
Quoted 3 lines

with the new release, all kernel daemons runs in the init_t domain. Is this a new feature or my mistake?
But I don't found any anormaly.

As I explained previously, it depends on the parent of the kernel thread. If the kernel thread's PPID is 1 (init), it should also be labeled with init_t. If the kernel thread's PPID is 0 (kernel), then it should also be labeled with kernel_t.

Only I don't understand why changes the domain of some kernel threads between the to releases. During I use the July release, I have different domains for the kernel threads and now with the August release all kernel threads labelling as init_t. If you think all is correct, then I don't have a problem with this different domains.

The general README writes we should use "IP Networking Support" in the kernel. But I don't found this option. It is removed from the kernel? Then we could change the README too.

Thanks

Carsten

--
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.