From patchwork Thu Feb 28 22:18:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Casey Schaufler X-Patchwork-Id: 10834083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D377317EF for ; Thu, 28 Feb 2019 22:20:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C89242F3D6 for ; Thu, 28 Feb 2019 22:20:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCBE32FC96; Thu, 28 Feb 2019 22:20:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 657AF2F53D for ; Thu, 28 Feb 2019 22:20:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729671AbfB1WUm (ORCPT ); Thu, 28 Feb 2019 17:20:42 -0500 Received: from sonic302-28.consmr.mail.gq1.yahoo.com ([98.137.68.154]:35525 "EHLO sonic302-28.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729772AbfB1WUB (ORCPT ); Thu, 28 Feb 2019 17:20:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1551392401; bh=FzVvjR+NFksvu4dNddqr2/PVXMCrtqnd2aRCMpeNGXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject;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fNUHPVDejmCZ3eH4XLItQOm42SOnsnm Yb3bSturQtsDFtvEM3iy6zurmv9O8IvvCdAkooC_YM8T1e8qIISLSkEYy4z0ULULzL2gEN8ecObC bxtu5juGwRSHQYsHoEjh7183qJH7EX2boPjt7wgr6fTZDEBa36RPTXjPWWwZO4kL7YBipjMVFHIp PHhOFGsttMAT3Fz4JXNdFXX.8RJSs1n2r.P5Nfq6_C765JUTIXV.uJnisgly0UvNn1kSx91cBxhu xjT3dZ6OJ78wzejr0IckIYSh_gzLkPgLL.MzwKCK.I_S3pAAxvx0Y9U_vhCaiftg4ma8Cr1TkKGu wqP3cJQLWGZLqhxb8kxTQTeMFp_CuQJvSjMqCYKq8jGf5VnV00q6kO2IX4cOaE71d7zxXV40qU2J nGnukyZ8jUNUDJTTtDlDb2BmzfF1RtpTnaDPITcPflLK8EJ.T Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Thu, 28 Feb 2019 22:20:01 +0000 Received: from c-67-169-65-224.hsd1.ca.comcast.net (EHLO localhost.localdomain) ([67.169.65.224]) by smtp406.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 5c7d685bea94a92cc9d12c4cc22f1f0e; Thu, 28 Feb 2019 22:19:59 +0000 (UTC) From: Casey Schaufler To: jmorris@namei.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Cc: keescook@chromium.org, john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp, paul@paul-moore.com Subject: [PATCH 27/97] LSM: Use lsm_export in security_cred_getsecid Date: Thu, 28 Feb 2019 14:18:23 -0800 Message-Id: <20190228221933.2551-28-casey@schaufler-ca.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190228221933.2551-1-casey@schaufler-ca.com> References: <20190228221933.2551-1-casey@schaufler-ca.com> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Convert security_cred_getsecid to use the lsm_export structure instead of a u32 secid. There is some scaffolding involved that will be removed when the related data is updated. Signed-off-by: Casey Schaufler --- include/linux/security.h | 2 +- security/integrity/ima/ima_main.c | 3 ++- security/security.c | 8 +++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/linux/security.h b/include/linux/security.h index 07fd36f6616d..87085ff519bf 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -376,7 +376,7 @@ int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); void security_cred_free(struct cred *cred); int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); void security_transfer_creds(struct cred *new, const struct cred *old); -void security_cred_getsecid(const struct cred *c, u32 *secid); +void security_cred_getsecid(const struct cred *c, struct lsm_export *l); int security_kernel_act_as(struct cred *new, struct lsm_export *l); int security_kernel_create_files_as(struct cred *new, struct inode *inode); int security_kernel_module_request(char *kmod_name); diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index e78658b26a74..7efc806eb5ab 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c @@ -374,7 +374,8 @@ int ima_bprm_check(struct linux_binprm *bprm) if (ret) return ret; - security_cred_getsecid(bprm->cred, &secid); + security_cred_getsecid(bprm->cred, &le); + lsm_export_secid(&le, &secid); return process_measurement(bprm->file, bprm->cred, secid, NULL, 0, MAY_EXEC, CREDS_CHECK); } diff --git a/security/security.c b/security/security.c index c2cf82b063ca..06461712c881 100644 --- a/security/security.c +++ b/security/security.c @@ -1590,12 +1590,10 @@ void security_transfer_creds(struct cred *new, const struct cred *old) call_void_hook(cred_transfer, new, old); } -void security_cred_getsecid(const struct cred *c, u32 *secid) +void security_cred_getsecid(const struct cred *c, struct lsm_export *l) { - struct lsm_export data = { .flags = LSM_EXPORT_NONE }; - - call_void_hook(cred_getsecid, c, &data); - lsm_export_secid(&data, secid); + lsm_export_init(l); + call_void_hook(cred_getsecid, c, l); } EXPORT_SYMBOL(security_cred_getsecid);