Skip to contentSkip to conversation

noisy selinux messages on tmpfs mount.

DISCUSSION Dave Jones 7 participants 15 messages Jan 8, 2015 – Jan 12, 2015 SELinux security module

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

systemd has started mounting a tmpfs in /run/user/<uid> every time a session begins. So after ssh'ing into a box a number of times, dmesg looks like this..

[  929.892760] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[ 4529.025836] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[ 8129.170484] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[11729.313034] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[15329.471269] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[18929.613781] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[22529.759596] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[26129.890709] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[26669.001664] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[33328.937304] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[36929.064927] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[40529.178574] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[44129.301952] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[47729.424882] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[51329.287032] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[54929.563390] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[58529.857740] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[62128.992792] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs

What's a good solution to stopping this spew ? printk_once doesn't seem like a good fit, in case someone is doing different labelling behaviours between mounts.

Could we only print it if the mount is being done with non-default behaviour perhaps?

Dave

#1 lore raw
Quoted 6 lines · Dave Jones

systemd has started mounting a tmpfs in /run/user/<uid> every time a session begins. So after ssh'ing into a box a number of times, dmesg looks like this..

[...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs [...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs

{snip}

Quoted 6 lines

What's a good solution to stopping this spew ? printk_once doesn't seem like a good fit, in case someone is doing different labelling behaviours between mounts.

Could we only print it if the mount is being done with non-default behaviour perhaps?

I'm very curious to hear Stephen's opinion on the issue, but I wonder how much this would honestly impact us if we removed this message in the case where we mount the filesystem with a known labeling behavior.

Signature · 2 lines
paul moore
security @ redhat
author
#2 lore raw
Quoted 14 lines · Paul Moore
Quoted 6 lines · Dave Jones

systemd has started mounting a tmpfs in /run/user/<uid> every time a session begins. So after ssh'ing into a box a number of times, dmesg looks like this..

[...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs [...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs

{snip}

Quoted 4 lines

What's a good solution to stopping this spew ? printk_once doesn't seem like a good fit, in case someone is doing different labelling behaviours between mounts.

Quoted 6 lines
Quoted 2 lines

Could we only print it if the mount is being done with non-default behaviour perhaps?

I'm very curious to hear Stephen's opinion on the issue, but I wonder how much this would honestly impact us if we removed this message in the case where we mount the filesystem with a known labeling behavior.

It would help if I had cc'd Stephen's correct email address. Stephen, for context: https://lkml.org/lkml/2015/1/8/468

I figured there would be pushback from removing it entirely, which is why I didn't send the obvious patch.

Dave

#3 lore raw
In reply to Paul Moore
Quoted 14 lines · Paul Moore
Quoted 6 lines · Dave Jones

systemd has started mounting a tmpfs in /run/user/<uid> every time a session begins. So after ssh'ing into a box a number of times, dmesg looks like this..

[...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs [...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs

{snip}

Quoted 4 lines

What's a good solution to stopping this spew ? printk_once doesn't seem like a good fit, in case someone is doing different labelling behaviours between mounts.

Quoted 6 lines
Quoted 2 lines

Could we only print it if the mount is being done with non-default behaviour perhaps?

I'm very curious to hear Stephen's opinion on the issue, but I wonder how much this would honestly impact us if we removed this message in the case where we mount the filesystem with a known labeling behavior.

[NOTE: adding the SELinux list to the CC line.]

Signature · 2 lines
paul moore
security @ redhat
#4 lore raw

We already reduced that message to KERN_DEBUG. Is that not sufficient?

Quoted 33 lines · Paul Moore
Quoted 14 lines · Paul Moore
Quoted 6 lines · Dave Jones

systemd has started mounting a tmpfs in /run/user/<uid> every time a session begins. So after ssh'ing into a box a number of times, dmesg looks like this..

[...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs [...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs

{snip}

Quoted 4 lines

What's a good solution to stopping this spew ? printk_once doesn't seem like a good fit, in case someone is doing different labelling behaviours between mounts.

Quoted 6 lines
Quoted 2 lines

Could we only print it if the mount is being done with non-default behaviour perhaps?

I'm very curious to hear Stephen's opinion on the issue, but I wonder how much this would honestly impact us if we removed this message in the case where we mount the filesystem with a known labeling behavior.

[NOTE: adding the SELinux list to the CC line.]

--
paul moore
security @ redhat

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

author
#5 lore raw
Quoted 16 lines · Stephen Smalley
Quoted 15 lines · Paul Moore
Quoted 14 lines · Paul Moore
Quoted 6 lines · Dave Jones

systemd has started mounting a tmpfs in /run/user/<uid> every time a session begins. So after ssh'ing into a box a number of times, dmesg looks like this..

[...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs [...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs

{snip}

Quoted 4 lines

What's a good solution to stopping this spew ? printk_once doesn't seem like a good fit, in case someone is doing different labelling behaviours between mounts.

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Could we only print it if the mount is being done with non-default behaviour perhaps?

I'm very curious to hear Stephen's opinion on the issue, but I wonder how much this would honestly impact us if we removed this message in the case where we mount the filesystem with a known labeling behavior.

We already reduced that message to KERN_DEBUG. Is that not sufficient?

That doesn't really help with the flooding of dmesg, so no. I should also note that it's not just logging in that creates a new session, it also seems to be getting triggered by cron jobs, or whatever the systemd replacement is.

Dave

#6 lore raw
Quoted 25 lines · Dave Jones
Quoted 23 lines · Stephen Smalley
Quoted 21 lines · Paul Moore
Quoted 20 lines · Paul Moore
Quoted 6 lines · Dave Jones

systemd has started mounting a tmpfs in /run/user/<uid> every time a session begins. So after ssh'ing into a box a number of times, dmesg looks like this..

[...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs [...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs

{snip}

Quoted 6 lines

What's a good solution to stopping this spew ? printk_once doesn't seem like a good fit, in case someone is doing different labelling behaviours between mounts.

Could we only print it if the mount is being done with non-default behaviour perhaps?

I'm very curious to hear Stephen's opinion on the issue, but I wonder how much this would honestly impact us if we removed this message in the case where we mount the filesystem with a known labeling behavior.

Quoted 6 lines
Quoted 1 line

We already reduced that message to KERN_DEBUG. Is that not sufficient?

That doesn't really help with the flooding of dmesg, so no. I should also note that it's not just logging in that creates a new session, it also seems to be getting triggered by cron jobs, or whatever the systemd replacement is.

Fair enough. I think we can likely get rid of it then.

#10 lore raw
In reply to Dave Jones
Quoted 7 lines · Dave Jones
Quoted 1 line · Stephen Smalley

We already reduced that message to KERN_DEBUG. Is that not sufficient?

That doesn't really help with the flooding of dmesg, so no. I should also note that it's not just logging in that creates a new session, it also seems to be getting triggered by cron jobs, or whatever the systemd replacement is.

I wonder if this is cron/systemd/whatever creating a new namespace and mounting a new tmpfs in the namespace? If yes, I wonder if we could limit the messages to the initial namespace ... ?

Signature · 2 lines
paul moore
security @ redhat
#11 lore raw
Quoted 4 lines · Paul Moore
Quoted 3 lines · Dave Jones
Quoted 1 line · Stephen Smalley

We already reduced that message to KERN_DEBUG. Is that not sufficient?

Quoted 9 lines
Quoted 4 lines

That doesn't really help with the flooding of dmesg, so no. I should also note that it's not just logging in that creates a new session, it also seems to be getting triggered by cron jobs, or whatever the systemd replacement is.

I wonder if this is cron/systemd/whatever creating a new namespace and mounting a new tmpfs in the namespace? If yes, I wonder if we could limit the messages to the initial namespace ... ?

It is systemd logind creating sessions (e.g. creating /run/user/$UID and mounting a tmpfs on it)

maintainer
#12 lore raw

systemd has taken over cron too? I suppose that is a logical extension, but still...

--
paul moore
www.paul-moore.com

Quoted 27 lines · Dominick Grift
Quoted 11 lines · Paul Moore
Quoted 7 lines · Dave Jones
Quoted 1 line · Stephen Smalley

We already reduced that message to KERN_DEBUG. Is that not sufficient?

That doesn't really help with the flooding of dmesg, so no. I should also note that it's not just logging in that creates a new session, it also seems to be getting triggered by cron jobs, or whatever the systemd replacement is.

I wonder if this is cron/systemd/whatever creating a new namespace and mounting a new tmpfs in the namespace? If yes, I wonder if we could

limit the

Quoted 2 lines

messages to the initial namespace ... ?

It is systemd logind creating sessions (e.g. creating /run/user/$UID and mounting a tmpfs on it)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#13 lore raw
Quoted 2 lines · Paul Moore

systemd has taken over cron too? I suppose that is a logical extension, but still...

That is were i think davej is wrong. Here is what i think is the scenario with cron.

Cron runs jobs on behalf root. Root is generally not logged in all the time. So every time cron performs a job on behalf of root (hourly etc), systemd logind creates /run/user/0 and mounts tmpfs on it, when the job is done, tmpfs is unmounted and /run/user/= removed.

In that sense cron acts as kind of a login program.

Where i think davej might be wrong is that this would also happen with systemd's replacement for cron: timers.

I suspect that systemd logind does not create 0 user runtime directory everytime a timer is triggered, as opposed to cron.

with regard to normal user timers.Those really only work if you enable lingering on the systemd --user daemon with logind. This means that in practice the user is always logged in from a systemd logind user runtime directory point of view (e.g. /run/user/$UID is always there for a user that has a lingering systemd session daemon instance)

In practice , i suspect that this means that, although now with cron were seeing logind mount tmpfs whenever some job of behalf of root is run if root is not physically loged in (which is often), that this would not be the case if we got rid of cron and if it would be replaced by systemd timers

One might ask the question: why does logind create a root user runtime directory every time cron runs a job on behalf of root. Is that really required?

Quoted 38 lines

--
paul moore
www.paul-moore.com

Quoted 27 lines · Dominick Grift
Quoted 11 lines · Paul Moore
Quoted 7 lines · Dave Jones
Quoted 1 line · Stephen Smalley

We already reduced that message to KERN_DEBUG. Is that not sufficient?

That doesn't really help with the flooding of dmesg, so no. I should also note that it's not just logging in that creates a new session, it also seems to be getting triggered by cron jobs, or whatever the systemd replacement is.

I wonder if this is cron/systemd/whatever creating a new namespace and mounting a new tmpfs in the namespace? If yes, I wonder if we could

limit the

Quoted 2 lines

messages to the initial namespace ... ?

It is systemd logind creating sessions (e.g. creating /run/user/$UID and mounting a tmpfs on it)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#14 lore raw
Quoted 32 lines · Dominick Grift
Quoted 2 lines · Paul Moore

systemd has taken over cron too? I suppose that is a logical extension, but still...

That is were i think davej is wrong. Here is what i think is the scenario with cron.

Cron runs jobs on behalf root. Root is generally not logged in all the time. So every time cron performs a job on behalf of root (hourly etc), systemd logind creates /run/user/0 and mounts tmpfs on it, when the job is done, tmpfs is unmounted and /run/user/= removed.

In that sense cron acts as kind of a login program.

Where i think davej might be wrong is that this would also happen with systemd's replacement for cron: timers.

I suspect that systemd logind does not create 0 user runtime directory everytime a timer is triggered, as opposed to cron.

with regard to normal user timers.Those really only work if you enable lingering on the systemd --user daemon with logind. This means that in practice the user is always logged in from a systemd logind user runtime directory point of view (e.g. /run/user/$UID is always there for a user that has a lingering systemd session daemon instance)

In practice , i suspect that this means that, although now with cron were seeing logind mount tmpfs whenever some job of behalf of root is run if root is not physically loged in (which is often), that this would not be the case if we got rid of cron and if it would be replaced by systemd timers

Quoted 4 lines

One might ask the question: why does logind create a root user runtime directory every time cron runs a job on behalf of root. Is that really required?

Never the less. On systems with many users login and out regularly you will see this message often. because when a user logs in /run/user/$UID is created and tmpfs is mounted on it. When the user logs out tmpfs is unmounted, and /run/user/$UID is removed ... unless that users' systemd --user instance is lingering.

Quoted 40 lines
Quoted 38 lines

--
paul moore
www.paul-moore.com

Quoted 27 lines · Dominick Grift
Quoted 11 lines · Paul Moore
Quoted 7 lines · Dave Jones
Quoted 1 line · Stephen Smalley

We already reduced that message to KERN_DEBUG. Is that not sufficient?

That doesn't really help with the flooding of dmesg, so no. I should also note that it's not just logging in that creates a new session, it also seems to be getting triggered by cron jobs, or whatever the systemd replacement is.

I wonder if this is cron/systemd/whatever creating a new namespace and mounting a new tmpfs in the namespace? If yes, I wonder if we could

limit the

Quoted 2 lines

messages to the initial namespace ... ?

It is systemd logind creating sessions (e.g. creating /run/user/$UID and mounting a tmpfs on it)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw
In reply to Stephen Smalley
Quoted 26 lines · Stephen Smalley
Quoted 25 lines · Dave Jones
Quoted 23 lines · Stephen Smalley
Quoted 21 lines · Paul Moore
Quoted 20 lines · Paul Moore
Quoted 6 lines · Dave Jones

systemd has started mounting a tmpfs in /run/user/<uid> every time a session begins. So after ssh'ing into a box a number of times, dmesg looks like this..

[...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs [...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs

{snip}

Quoted 6 lines

What's a good solution to stopping this spew ? printk_once doesn't seem like a good fit, in case someone is doing different labelling behaviours between mounts.

Could we only print it if the mount is being done with non-default behaviour perhaps?

I'm very curious to hear Stephen's opinion on the issue, but I wonder how much this would honestly impact us if we removed this message in the case where we mount the filesystem with a known labeling behavior.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

We already reduced that message to KERN_DEBUG. Is that not sufficient?

That doesn't really help with the flooding of dmesg, so no. I should also note that it's not just logging in that creates a new session, it also seems to be getting triggered by cron jobs, or whatever the systemd replacement is.

Fair enough. I think we can likely get rid of it then.

Are you saying completely get rid of the message in all cases? If so, how is a user supposed to debug situations where they mount a filesystem and labeling doesn't work (i.e. no security label support or policy hasn't been updated for that fs)? Is there going to be another place to look see what the labeling behavior is for all mounted filesystems?

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#8 lore raw
Quoted 7 lines · Christopher J. PeBenito
Quoted 6 lines · Stephen Smalley
Quoted 4 lines · Dave Jones

That doesn't really help with the flooding of dmesg, so no. I should also note that it's not just logging in that creates a new session, it also seems to be getting triggered by cron jobs, or whatever the systemd replacement is.

Quoted 6 lines
Quoted 1 line

Fair enough. I think we can likely get rid of it then.

Are you saying completely get rid of the message in all cases? If so, how is a user supposed to debug situations where they mount a filesystem and labeling doesn't work (i.e. no security label support or policy hasn't been updated for that fs)?

I'm pretty sure Stephen just meant the normal case, not the "unknown behavior" case.

Quoted 2 lines

Is there going to be another place to look see what the labeling behavior is for all mounted filesystems?

I imagine we could create something in securityfs for that, you want to write a patch Chris? :)

Signature · 2 lines
paul moore
security @ redhat
#9 lore raw
In reply to Christopher J. PeBenito
Quoted 34 lines · Christopher J. PeBenito
Quoted 33 lines · Stephen Smalley
Quoted 31 lines · Dave Jones
Quoted 16 lines · Stephen Smalley
Quoted 15 lines · Paul Moore
Quoted 14 lines · Paul Moore
Quoted 6 lines · Dave Jones

systemd has started mounting a tmpfs in /run/user/<uid> every time a session begins. So after ssh'ing into a box a number of times, dmesg looks like this..

[...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs [...] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs

{snip}

Quoted 4 lines

What's a good solution to stopping this spew ? printk_once doesn't seem like a good fit, in case someone is doing different labelling behaviours between mounts.

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Could we only print it if the mount is being done with non-default behaviour perhaps?

I'm very curious to hear Stephen's opinion on the issue, but I wonder how much this would honestly impact us if we removed this message in the case where we mount the filesystem with a known labeling behavior.

We already reduced that message to KERN_DEBUG. Is that not sufficient?

That doesn't really help with the flooding of dmesg, so no. I should also note that it's not just logging in that creates a new session, it also seems to be getting triggered by cron jobs, or whatever the systemd replacement is.

Quoted 7 lines
Quoted 1 line

Fair enough. I think we can likely get rid of it then.

Are you saying completely get rid of the message in all cases? If so, how is a user supposed to debug situations where they mount a filesystem and labeling doesn't work (i.e. no security label support or policy hasn't been updated for that fs)? Is there going to be another place to look see what the labeling behavior is for all mounted filesystems?

In most cases, they can extract the information directly from the policy via seinfo or their favorite policy tool. For mountpoint labeling, the printk in question only tells them that mountpoint labeling was used, not the specific option and value, so reading /proc/self/mounts is more informative. /proc/self/mounts will also tell them whether the filesystem "supports" labeling via the seclabel option. So I don't believe it offers us any information that isn't available elsewhere.