Message ID | 20230724151341.538889-3-roberto.sassu@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp1881467vqg; Mon, 24 Jul 2023 08:39:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlF5HdA7BC1zq11H7NvobjEic5THLKgmfpGjv+5w37wBa87T/d3vGL/nyTzIkDOdDT3je458 X-Received: by 2002:a05:6a21:99a5:b0:13a:43e8:3fa6 with SMTP id ve37-20020a056a2199a500b0013a43e83fa6mr5319478pzb.23.1690213172156; Mon, 24 Jul 2023 08:39:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690213172; cv=none; d=google.com; s=arc-20160816; b=P/Fg8CtUTkx5HkzIhZVHXYrIDMVi6gwSmLHtR36hRUPWMZETSnDfdJZiwVXxLt8lEc 6JEWlyPArleYy5OXmFur+/yStIHvqpDLdc6cFK8jSalxpgI0ar5bwtkuh6a3twwkuao3 y/zctGTmtZLRapzPl8mNGmO/dSN+2seKJkXSHFWk6FnrMjDW0hE32ZycVuNZUXtC1Bk6 7aQeDq7mCbuIYUqJMQjpuS2INkmO2pb1VcgYiRy9mrkK7N6ZPiMBFzzEteWijvqrR1RC olOD/flS0+0V/1z0taohpV2EVSEj0Qbt/LrKQ5YQVnu8CA046/gviC5mftYjKOk1UuPV 4tzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Db25gBuWGl7dYsXhriAf38OhpNNBwS/d3RS2RRiH6S0=; fh=ZKWcyA0kesGCMzuKNl8fCcnARFCiY872iRD37qc+xr4=; b=rSes9f1tmzrnHC+Rg5x6YXTTVTvUWJ0u7NfrbpGF/jSQGvRI1FH8QbTQapcIQWhyiD R8LJFYDVsHWexpito0wDEIIQneGYl3sv79IqZ4pcmV/501vWcQTyU80ExAvAT2qgJM31 /P4NFRAvy5QGPSLp/7todidohy3IyfUtTEWcgo3BOGi+o5kEDMsSPnLW5v1DSagpcOTU wOPg+qlZrLvF2xSsCTawPEOE58bmaKhDdB5yW/OsUxqCNPcsgIwxZVALnzwHR0dSqZgx qS18GhH8H8NudGlL/DHTnQH5OCpKd3MK1LLcnIUgoNr/CorVSUx3L5cr879xjxcOEzzj 0rZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020aa793ac000000b00666e4a4656asi8710976pff.335.2023.07.24.08.39.18; Mon, 24 Jul 2023 08:39:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231140AbjGXPTD (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Mon, 24 Jul 2023 11:19:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231131AbjGXPS5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 24 Jul 2023 11:18:57 -0400 Received: from frasgout11.his.huawei.com (unknown [14.137.139.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C2DA10EC; Mon, 24 Jul 2023 08:18:51 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.18.147.229]) by frasgout11.his.huawei.com (SkyGuard) with ESMTP id 4R8k6V1swTz9yGhH; Mon, 24 Jul 2023 23:07:30 +0800 (CST) Received: from huaweicloud.com (unknown [10.204.63.22]) by APP2 (Coremail) with SMTP id GxC2BwCHTlU3lr5kJcTzBA--.28220S4; Mon, 24 Jul 2023 16:18:38 +0100 (CET) From: Roberto Sassu <roberto.sassu@huaweicloud.com> To: casey@schaufler-ca.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Roberto Sassu <roberto.sassu@huawei.com>, stable@vger.kernel.org Subject: [PATCH v2 2/5] smack: Handle SMACK64TRANSMUTE in smack_inode_setsecurity() Date: Mon, 24 Jul 2023 17:13:38 +0200 Message-Id: <20230724151341.538889-3-roberto.sassu@huaweicloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230724151341.538889-1-roberto.sassu@huaweicloud.com> References: <20230724151341.538889-1-roberto.sassu@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GxC2BwCHTlU3lr5kJcTzBA--.28220S4 X-Coremail-Antispam: 1UD129KBjvdXoW7Wr15tF17uw4xtrWfZFyxXwb_yoWkZFg_Wr 1jya4kXrs8A3W3Wa97Ar1Fvr92g3y8Xr1rW3Wft343Za4rXr1kta15Jry5WFW5Zw1xJ397 CFn8WFyfJw12qjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbsAYFVCjjxCrM7AC8VAFwI0_Wr0E3s1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l82xGYIkIc2x26280x7IE14v26r15M2 8IrcIa0xkI8VCY1x0267AKxVW8JVW5JwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK 021l84ACjcxK6xIIjxv20xvE14v26r1j6r1xM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r 4j6F4UM28EF7xvwVC2z280aVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F4U JVW0owAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7V C0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j 6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r 4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF 67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2I x0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2 z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnU UI43ZEXa7IU8fcTPUUUUU== X-CM-SenderInfo: purev21wro2thvvxqx5xdzvxpfor3voofrz/1tbiAQAIBF1jj5DcNQAAsF X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, MAY_BE_FORGED,RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_L3,RDNS_DYNAMIC, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772316966752421578 X-GMAIL-MSGID: 1772316966752421578 |
Series |
Smack transmute fixes
|
|
Commit Message
Roberto Sassu
July 24, 2023, 3:13 p.m. UTC
From: Roberto Sassu <roberto.sassu@huawei.com> If the SMACK64TRANSMUTE xattr is provided, and the inode is a directory, update the in-memory inode flags by setting SMK_INODE_TRANSMUTE. Cc: stable@vger.kernel.org Fixes: 5c6d1125f8db ("Smack: Transmute labels on specified directories") # v2.6.38.x Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> --- security/smack/smack_lsm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index e599ce9453c..9eae830527d 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -2804,6 +2804,15 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name, if (value == NULL || size > SMK_LONGLABEL || size == 0) return -EINVAL; + if (strcmp(name, XATTR_SMACK_TRANSMUTE) == 0) { + if (!S_ISDIR(inode->i_mode) || size != TRANS_TRUE_SIZE || + strncmp(value, TRANS_TRUE, TRANS_TRUE_SIZE) != 0) + return -EINVAL; + + nsp->smk_flags |= SMK_INODE_TRANSMUTE; + return 0; + } + skp = smk_import_entry(value, size); if (IS_ERR(skp)) return PTR_ERR(skp);