From patchwork Tue Apr 9 21:39:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Casey Schaufler X-Patchwork-Id: 10892541 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 7029413B5 for ; Tue, 9 Apr 2019 21:41:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63571285C6 for ; Tue, 9 Apr 2019 21:41:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57EB92887B; Tue, 9 Apr 2019 21:41:07 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 0D7692889C for ; Tue, 9 Apr 2019 21:41:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726857AbfDIVlG (ORCPT ); Tue, 9 Apr 2019 17:41:06 -0400 Received: from sonic301-38.consmr.mail.ne1.yahoo.com ([66.163.184.207]:33814 "EHLO sonic301-38.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726907AbfDIVlF (ORCPT ); Tue, 9 Apr 2019 17:41:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1554846063; bh=vbPmsKchcYujFbsoTOZdCYFpnfZ1qp/ZBXWOn5HufTo=; h=From:To:Cc:Subject:Date:In-Re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_QsPCoTfG7l3MTeHssJnq036Ah40EflcOwFzO0WM1We.k7zATabZJiGqP vQE7XUPMVNiEYjiV612cpJrlkntjOspNQSUw4C0hvI7DKYu6slH5Ge2HcgP6PLKKCXxZ6mpGybAw 7Nc_SQe04sxSf1fnf5amSXjGn9.q.phvjBcnuSlPIbHEqqbT.m1vBBxAbjga_KlDSYa_h4EgOqx0 Rr8LpAp9XDXjZOBUmO6F7nshg1KdaqNVpewWdaM.KJeuQ.v82TcSK_pVYYUS80LkwPJ7nImnzZrc IKU85ubRBTN6rRiXqZ_F0tNcAx898p9FzXB6SoHZhiLUXJgyC85YXvxzX6xpmY4U29y3ksIVM9N7 ote8V6gzLgkVdS9eqEERV.sAtwHXc_YGTRdrCCu7jLV.hoRX3y0Pamu7RG5EDGpl2I.pPEojkJdZ r6AzywkUt4_xeq6vGbubFkCCy5EnDXE.Xyy_ZjhbnqHd3pF8Pz5qmEBX6ukrmzA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ne1.yahoo.com with HTTP; Tue, 9 Apr 2019 21:41:03 +0000 Received: from c-67-169-65-224.hsd1.ca.comcast.net (EHLO localhost.localdomain) ([67.169.65.224]) by smtp408.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 6a737b6f7572f7259a29fc213d8f0ed1; Tue, 09 Apr 2019 21:40:53 +0000 (UTC) From: Casey Schaufler To: casey.schaufler@intel.com, jmorris@namei.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Cc: casey@schaufler-ca.com Subject: [PATCH 37/59] LSM: Create a data structure for a security context Date: Tue, 9 Apr 2019 14:39:24 -0700 Message-Id: <20190409213946.1667-38-casey@schaufler-ca.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190409213946.1667-1-casey@schaufler-ca.com> References: <20190409213946.1667-1-casey@schaufler-ca.com> Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A "security context" is the text representation of the information used by LSMs. This provides a structure so that the use can be made consistant. Signed-off-by: Casey Schaufler --- include/linux/security.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/security.h b/include/linux/security.h index 6c44aca19c65..8dd21133ede8 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -119,6 +119,17 @@ static inline bool lsm_export_equal(struct lsm_export *l, struct lsm_export *m) extern struct lsm_export *lsm_export_skb(struct sk_buff *skb); +/* Text representation of LSM specific security information - a "context" */ +struct lsm_context { + char *context; + u32 len; +}; + +static inline void lsm_context_init(struct lsm_context *cp) +{ + memset(cp, 0, sizeof(*cp)); +} + /* These functions are in security/commoncap.c */ extern int cap_capable(const struct cred *cred, struct user_namespace *ns, int cap, unsigned int opts);