Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp45983rwb; Tue, 25 Jul 2023 11:41:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlHbHOCqrYBwR2XsX28Javc7xaeXvl7fDDR0KLZ55JtE9yEFMbWJ5eZOv4pngFMj1VwsOqZE X-Received: by 2002:a17:906:2090:b0:993:f2c2:750b with SMTP id 16-20020a170906209000b00993f2c2750bmr14873910ejq.17.1690310459845; Tue, 25 Jul 2023 11:40:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690310459; cv=none; d=google.com; s=arc-20160816; b=htDpgXuN5N+f4tydAYzElbLFYBcqZsvJ5/Wl26T/Pj/WO1Fvt6PL61fZ9Vs4JP0/MW f8Y9XuhLOppnEVmFgv33Spjy5RWPBaIxPZreWR8f+PLq0xHrKc5L4VsNlncL8e4yMP7l RBlT/E2U1+JAnDzyKDm5735VH9ehN4TTgghQqNnRX0ONLZp+ENoQknZYaj7CCxTRvJMM Q2RQdtdlWWcQpMW2GJg0hF0s03ZcVwj8usH9K+KtiDfRCc6zIbqzc27tnqImpsU22GUk JAw2ZmUHewZPNscJOA8pmo82HW8MhzAsrYL782E5WhGW4GKcgtOz1CKdyvbJJ/kIafwY nLtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=+mEV6x+zzmYuyWd2xXHOlq08a9u6dgdxgRHuWU4jLzM=; fh=DO+GLVqkheAKoCR2jwbFAh3Vsij4xf+BlexAychzE3U=; b=YOBBXBADv6Y0Qw70O9ExEW26wBoC+U60BesXv9abHfFmW3JEt4cvmb/bG6URp9p5rD EvCSiJDtnZBpYT3xx3kyjRjmNyhTcRCcXU99MRX1RH/5kGbK6SRSL2oThk4qU1BdUGyA ss2F3zgHq1chGOYBTU4ovr7KSkfXvoVSoa546nipIa9WCGBZ6hw4nHHSImw3UJqiqGEg 9dMWXzU9enDzjwOllzAc5J0OBGzN+UmIl7m3l6rTBE4MWoK0my74jh1m+Tsg5pdaIZJ+ 7vMtsXGbhJuV+WMffeztdWsNnI5Voq8r/OzfYMhfNtT0FgV0XJRe4Orh9iKdPc9STZal 4+3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=jqk+lFi0; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lv24-20020a170906bc9800b0099b4147a2aesi8104948ejb.95.2023.07.25.11.40.35; Tue, 25 Jul 2023 11:40:59 -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; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=jqk+lFi0; 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 S230319AbjGYSSl (ORCPT + 99 others); Tue, 25 Jul 2023 14:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230027AbjGYSSg (ORCPT ); Tue, 25 Jul 2023 14:18:36 -0400 Received: from sonic306-27.consmr.mail.ne1.yahoo.com (sonic306-27.consmr.mail.ne1.yahoo.com [66.163.189.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 680101BFA for ; Tue, 25 Jul 2023 11:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1690309114; bh=+mEV6x+zzmYuyWd2xXHOlq08a9u6dgdxgRHuWU4jLzM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=jqk+lFi0LMVUdKz/b6tntH6wGKEqgKnmJbC0dnuDaM8thvT2fSrq07KrwWdNygq9GoIPcPFlN0n2Da8E65ylzn0EPjtJHeBNQ/NFUVV47RvsRb4y990uZ54kL+iWgAtLZPdRLGndbYSiOeFkGmuyFISqlI4VOCzZ03QOc2KFwszrPmVbzEYay2aFET0C7QO34HXtEvD3gQSLXzFaHE0jncILkvQH2A7kkvYW0BhTfotam0AGCvmDGCXRmwKhOdiL+Ivx7b2uf5TTKwLpjmvWPtu347ZTPXorY/oDK7lFUr4PB+SNnRHfa+wH7jshAx5tBJ2cqyP6QQ87g8L2gtqZlQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1690309114; bh=l2h7/CZRiPG4/5UFXPKXH1+RsKAl5V2zKAgD7JykGkQ=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=qPFpYlWCOiYq5W3N3tQ5/XCZS+nwl32aUl0MgU+aL6OBB4EFYNbPLVF5oDIzElLeeZfl6grIhl5jPSEbjdb6bWq3MgZoUMdw3H7/Nh4fokjZ1mYlycYLHDRyBBx6shmV6rrHS576j6Hr68F++/DPAY0y7DPq9RNwoyUnElCEzaFyYbW8+9JUI6K7hCodryDlC7ZMApfKM79TUpJDEXP8idnczki7xt9NujW3I4H6YfQe7XTOPTYQHD3IQvNLLJof0i687gqe+2xNgDXkS0ltFajAuIp/bIH/beQ0ZUwLq9hNdd/FZaBlvmTqDmv6W2aJHEy13WnsDd4o1dj0Hg8xdw== X-YMail-OSG: dtjRU6wVM1m9ndmAhvAP_EiOx2nfNa63L2MxkbLiYhEx5E.3nUMPI8tbYvJ4sNR M8dTF4SjrvE6u20FYZ.8z7dcUr437J7ytssuOxwnBTYeVg2aFENp5ObNe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2MLPtZmecGPZQ_E3nL4 wbOtHm5vFbiW7waxEtyDmwUNqNl2myr.ZnaAWuxedE5mpvFKjTpX.PcqScPkx4qvWp5BT7VTzHJ_ uMzPf9Jn2C_qq X-Sonic-MF: X-Sonic-ID: 6d6edb3f-75ea-4e6a-beab-91b94679ec9f Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ne1.yahoo.com with HTTP; Tue, 25 Jul 2023 18:18:34 +0000 Received: by hermes--production-ne1-549c7f6c44-r55n8 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 8326ca44c4641a54882626013ee7d6bc; Tue, 25 Jul 2023 18:18:29 +0000 (UTC) Message-ID: Date: Tue, 25 Jul 2023 11:18:28 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 0/5] Smack transmute fixes Content-Language: en-US To: Roberto Sassu , paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Roberto Sassu , Casey Schaufler References: <20230724151341.538889-1-roberto.sassu@huaweicloud.com> From: Casey Schaufler In-Reply-To: <20230724151341.538889-1-roberto.sassu@huaweicloud.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.21647 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org On 7/24/2023 8:13 AM, Roberto Sassu wrote: > From: Roberto Sassu I'm testing these relative to smack-next. > > The first two patches are obvious fixes, the first restricts setting the > SMACK64TRANSMUTE xattr only for directories, and the second makes it > possible to set SMACK64TRANSMUTE if the filesystem does not support xattrs > (e.g. ramfs). > > The remaining fixes are optional, and only required if we want filesystems > without xattr support behave like those with xattr support. Since we have > the inode_setsecurity and inode_getsecurity hooks to make the first group > work, it seems useful to fix inode creation too (SELinux should be fine). > > The third patch is merely a code move out of the 'if (xattr)' condition. > The fourth updates the security field of the in-memory inode directly in > smack_inode_init_security() and marks the inode as instantiated, and the > fifth adds a security_inode_init_security() call in ramfs to initialize the > security field of the in-memory inodes (needed to test transmuting > directories). > > Both the Smack (on xfs) and IMA test suite succeed with all patches > applied. > > By executing the tests in a ramfs, the results are: > > Without the patches: > 86 Passed, 9 Failed, 90% Success rate > > With the patches: > 93 Passed, 2 Failed, 97% Success rate > > The remaining two failures are: > 2151 ioctl(4, BTRFS_IOC_CLONE or FICLONE, 3) = -1 EOPNOTSUPP (Operation not supported) > 2152 lsetxattr("./targets/proc-attr-Snap", "security.SMACK64EXEC", "Pop", 3, 0) = -1 EOPNOTSUPP (Operation not supported) > > The first one is likely due ramfs lack of support for ioctl() while the > second could be fixed by handling SMACK64EXEC in smack_inode_setsecurity(). > > The patch set applies on top of: > > https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git/commit/?h=next&id=ca22eca6e2ad7eaed1c791628ef7cb4c739e3da6 > > > The ramfs patch potentially could be useful to correctly initialize the > label of new inodes in the initramfs, assuming that it will be fully > labeled with support for xattrs in the cpio image: > > https://lore.kernel.org/linux-integrity/20190523121803.21638-1-roberto.sassu@huawei.com/ > > Ramfs inode labels will be set from xattrs with the inode_setsecurity hook. > > Changelog > > v1: > - Rebase on top of latest lsm/next > - Remove -EOPNOTSUPP check in patch 5 (cannot happen) > > Roberto Sassu (5): > smack: Set SMACK64TRANSMUTE only for dirs in smack_inode_setxattr() > smack: Handle SMACK64TRANSMUTE in smack_inode_setsecurity() > smack: Always determine inode labels in smack_inode_init_security() > smack: Initialize the in-memory inode in smack_inode_init_security() > ramfs: Initialize security of in-memory inodes > > fs/ramfs/inode.c | 27 +++++++++++ > security/smack/smack_lsm.c | 97 ++++++++++++++++++++++---------------- > 2 files changed, 83 insertions(+), 41 deletions(-) >