Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp907764rwd; Wed, 7 Jun 2023 08:24:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6QUw7UmJ3nZH5DQh3oz8HjQyfERg0i9SLPNUKls+nIxFl53fvEnPeAfsfamX3pwEf+NVLP X-Received: by 2002:a17:90b:3655:b0:256:1fd3:b593 with SMTP id nh21-20020a17090b365500b002561fd3b593mr2507370pjb.38.1686151445034; Wed, 07 Jun 2023 08:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686151445; cv=none; d=google.com; s=arc-20160816; b=ev67DN71MS+6c6tDz0rFY1PKmKZx897S8gy4L1MGP1ttmhh13UXRqhrwAdKX5v9nli HPs4mUZtxO+av+2w/GpVOFN4anE7xw5ZMxTUs2rXRMjlAWjQRNOdhygHpbqGUffaW7ol /83AUfXJB8mdSIn3b14f592zAMdrRujb20N3C4bYGAg7I/ji8rC8YWP1HBqr5CDwA505 dkUBv/Z1PVz24S9COlQluuPDJCoOESkIEl40aUFeH5D8+AXDpL+2O11KqsvlYgJWydO3 mH0RX4IqSI4sClYDPoVEQ5rinb7sn6aQg+mzZ3Ru31PRof2RJ5C7rZtG0QiYu7B62FDj q47A== 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=z7WfrWLOqj/e0upze66XgMmqNTjW0KB/uXTWmgLmriE=; b=Uixz/bMep4B35/X1Z3Bvg6r9mzXSyX17M7KYjOkgCFxOrRJgfGS9KCos9ddHB8YIGP ZD7Rx06TEyIzBrbPrjcd5jpDFsiTQ4obL7W2TEmCRldPJK90JYqBedapUqgz2xA4qqeJ /iR3a9UAZ+ibAEF5YGQgtcCKIitjOpxqwntkolqlNER8P7BhJPHX4Bh6mH5nf8YKA2dN N21VM6VpyVEDVOlD5MLbWxIqdHSqdK8eGHT8rnkPbHMfXKF+bjcp6CiaW1dxghGysFvE AKVyD41dZJRb8OdfLAiNctKrs8Kf6vBJDKvODTvRsEyit96RcOC0zf61vsKr7iZKb9rz exNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=IwOD6iDE; 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 em3-20020a17090b014300b0024e2afd72a3si1180108pjb.182.2023.06.07.08.23.51; Wed, 07 Jun 2023 08:24:05 -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=IwOD6iDE; 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 S241215AbjFGOxq (ORCPT + 99 others); Wed, 7 Jun 2023 10:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241202AbjFGOxi (ORCPT ); Wed, 7 Jun 2023 10:53:38 -0400 Received: from sonic303-27.consmr.mail.ne1.yahoo.com (sonic303-27.consmr.mail.ne1.yahoo.com [66.163.188.153]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 539E419BA for ; Wed, 7 Jun 2023 07:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1686149610; bh=z7WfrWLOqj/e0upze66XgMmqNTjW0KB/uXTWmgLmriE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=IwOD6iDEYKlTs53Gq2fKQ8K5sHGNPaGMeQCgOwP1ZEoT1/U5AZ7L7BYbyNl5CARVM5osQVjRDgx+ggxoSzhQBQqXD0haNk6xwyl/JcA8PlCiDc5jFyX5Cwy4k2HkM986vuhOa+4ejbqWk1EXQ6TEjIc2lFud292S5tWmObqsH3/RzcK7T4LR9IfpLHKM0pXUUt9C4B/tV2GOItQDCiMYz1r0FRcCfZKveN4911ooVXpXfP0+ozplhOguiCnSJ6HkQDXdfHou9iY5nSqqVbURFBZaBHnZEYnGbh5KJeLNKbXWmqmGJSKZVNDCR9pfCgp4pYDCOnKNVJyEVDUkeJn3CA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1686149610; bh=IhA1zhFnyTiBCtwiEK1UOksqddNI45WkDLitQEBFAgs=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=pPH1EsitPEbAPr1ZNrlBQdcAlA6S+Xa4ASbKHldv9IrzH3UbcsLLcKAssyD3SkpAe9w4nfFodtNx+UlkyS0cSUfuZhbdRKaRGsWHXp8gewGqQKwlvvd6uaQmE0eVWUxP8ygtOU+exo9LgqY+tOHQxlPcLECzk0hJ4diGHn/FHUVx51gar64neiEhm6R2/o9VhRq7OtpsTK18gR+INEK+idlD5nytO1mZJlycL6ud/D4N+guS6MxbmQfTUe1M443kSaq3SWbt3VsWIazrzElH0IPWjtQn0gLuAJtRy0kXmvMZptEu44h5DrF0Ql/qOIz0KasgJRXVO8GoyBxbCO+MBg== X-YMail-OSG: HZ8w05cVM1m3uCKwU.xgOV6FcbkpdEsE1AcpGau1kS6PSznjO7U6CxIU9W5ajuj FYRo3GGuP5SNHPTd5VQzfmK.QmHeIRRdBnp9Qk05sKdu75v1MR7RtSLlf7lXm9FUXfVjuf67xTIM xIHVSFXNbda8G.LYy9xHsMr8ClTqWAOVVPyUESxhDQqUStF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h 8Toc- X-Sonic-MF: X-Sonic-ID: 4431ee77-b22c-414a-a327-2407aa43a036 Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.ne1.yahoo.com with HTTP; Wed, 7 Jun 2023 14:53:30 +0000 Received: by hermes--production-ne1-574d4b7954-scd6l (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 488c8e207d1d5833bf01dbe7d214ec9f; Wed, 07 Jun 2023 14:53:29 +0000 (UTC) Message-ID: <91852af1-eb93-7740-850a-35e5dce9915d@schaufler-ca.com> Date: Wed, 7 Jun 2023 07:53:27 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [RFC][PATCH 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: <20230607123612.2791303-1-roberto.sassu@huaweicloud.com> From: Casey Schaufler In-Reply-To: <20230607123612.2791303-1-roberto.sassu@huaweicloud.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.21516 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_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 6/7/2023 5:36 AM, Roberto Sassu wrote: > From: Roberto Sassu > > 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 setting the ROOT variable to a ramfs mountpoint, 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/log/?h=next > > plus: > > https://github.com/cschaufler/smack-next/commits/next > > plus: > > https://lore.kernel.org/linux-integrity/20230603191518.1397490-1-roberto.sassu@huaweicloud.com/ > > 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. > > 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 | 93 ++++++++++++++++++++++---------------- > 2 files changed, 82 insertions(+), 38 deletions(-) I will run these through my test cycle, but they look good at first glance. Thank you.