From nobody Wed Nov 27 14:31:09 2024 Received: from sonic305-27.consmr.mail.ne1.yahoo.com (sonic305-27.consmr.mail.ne1.yahoo.com [66.163.185.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E05B01E0E18 for ; Wed, 9 Oct 2024 17:34:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.163.185.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728495253; cv=none; b=LxaceNvjmPiFvW52elGeHzcD1VMON4C2C6I762zIKk17LewlTO1ZujygNc53eq17YRHbukzhPClBK2WoA01xjC/+LT9MK/FNpsJOKmNOTW/2fr/y6OuXEMbhBqa+qN7lH2jzfmD8JTU+hkK7XqRnh5Jj03W1x/NTFKbvKXqrMCo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728495253; c=relaxed/simple; bh=4P7C6WGa+3DAD3HMQ7qltgx4htUhGEAzSs7puUwwYFU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xn3VJQtM99JqmfUmaJaj+3ypjUWSnP/IsNGISd0Gj4nUuIqvunzvVoCetoYL8f+DNw5XlWRSfpCJ4UEhVc7eHwmubWNDdgwVxVW8fuNcaA5xUf4RIuCqZKTUZm85lGnsORI6I9Dgd8Cqu9sdvnd1/tnn4qc2fYI+EDRfFH5YNMg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=schaufler-ca.com; spf=none smtp.mailfrom=schaufler-ca.com; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b=J+iFItwc; arc=none smtp.client-ip=66.163.185.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=schaufler-ca.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=schaufler-ca.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b="J+iFItwc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1728495251; bh=Ri80MgNDcTseaGUsqfIA0tyVfuRU0LoKRoYnob2OWgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=J+iFItwczlZiRXdZ/QwzwnIiaH6DGZC9stRISMNEgTvFHRUzRbyVxg9ouO05iJqtr3q4B4NM+8uOtoP6dijBoJFzjQnUZJ+ionnMpSz40TAnZ1vqjtJdVP9ZLqb+GncBPTwqCWa2Ub7VxGdgZAL0+AXR1mPp3A04MKOtXzr6EaaAUjiEireDBzT8xaid5qN4mt1PIOZTJ3RNP/v8jf40ELP9QuzYCGsWrXYaGIQ9I8Clp0IV8tRS55mXDjRY0Qpydz75/bK+UUb8AL0WJk6meTDicwgBmL+YUaegBCZNaMATjcD9gb23l7gqIYgU31iFybrBdW9IkYtAkC/krFLteA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1728495251; bh=+LvK8j1vwCDTYPM1Mmj43JKM2tnho148gZz55FrWoGs=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=QctkixJESEl0WB8fgXqQuqkLCFMs72Le8fXThloUMEFm144yhKYdmbAbwv+RD9mWYakFbt6B5FKpK2uqprGJG+Fx3stKOGMhpRfle21vtJL0EuIxyJQBwrKf3AdIpj7eVT4vH88+qWtgd2vatnKT3bkt2qicYCGKaH/Gyq3FSs4NpEGu63a5BU/gGNyghp8EzW4mZJGK0XMNrlfVHDjSIcTGZ7IwPJjs5cJE6B5po5MG3m13Uii68ITbw1CoGiS6/lkcv+jNhOZ/WNJxU6qXLzcHWKsRBYlN03+Q6Yjq6xtcVHq0j3M4pQXtv3mEDKKzfDzk0oTC4wJgu3XALmEVPA== X-YMail-OSG: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Azq53Jd7B7wsbnaQ1evDEtUToziFcKptPHNztirXKJlfJaQGcuPYD .rL8i_.p7YLMWJVjCRaeYfIoNiBbU_ETag4eTanspZBUt5GSNanOlYx.WN9E6Bwv6Ie.iyDzo5gK 0I4WPwEhePPnmfoyZr3.JuK2D35A3Kk5ymqbiYzlsNPpP_lIPxDEGFsOtiA-- X-Sonic-MF: X-Sonic-ID: 1cd3087f-f37f-4167-921d-376d99fcc003 Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Wed, 9 Oct 2024 17:34:11 +0000 Received: by hermes--production-gq1-5d95dc458-6q8w6 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID a7e77129a0d9b2a8b8a48f1f6322a7dc; Wed, 09 Oct 2024 17:34:08 +0000 (UTC) From: Casey Schaufler 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 Message-ID: <20241009173222.12219-7-casey@schaufler-ca.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241009173222.12219-1-casey@schaufler-ca.com> References: <20241009173222.12219-1-casey@schaufler-ca.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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 =3D AUDIT_BACKLOG_WA= IT_TIME; /* The identity of the user shutting down the audit system. */ static kuid_t audit_sig_uid =3D INVALID_UID; static pid_t audit_sig_pid =3D -1; -static u32 audit_sig_sid; +static struct lsm_prop audit_sig_lsm; =20 /* 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, s= truct nlmsghdr *nlh, } case AUDIT_SIGNAL_INFO: len =3D 0; - if (audit_sig_sid) { - err =3D security_secid_to_secctx(audit_sig_sid, &ctx, &len); + if (lsmprop_is_set(&audit_sig_lsm)) { + err =3D security_lsmprop_to_secctx(&audit_sig_lsm, &ctx, + &len); if (err) return err; } sig_data =3D 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 =3D from_kuid(&init_user_ns, audit_sig_uid); sig_data->pid =3D 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 =3D auid; else audit_sig_uid =3D uid; - security_current_getsecid_subj(&audit_sig_sid); + /* scaffolding */ + security_current_getsecid_subj(&audit_sig_lsm.scaffold.secid); } =20 return audit_signal_info_syscall(t); --=20 2.46.0