From patchwork Thu Feb 28 22:18:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Casey Schaufler X-Patchwork-Id: 10834027 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 9BFF817EF for ; Thu, 28 Feb 2019 22:20:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90FC32FC88 for ; Thu, 28 Feb 2019 22:20:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84AB82FC8D; Thu, 28 Feb 2019 22:20:32 +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 3ED3F2F3CE for ; Thu, 28 Feb 2019 22:20:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732267AbfB1WUb (ORCPT ); Thu, 28 Feb 2019 17:20:31 -0500 Received: from sonic315-15.consmr.mail.gq1.yahoo.com ([98.137.65.39]:41902 "EHLO sonic315-15.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731854AbfB1WU1 (ORCPT ); Thu, 28 Feb 2019 17:20:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1551392426; bh=QK9560GfKQyWtmcg3Y6lnKMpYD6MKgEAgcdInD1a9Ak=; h=From:To:Cc:Subject:Date:In-Reply-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yLsgHunHh39hweu.nu8q700mV9KC7O3lmwvju_2UcGHT NNn1cQLZcX.5iJ4X3GtnK8hX.gSZAk18ZUZvfbei4vxeBJypS7VBE7iz_s041B3Bkji16WFiVJXn pf03RInsX4rvpLKIL3cnWJuYFzoCgR1UKZTpRbj4pXVrGEyJNA84ob_7LV5_PtL1fWDSTsDKEza. 3E9qxYVcgjrNI2kZdeG56oECssHj_9zus8TdwBOHaQI3cLL49YMuZWmjbluq34KYaQaAg4Mma_hg e8z6eOcmd7WKSrYsQVAGT3hgwuPPJMjIXZSTbpWvTQbN6mx7bqBLS2QOeGDT_U.GpU5o.mnYBlnW dh9JwnurkGWP5uEMGE2pqnfB8Qy.B9U39LXGCkw8LbzzqjpV5y_G4CZ12NhkfA19BWNpEa7Whcow c8.lGkASTeyzF8eFNzS6deawihLERsJkdYSlJRbDxXeUhFq6g Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.gq1.yahoo.com with HTTP; Thu, 28 Feb 2019 22:20:26 +0000 Received: from c-67-169-65-224.hsd1.ca.comcast.net (EHLO localhost.localdomain) ([67.169.65.224]) by smtp421.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID d90148b291d74b44c78573c559ceeae0; Thu, 28 Feb 2019 22:20:23 +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 63/97] SELinux: Use blob offset in current_sid Date: Thu, 28 Feb 2019 14:18:59 -0800 Message-Id: <20190228221933.2551-64-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 Replace the use of current_security() with a call to current_cred() so that the blob offset can be correctly applied. Signed-off-by: Casey Schaufler --- security/selinux/include/objsec.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h index 59a3b1cd5ba9..c9a88b7a96a7 100644 --- a/security/selinux/include/objsec.h +++ b/security/selinux/include/objsec.h @@ -31,6 +31,8 @@ #include "flask.h" #include "avc.h" +extern struct lsm_blob_sizes selinux_blob_sizes; + struct task_security_struct { u32 osid; /* SID prior to last execve */ u32 sid; /* current SID */ @@ -45,7 +47,9 @@ struct task_security_struct { */ static inline u32 current_sid(void) { - const struct task_security_struct *tsec = current_security(); + const struct task_security_struct *tsec; + + tsec = current_cred()->security + selinux_blob_sizes.lbs_cred; return tsec->sid; } @@ -174,7 +178,6 @@ struct bpf_security_struct { u32 sid; /*SID of bpf obj creater*/ }; -extern struct lsm_blob_sizes selinux_blob_sizes; static inline struct task_security_struct *selinux_cred(const struct cred *cred) { return cred->security + selinux_blob_sizes.lbs_cred;