From: Casey Schaufler <casey@schaufler-ca.com>
To: casey@schaufler-ca.com, paul@paul-moore.com,
linux-security-module@vger.kernel.org
Cc: jmorris@namei.org, serge@hallyn.com, keescook@chromium.org,
john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp,
stephen.smalley.work@gmail.com, linux-kernel@vger.kernel.org,
selinux@vger.kernel.org, mic@digikod.net
Subject: [PATCH v4 06/13] Audit: Update shutdown LSM data
Date: Wed, 9 Oct 2024 10:32:14 -0700 [thread overview]
Message-ID: <20241009173222.12219-7-casey@schaufler-ca.com> (raw)
In-Reply-To: <20241009173222.12219-1-casey@schaufler-ca.com>
The audit process LSM information is changed from a secid audit_sig_sid
to an lsm_prop in audit_sig_lsm. Update the users of this data
appropriately. Calls to security_secid_to_secctx() are changed to use
security_lsmprop_to_secctx() instead. security_current_getsecid_subj()
is scaffolded. It will be updated in a subsequent patch.
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
---
kernel/audit.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/kernel/audit.c b/kernel/audit.c
index 1edaa4846a47..47c41e6f9ea9 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -123,7 +123,7 @@ static u32 audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME;
/* The identity of the user shutting down the audit system. */
static kuid_t audit_sig_uid = INVALID_UID;
static pid_t audit_sig_pid = -1;
-static u32 audit_sig_sid;
+static struct lsm_prop audit_sig_lsm;
/* Records can be lost in several ways:
0) [suppressed in audit_alloc]
@@ -1473,20 +1473,21 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
}
case AUDIT_SIGNAL_INFO:
len = 0;
- if (audit_sig_sid) {
- err = security_secid_to_secctx(audit_sig_sid, &ctx, &len);
+ if (lsmprop_is_set(&audit_sig_lsm)) {
+ err = security_lsmprop_to_secctx(&audit_sig_lsm, &ctx,
+ &len);
if (err)
return err;
}
sig_data = kmalloc(struct_size(sig_data, ctx, len), GFP_KERNEL);
if (!sig_data) {
- if (audit_sig_sid)
+ if (lsmprop_is_set(&audit_sig_lsm))
security_release_secctx(ctx, len);
return -ENOMEM;
}
sig_data->uid = from_kuid(&init_user_ns, audit_sig_uid);
sig_data->pid = audit_sig_pid;
- if (audit_sig_sid) {
+ if (lsmprop_is_set(&audit_sig_lsm)) {
memcpy(sig_data->ctx, ctx, len);
security_release_secctx(ctx, len);
}
@@ -2404,7 +2405,8 @@ int audit_signal_info(int sig, struct task_struct *t)
audit_sig_uid = auid;
else
audit_sig_uid = uid;
- security_current_getsecid_subj(&audit_sig_sid);
+ /* scaffolding */
+ security_current_getsecid_subj(&audit_sig_lsm.scaffold.secid);
}
return audit_signal_info_syscall(t);
--
2.46.0
next prev parent reply other threads:[~2024-10-09 17:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20241009173222.12219-1-casey.ref@schaufler-ca.com>
2024-10-09 17:32 ` [PATCH v4 00/13] LSM: Move away from secids Casey Schaufler
2024-10-09 17:32 ` [PATCH v4 01/13] LSM: Add the lsm_prop data structure Casey Schaufler
2024-10-11 3:08 ` [PATCH v4 1/13] " Paul Moore
2024-10-11 15:45 ` Casey Schaufler
2024-10-11 7:36 ` [PATCH v4 01/13] " John Johansen
2024-10-09 17:32 ` [PATCH v4 02/13] LSM: Use lsm_prop in security_audit_rule_match Casey Schaufler
2024-10-09 17:32 ` [PATCH v4 03/13] LSM: Add lsmprop_to_secctx hook Casey Schaufler
2024-10-09 17:32 ` [PATCH v4 04/13] Audit: maintain an lsm_prop in audit_context Casey Schaufler
2024-10-11 3:08 ` [PATCH v4 4/13] " Paul Moore
2024-10-11 15:52 ` Casey Schaufler
2024-10-11 16:11 ` Paul Moore
2024-10-11 16:34 ` Casey Schaufler
2024-10-11 18:42 ` Paul Moore
2024-10-09 17:32 ` [PATCH v4 05/13] LSM: Use lsm_prop in security_ipc_getsecid Casey Schaufler
2024-10-11 3:08 ` [PATCH v4 5/13] " Paul Moore
2024-10-09 17:32 ` Casey Schaufler [this message]
2024-10-09 17:32 ` [PATCH v4 07/13] LSM: Use lsm_prop in security_current_getsecid Casey Schaufler
2024-10-09 17:32 ` [PATCH v4 08/13] LSM: Use lsm_prop in security_inode_getsecid Casey Schaufler
2024-10-09 17:32 ` [PATCH v4 09/13] Audit: use an lsm_prop in audit_names Casey Schaufler
2024-10-09 17:32 ` [PATCH v4 10/13] LSM: Create new security_cred_getlsmprop LSM hook Casey Schaufler
2024-10-09 17:32 ` [PATCH v4 11/13] Audit: Change context data from secid to lsm_prop Casey Schaufler
2024-10-09 17:32 ` [PATCH v4 12/13] Use lsm_prop for audit data Casey Schaufler
2024-10-09 17:32 ` [PATCH v4 13/13] LSM: Remove lsm_prop scaffolding 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=20241009173222.12219-7-casey@schaufler-ca.com \
--to=casey@schaufler-ca.com \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
--cc=paul@paul-moore.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=selinux@vger.kernel.org \
--cc=serge@hallyn.com \
--cc=stephen.smalley.work@gmail.com \
/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
all inboxes | Powered by JetHome®