selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: casey.schaufler@intel.com, James Morris <jmorris@namei.org>,
	linux-security-module@vger.kernel.org, selinux@vger.kernel.org,
	linux-audit@redhat.com, keescook@chromium.org,
	john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp,
	Stephen Smalley <sds@tycho.nsa.gov>
Subject: Re: [PATCH v28 22/25] Audit: Add record for multiple process LSM attributes
Date: Wed, 18 Aug 2021 20:47:29 -0400	[thread overview]
Message-ID: <CAHC9VhT=QL5pKekaPB-=LDzU3hck9nXDiL5n1-upSqPg3gq=7w@mail.gmail.com> (raw)
In-Reply-To: <062ba5f9-e4e8-31f4-7815-826f44b35654@schaufler-ca.com>

On Wed, Aug 18, 2021 at 5:59 PM Casey Schaufler <casey@schaufler-ca.com> wrote:
>
> On 8/16/2021 11:57 AM, Paul Moore wrote:
> > On Fri, Aug 13, 2021 at 5:47 PM Casey Schaufler <casey@schaufler-ca.com> wrote:
> >> On 8/13/2021 1:43 PM, Paul Moore wrote:
> ...
> > Yeah, the thought occurred to me, but we are clearly already in the
> > maybe-the-assumptions-are-wrong stage so I'm not going to rely on that
> > being 100%.  We definitely need to track this down before we start
> > making to many more guesses about what is working and what is not.
>
> I've been tracking down where the audit context isn't set where
> we'd expect it to be, I've identified 5 cases:
>
>         1000    AUDIT_GET               - Get Status
>         1001    AUDIT_SET               - Set status enable/disable/auditd
>         1010    AUDIT_SIGNAL_INFO
>         1130    AUDIT_SERVICE_START
>         1131    AUDIT_SEVICE_STOP
>
> These are all events that relate to the audit system itself.
> It seems plausible that these really aren't syscalls and hence
> shouldn't be expected to have an audit_context. I will create a
> patch that treats these as the special cases I believe them to be.

Yes, all but two of these could be considered to be audit subsystem
control messages, but AUDIT_SERVICE_{START,STOP} I think definitely
fall outside the audit subsystem control message category.  The
AUDIT_SERVICE_{START,STOP} records are used to indicate when a
service, e.g. NetworkManager, starts and stops; on my fedora test
system they are generated by systemd since it manages service state on
that system; a quick example is below, but I'm sure you've seen plenty
of these already.

% ausearch -m SERVICE_START
time->Wed Aug 18 20:13:00 2021
type=SERVICE_START msg=audit(1629331980.779:1186): pid=1 uid=0 auid=4294967295 s
es=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatch
er comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? re
s=success'

However, regardless of if the message is related to controlling the
audit subsystem or not, we do want to be able to associate those
records with other related records, e.g. SYSCALL records.  Looking at
the message types you listed above, they are all records that are
triggered by userspace via netlink messages; if you haven't already I
would start poking along that code path to see if something looks
awry.

I just spent a few minutes tracing the code paths up from audit
through netlink and then through the socket layer and I'm not seeing
anything obvious where the path differs from any other syscall;
current->audit_context *should* be valid just like any other syscall.
However, I do have to ask, are you only seeing these audit records
with a current->audit_context equal to NULL during early boot?

-- 
paul moore
www.paul-moore.com

  reply	other threads:[~2021-08-19  0:47 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210722004758.12371-1-casey.ref@schaufler-ca.com>
2021-07-22  0:47 ` [PATCH v28 00/25] LSM: Module stacking for AppArmor Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 01/25] LSM: Infrastructure management of the sock security Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 02/25] LSM: Add the lsmblob data structure Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 03/25] LSM: provide lsm name and id slot mappings Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 04/25] IMA: avoid label collisions with stacked LSMs Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 05/25] LSM: Use lsmblob in security_audit_rule_match Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 06/25] LSM: Use lsmblob in security_kernel_act_as Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 07/25] LSM: Use lsmblob in security_secctx_to_secid Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 08/25] LSM: Use lsmblob in security_secid_to_secctx Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 09/25] LSM: Use lsmblob in security_ipc_getsecid Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 10/25] LSM: Use lsmblob in security_task_getsecid Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 11/25] LSM: Use lsmblob in security_inode_getsecid Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 12/25] LSM: Use lsmblob in security_cred_getsecid Casey Schaufler
2021-07-23 23:56     ` kernel test robot
2021-07-22  0:47   ` [PATCH v28 13/25] IMA: Change internal interfaces to use lsmblobs Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 14/25] LSM: Specify which LSM to display Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 15/25] LSM: Ensure the correct LSM context releaser Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 16/25] LSM: Use lsmcontext in security_secid_to_secctx Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 17/25] LSM: Use lsmcontext in security_inode_getsecctx Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 18/25] LSM: security_secid_to_secctx in netlink netfilter Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 19/25] NET: Store LSM netlabel data in a lsmblob Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 20/25] LSM: Verify LSM display sanity in binder Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 21/25] audit: support non-syscall auxiliary records Casey Schaufler
2021-07-22 17:02     ` kernel test robot
2021-07-22  0:47   ` [PATCH v28 22/25] Audit: Add record for multiple process LSM attributes Casey Schaufler
2021-08-12 20:59     ` Paul Moore
2021-08-12 22:38       ` Casey Schaufler
2021-08-13 15:31         ` Paul Moore
2021-08-13 18:48           ` Casey Schaufler
2021-08-13 20:43             ` Paul Moore
2021-08-13 21:47               ` Casey Schaufler
2021-08-16 18:57                 ` Paul Moore
2021-08-18 21:59                   ` Casey Schaufler
2021-08-19  0:47                     ` Paul Moore [this message]
2021-08-19  0:56                       ` Casey Schaufler
2021-08-19 22:41                         ` Casey Schaufler
2021-08-20 19:06                           ` Paul Moore
2021-08-20 19:17                             ` Casey Schaufler
2021-08-20 23:48                               ` Casey Schaufler
2021-08-24 14:45                                 ` Paul Moore
2021-08-24 15:20                                   ` Casey Schaufler
2021-08-24 16:14                                     ` Paul Moore
2021-07-22  0:47   ` [PATCH v28 23/25] Audit: Add record for multiple object " Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 24/25] LSM: Add /proc attr entry for full LSM context Casey Schaufler
2021-07-22  0:47   ` [PATCH v28 25/25] AppArmor: Remove the exclusive flag Casey Schaufler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHC9VhT=QL5pKekaPB-=LDzU3hck9nXDiL5n1-upSqPg3gq=7w@mail.gmail.com' \
    --to=paul@paul-moore.com \
    --cc=casey.schaufler@intel.com \
    --cc=casey@schaufler-ca.com \
    --cc=jmorris@namei.org \
    --cc=john.johansen@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linux-audit@redhat.com \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).