From patchwork Thu Feb 28 22:43:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Casey Schaufler X-Patchwork-Id: 10834135 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 7071D18EC for ; Thu, 28 Feb 2019 22:44:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6218828EAB for ; Thu, 28 Feb 2019 22:44:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5694D290BB; Thu, 28 Feb 2019 22:44:22 +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 025C1293B8 for ; Thu, 28 Feb 2019 22:44:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729181AbfB1WoV (ORCPT ); Thu, 28 Feb 2019 17:44:21 -0500 Received: from sonic301-10.consmr.mail.bf2.yahoo.com ([74.6.129.49]:40373 "EHLO sonic301-10.consmr.mail.bf2.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728893AbfB1WoU (ORCPT ); Thu, 28 Feb 2019 17:44:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1551393858; bh=/hckqGWaPxP0IFAvTcxg8keP+3zAVRCdGN1rW1SVv0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject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eaMz09YpsqPpy_UbQ84b0VbXuj9JMFTXJRhOnTH8DckAf0Oc cPBkB9FEPVrOHhKUv3ownt2i1bN2IuFoMiDk77WF6B1WhnNn9WmPRLJfb9J5AXbrkaLxQE1VwSXX xoLXW6VA64uPU48f2AyTg2NucyRHhho8G1MxG9oYalxl1byqtiJthr4.olggPdr9zUOPPgdeuXHB CxHyzt.T3aZp6SB9DXZZDQl5jCGY.0TGLVnOIhT96eu1Sw2eCHbYF1.JwdloBF9tp0F.PXTY3S2C kcTkpMhirG1lQNzVx9A5MkcGGl541CmPGCzl9ZgYbwg218x7.iEondeQPeturCvJiSNLODHIBu78 uW_pTcOmgc14fwdJgxy1uSm.Q.csSe2Ju__sGJqHNr_UUnatBeWykh.iSMKjc0qq4sEkBx_ASBRi nmdSEONu4TlVoDdHh1EYy0bYPOwA0b4H9EPa.qDSHwFQM3DLQ_FSTF7s- Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.bf2.yahoo.com with HTTP; Thu, 28 Feb 2019 22:44:18 +0000 Received: from c-67-169-65-224.hsd1.ca.comcast.net (EHLO localhost.localdomain) ([67.169.65.224]) by smtp415.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 46c3ca42412e81058eafbaa96f791691; Thu, 28 Feb 2019 22:44:17 +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 80/97] Smack: Advertise the secid to netlabel Date: Thu, 28 Feb 2019 14:43:39 -0800 Message-Id: <20190228224356.2608-11-casey@schaufler-ca.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190228224356.2608-1-casey@schaufler-ca.com> References: <20190228224356.2608-1-casey@schaufler-ca.com> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Add the secid to the attributes shared with netlabel. Signed-off-by: Casey Schaufler --- security/smack/smack_access.c | 8 ++++++-- security/smack/smackfs.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c index fe2ce3a65822..0764bb85daee 100644 --- a/security/smack/smack_access.c +++ b/security/smack/smack_access.c @@ -549,8 +549,12 @@ struct smack_known *smk_import_entry(const char *string, int len) skp->smk_known = smack; skp->smk_secid = smack_next_secid++; skp->smk_netlabel.domain = skp->smk_known; - skp->smk_netlabel.flags = - NETLBL_SECATTR_DOMAIN | NETLBL_SECATTR_MLS_LVL; + lsm_export_init(&skp->smk_netlabel.attr.le); + skp->smk_netlabel.attr.le.flags = LSM_EXPORT_SMACK; + skp->smk_netlabel.attr.le.smack = skp->smk_secid; + skp->smk_netlabel.flags = NETLBL_SECATTR_DOMAIN | + NETLBL_SECATTR_MLS_LVL | + NETLBL_SECATTR_SECID; /* * If direct labeling works use it. * Otherwise use mapped labeling. diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 28c567465f6c..abaa5325c32f 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -2953,8 +2953,12 @@ static struct vfsmount *smackfs_mount; static int __init smk_preset_netlabel(struct smack_known *skp) { skp->smk_netlabel.domain = skp->smk_known; - skp->smk_netlabel.flags = - NETLBL_SECATTR_DOMAIN | NETLBL_SECATTR_MLS_LVL; + lsm_export_init(&skp->smk_netlabel.attr.le); + skp->smk_netlabel.attr.le.flags = LSM_EXPORT_SMACK; + skp->smk_netlabel.attr.le.smack = skp->smk_secid; + skp->smk_netlabel.flags = NETLBL_SECATTR_DOMAIN | + NETLBL_SECATTR_MLS_LVL | + NETLBL_SECATTR_SECID; return smk_netlbl_mls(smack_cipso_direct, skp->smk_known, &skp->smk_netlabel, strlen(skp->smk_known)); }