Bug 1195330 - systemd is sending wrong audit event
Summary: systemd is sending wrong audit event
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 30
Hardware: Unspecified
OS: Linux
high
medium
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-23 15:30 UTC by Steve Grubb
Modified: 2020-05-26 14:41 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-26 14:41:28 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
untested patch to fix the issue (2.89 KB, patch)
2015-02-24 02:04 UTC, Zbigniew Jędrzejewski-Szmek
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1197886 0 unspecified CLOSED SELinux policy change not not visible to systemd until daemon-reexec 2021-02-22 00:41:40 UTC

Internal Links: 1197886

Description Steve Grubb 2015-02-23 15:30:41 UTC
Description of problem:
Systemd is sending this event on selinux policy update:

type=USER_AVC msg=audit(1424436728.229:7283): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  received policyload notice (seqno=2)  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

This is completely the wrong thing to do. First, it should be a USER_MAC_POLICY_LOAD event. Example event can be found here:

http://selinuxproject.org/page/NB_AL#General_SELinux_Audit_Events

Comment 1 Zbigniew Jędrzejewski-Szmek 2015-02-24 02:04:59 UTC
Created attachment 994568 [details]
untested patch to fix the issue

Does this patch (only compile tested) look like it does the right thing?

Comment 2 Steve Grubb 2015-03-04 13:23:08 UTC
Looking at the patch, I don't know where type gets set. It should be getting set to AUDIT_USER_MAC_POLICY_LOAD. I also don't know what the content of buffer holds. Can you trigger a policy reload and paste the event in here? That would be very helpful. Also, thanks for quick turn around on this. Its very much appreciated. (I've been out on PTO lately.)

Comment 3 Zbigniew Jędrzejewski-Szmek 2015-04-15 01:07:42 UTC
Comment on attachment 994568 [details]
untested patch to fix the issue

This patch was wrong...

Basically, libselinux is designed so that all event types are logged using the same logging callback. There is a type parameter (SELINUX_AVC, SELINUX_INFO, SELINUX_WARNING, SELINUX_ERROR), but it does not map to audit event types in any way that I can see. E.g. checks are logged using SELINUX_INFO and SELINUX_AVC if there's a denial, policy reloads are logged using SELINUX_INFO, etc. Since we always needs to specify an audit event type when logging to audit, we could either use the same audit event type for all events, or make one up, or not log to audit at all, or maybe log to audit only SELINUX_AVC events. Currently we are using option one, and it seems to be the best option, because it gives us working audit logging, albeit with wrong event codes.

I'm inclined to close this as CANTFIX, unless you have an idea how to implement this differently.

Comment 4 Zbigniew Jędrzejewski-Szmek 2015-04-15 01:10:53 UTC
For example, the log line from comment #c1 comes straight from libselinux:

     avc_log(SELINUX_INFO,
            "%s:  received policyload notice (seqno=%u)\n",
             avc_prefix, msg->seqno);

The is no way to map this back to USER_MAC_POLICY_LOAD in the logging callback.

Comment 5 Steve Grubb 2015-07-14 15:21:02 UTC
I'd suggest not using libselinux to do this and use audit_log_user_message() instead.

Comment 6 Fedora End Of Life 2015-11-04 15:27:44 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Laurent Bigonville 2015-11-05 23:50:10 UTC
Apparently X is doing something similar to properly set the type of the event:

http://cgit.freedesktop.org/xorg/xserver/tree/Xext/xselinux_hooks.c#n300

Comment 8 Laurent Bigonville 2015-11-06 17:32:26 UTC
I've posted a question on the selinux mailing list to have their opinion:

https://marc.info/?l=selinux&m=144682738423855&w=2

====
From: Stephen Smalley <sds () tycho ! nsa ! gov>

I think when they introduced the audit support, they should have added a 
new type value in libselinux for MAC_POLICY_LOAD, and then they could 
have handled this cleanly in their callback functions.  That is what I 
would do.  I guess now we have to figure out how to do so compatibly...

===

Comment 9 Jan Kurik 2016-02-24 15:47:44 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 10 Fedora End Of Life 2017-07-25 18:50:23 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 11 Steve Grubb 2017-07-27 20:36:45 UTC
problem still exists.

Comment 12 Jan Kurik 2017-08-15 09:06:31 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 13 Ben Cotton 2018-11-27 18:30:47 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 14 Steve Grubb 2018-11-27 19:29:25 UTC
Problem still exists

Comment 15 Ben Cotton 2019-02-19 17:11:55 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 30 development cycle.
Changing version to '30.

Comment 16 Ben Cotton 2020-04-30 22:17:07 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '30'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 30 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 17 Ben Cotton 2020-05-26 14:41:28 UTC
Fedora 30 changed to end-of-life (EOL) status on 2020-05-26. Fedora 30 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.