Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1512735rdb; Wed, 24 Jan 2024 19:21:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSw+0GbJmS1IlnAm/rEFv44HUXUWOjPVxu2AmaQq7ziFTUh0WcCIdueEqkPp0bw31Pr+5U X-Received: by 2002:a05:6402:1c88:b0:55a:59f1:2b3e with SMTP id cy8-20020a0564021c8800b0055a59f12b3emr182489edb.31.1706152873520; Wed, 24 Jan 2024 19:21:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706152873; cv=pass; d=google.com; s=arc-20160816; b=qw3FLsLaLblcbT2Unj/K3AtWQNfu6TmhyXTkt5Zg5E+XtpS+iomgjZj9CqgYedB51P B9xvDnACBEJ3T+lmRV4AKdhkgSr9zStMd0EfASi/11KYhJ4EZZ2KG5v1b1725opmIELP aNZS1OcrZdJNMdY0BD8T/EZqKhjkfpbaPrLS+4It1CpNxAtZcvUgp+11zGb+IW3qg2Qw gSIxhfTBo3cTdwN0OiiiNZxQrUIYk8xiz7LYwZDC1MiD8dlbUjnaFLPsEHoNvvNsNaok TqaghPq4hjZquNvD+j6KPNi4EE+yc0kI+llFs2gl52j6g9VwjzK6dYpaSjJT1Y1siIDh QGog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=K0ouN+nLZSPECn+2C3BZ1Yg4vdvedoKbDa2WyhtFY38=; fh=YCfBW6m92RFLj73qpv4c1RhGKaRBYcZ4LJ7vHbJW1Kc=; b=DUo9hpfXI8Ypl5h+JWQC6v4xbP/E8Ip5ljTo7P/CKE3uhEsuQp27JDl/LsjrgM4nUH vVqw3tqHMLSvKuTSdNYGAII8sKDPhICSoeBvFSfvwqv4xeu7Rmd2F9lBjn0IDK4ZlIR2 9PuXYzwshwhTd4QbeoLjKd+C5GOExLbuJhRqaz+QNs4Y80gSyulBld3DTTyXigon6BH4 fiWO/Tot7grTjfMuZN+hwSSsOmXQyvOf57lvybKkW6BdRcADpCyScOUTDqq7mMWMQiAr +3G/afjj4/NyN4686d4p39czTEpcwFF9E4tJY8pXjRvvbIYNH2MshD3DVjO0qZN2FsZN IVFw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b="WfdW4f/5"; arc=pass (i=1 dkim=pass dkdomain=yahoo.com); spf=pass (google.com: domain of linux-kernel+bounces-37741-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37741-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a67-20020a509ec9000000b0055c00e5d754si5145738edf.394.2024.01.24.19.21.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 19:21:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37741-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b="WfdW4f/5"; arc=pass (i=1 dkim=pass dkdomain=yahoo.com); spf=pass (google.com: domain of linux-kernel+bounces-37741-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37741-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 88D401F231D6 for ; Wed, 24 Jan 2024 22:31:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE1BF135A60; Wed, 24 Jan 2024 22:31:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b="WfdW4f/5" Received: from sonic306-28.consmr.mail.ne1.yahoo.com (sonic306-28.consmr.mail.ne1.yahoo.com [66.163.189.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF416C2C2 for ; Wed, 24 Jan 2024 22:31:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.163.189.90 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706135478; cv=none; b=sFok/hepIRu+Gj51NZ4QWd1ByRGDMw9li1fLkpicbqsBQL73siXc9+BsPgdjsXoRgxpSUDvNjPPOXIvOn12Y+1d2tb2uFg9/CzkJGm8TYkUAPUP0N0DaN7A/HD/CtGBt8Vp/gGM13RTvV8O0nctBuOm9Awqw+4+rVfbYwn4RS9M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706135478; c=relaxed/simple; bh=ncNSKEB8i9H7xvUfioYYp/VoOJk3T8giU+CM5F/GyMc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=PSux8AzUWpluW3YR/I8BSgHyLztixWoeEZ369iR/m/sUWDh+jYQlKONN05J1X1rh/FZtz7blLd3x4eU/AaPXoxbWy7XvUEAfmn7z5wjZHMygUKp+O2dHBFA7SakTsPf0QywscKicOLb+8sLQ5yB3VArWAPdv0CioOUXt8SFPG7o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=schaufler-ca.com; spf=none smtp.mailfrom=schaufler-ca.com; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b=WfdW4f/5; arc=none smtp.client-ip=66.163.189.90 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=schaufler-ca.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=schaufler-ca.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1706135476; bh=K0ouN+nLZSPECn+2C3BZ1Yg4vdvedoKbDa2WyhtFY38=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=WfdW4f/5Ih/OSgNo+DyKRspxX32wxUbEljnupK8L/tmlybaoOAp0hA5BufPxvbdes56X+izqlCnHdW+P3y+bfGoR6u7tO21KUi/GBYsvNFgGHIXbF2PBOWaK1z1NxDQoUKiCu0QmC1iOeFnzfcyaJuqa/+RDXyIFXSk0i04hjrOzDTdLV7vbamwHt9OMzA2IJ802n7AYRotDMpDQyWz3GOsznBIjC2MvSAO8ZhpnxXql2hQzvuQ+RfEsqhqlm/CRUJSLnfin/GaElX3Nq2Y+vc4Bcqx5c2MLQgQKq47twjcLQnMzRuDw/LGXQGId1FvyDEhqizhsDFbc1N0LFyoZow== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1706135476; bh=DcO2p7KfHcK7ga62DQFXNKrpo3809blgw1ZKffA497L=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=s2dUkVw9XFE2zhyd5fnK79XZj3QxHpsFex4MxhxZdwR92qYGAH4KmHO3xQWZW7lJuIRb0QIdeWeQ79fsLs6U+fvC1FLG47xOqubEKWjFVTPJHS5NvRnfVRMT8YfTjveldnU/TkGS0C3rYMRw71hTC+dYDgzZR4uzECnS/giJSHP4mTC8wGsDw+uKvBg94PU/tKALGvhd1qXl9v2GukIN4vTg/SHFZnKz9iK1H/e/bUfsP+gsM6Ow9LLs1U+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vyl626rMf vpDCjQ7I2UXNqeLuBPSexLOvAkvwANRLj2E5FDHZFf50p9ZEYnrqHbeU1q.k6eW5z6oC.1osuLLU eZMEQivgAMgBDmovxK6n__iYK_gTrHFC9XFBZCvE7rLz_uEkh2PEBnGpODOuVjKL7h5tqFmg3Ims En.j7nuZzWuhp.ZfX6n7rKGGcRjjsFMN.Qcf0z6u60t6VmArRP95OI8xjh3AcPGRKiJsXJ18QFYI VPGPUh_Zoz7CN.mVfi.N2Ypl1r944dD4HTJTQjglGohEOxPx29mK2gndUyoo0XNVzCrzyu.j9hDg 8vd3DRzie_Qgq X-Sonic-MF: X-Sonic-ID: b3c06742-66d1-4933-9b7c-458d5954b9e7 Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ne1.yahoo.com with HTTP; Wed, 24 Jan 2024 22:31:16 +0000 Received: by hermes--production-gq1-78d49cd6df-mnx8f (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 5c48bb728c9087adeaa06b5a440f689f; Wed, 24 Jan 2024 22:31:12 +0000 (UTC) Message-ID: <53897379-0c7a-4da7-870c-1eb7e822a129@schaufler-ca.com> Date: Wed, 24 Jan 2024 14:31:10 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 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: <20231116090125.187209-1-roberto.sassu@huaweicloud.com> From: Casey Schaufler In-Reply-To: <20231116090125.187209-1-roberto.sassu@huaweicloud.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.22046 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo On 11/16/2023 1:01 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, I have taken patches 1-4 in smack-next. I'm still waiting on a convincing approval for patch 5. > 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. Tests were not executed on v3 (trivial changes). > > 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 lsm/dev, commit e246777e2a03 ("MAINTAINERS: > update the LSM entry"). > > 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 > > v2: > - Replace return with goto in the ramfs patch, for better maintainability > (suggested by Andrew Morton) > > 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 | 32 ++++++++++++- > security/smack/smack_lsm.c | 95 ++++++++++++++++++++++---------------- > 2 files changed, 86 insertions(+), 41 deletions(-) >