Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2690753rwd; Fri, 26 May 2023 09:47:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5EPos7A/gsjMNsthaODBTlxQLZsYs1HMJqsmuZ4QDE0Nx7v59yyVUAQW70CPwmJpruvP2T X-Received: by 2002:a17:90a:c704:b0:250:69c7:a95e with SMTP id o4-20020a17090ac70400b0025069c7a95emr2836833pjt.48.1685119655143; Fri, 26 May 2023 09:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685119655; cv=none; d=google.com; s=arc-20160816; b=RI9ApfiXfwu5Fk9ztlKwpaFb3sfGnR7vyawpdvCa7kBrYpCnA883FAsEv5LzBGSwWF saiZ3fgi2BPDytNpGZ0YeTe8ybcLD7Hp3FNPqcPiEzVwgfUW3dhvUXIS32aE/cwtFWiG z5Gi9Ho3OvJLwiT6eMcpHHDkWIpsiWw9QTF+/S7xN2yoiYuKYbj+59OFEejyR+c689x8 ju3CK2ZCQgIbo4f/4mpOpAyBwPzbCQTB3/2/dPHZin9hjpyYBQn8Joewvf+r8vsZxnk/ OxJHO+xGwIJo/7WYDR74eanLO8pOPPhcEpEhJbarvXWcAw2qomJ/fBs6H6fLCclFLA9g 094w== 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=IyWu6b4SNNMgAV6PniC6cbSE+y9TfUxbVXhn58hHnk4=; b=hWFjNGpVsUHXmn/2jND00biTbLIag7JV3cI7OUCrbMIXbZiaBQNMDtN97I+jcCW5JY drALweZ3QsVzSeQUTh2CZgvTeX8T1M70oHsp5QWmgiFGvO6TsPzqQnQ9d5Z6E51W2QIg zlOhUwwPhP8qLLWn7CzVVo1JbHcdKAt4bXYzxWcjPzP3xajp2adKhCZdum05zdfNJM92 3AP7NxIhc/zOOHGKELlvhZLSPUsWKSdgVQTwhdk2geTBZ/n2tbM4+LEygkM6QnxSAZ8Z wMRtS/cXlPuOMk6OiFUfQWyIXIco4KcqP5NbbBA6giB1V7ohiaxB6d61sBBAQgLcFI6f r+ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=QqUfw9dz; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-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 bv23-20020a17090af19700b002562868ffaesi2013384pjb.184.2023.05.26.09.47.11; Fri, 26 May 2023 09:47:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@digikod.net header.s=20191114 header.b=QqUfw9dz; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236831AbjEZQmc (ORCPT + 99 others); Fri, 26 May 2023 12:42:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbjEZQmb (ORCPT ); Fri, 26 May 2023 12:42:31 -0400 X-Greylist: delayed 550 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 26 May 2023 09:42:27 PDT Received: from smtp-bc08.mail.infomaniak.ch (smtp-bc08.mail.infomaniak.ch [IPv6:2001:1600:4:17::bc08]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06EBE1B7 for ; Fri, 26 May 2023 09:42:27 -0700 (PDT) Received: from smtp-3-0001.mail.infomaniak.ch (unknown [10.4.36.108]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4QSVpc2hLFzMq9gR; Fri, 26 May 2023 18:33:12 +0200 (CEST) Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4QSVpV20JTzMskdH; Fri, 26 May 2023 18:33:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1685118792; bh=HJQhmbmtbBhKQKuJigfXUA3I5dGt5vNd+kwPhAR19ZE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=QqUfw9dzLlsE/jUv5i4Jbgo6yOquEH/LNulEp4j1bWACweWhxdKLOxVud95fbWB4E npEnxoPtqyuJGwkskhuE2oFCSu10WcSFOgyuW8dZTYuf1lnresczWPQXS0hze8B1ou boYfLZK8RC3g7VGc+V2WpOIG30d240jDxiyeRn5Q= Message-ID: <75b4746d-d41e-7c9f-4bb0-42a46bda7f17@digikod.net> Date: Fri, 26 May 2023 18:33:05 +0200 MIME-Version: 1.0 User-Agent: Subject: Re: [PATCH -next 0/2] lsm: Change inode_setattr() to take struct Content-Language: en-US To: Christian Brauner , Xiu Jianfeng Cc: gregkh@linuxfoundation.org, rafael@kernel.org, viro@zeniv.linux.org.uk, dhowells@redhat.com, code@tyhicks.com, hirofumi@mail.parknet.co.jp, linkinjeon@kernel.org, sfrench@samba.org, senozhatsky@chromium.org, tom@talpey.com, chuck.lever@oracle.com, jlayton@kernel.org, miklos@szeredi.hu, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, stephen.smalley.work@gmail.com, eparis@parisplace.org, casey@schaufler-ca.com, dchinner@redhat.com, john.johansen@canonical.com, mcgrof@kernel.org, mortonm@chromium.org, fred@cloudflare.com, mpe@ellerman.id.au, nathanl@linux.ibm.com, gnoack3000@gmail.com, roberto.sassu@huawei.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com, ecryptfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, wangweiyang2@huawei.com References: <20230505081200.254449-1-xiujianfeng@huawei.com> <20230515-nutzen-umgekehrt-eee629a0101e@brauner> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= In-Reply-To: <20230515-nutzen-umgekehrt-eee629a0101e@brauner> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Infomaniak-Routing: alpha X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-nfs@vger.kernel.org On 15/05/2023 17:12, Christian Brauner wrote: > On Fri, May 05, 2023 at 04:11:58PM +0800, Xiu Jianfeng wrote: >> Hi, >> >> I am working on adding xattr/attr support for landlock [1], so we can >> control fs accesses such as chmod, chown, uptimes, setxattr, etc.. inside >> landlock sandbox. the LSM hooks as following are invoved: >> 1.inode_setattr >> 2.inode_setxattr >> 3.inode_removexattr >> 4.inode_set_acl >> 5.inode_remove_acl >> which are controlled by LANDLOCK_ACCESS_FS_WRITE_METADATA. >> >> and >> 1.inode_getattr >> 2.inode_get_acl >> 3.inode_getxattr >> 4.inode_listxattr >> which are controlled by LANDLOCK_ACCESS_FS_READ_METADATA > > It would be helpful to get the complete, full picture. > > Piecemeal extending vfs helpers with struct path arguments is costly, > will cause a lot of churn and will require a lot of review time from us. > > Please give us the list of all security hooks to which you want to pass > a struct path (if there are more to come apart from the ones listed > here). Then please follow all callchains and identify the vfs helpers > that would need to be updated. Then please figure out where those > vfs helpers are called from and follow all callchains finding all > inode_operations that would have to be updated and passed a struct path > argument. So ultimately we'll end up with a list of vfs helpers and > inode_operations that would have to be changed. > > I'm very reluctant to see anything merged without knowing _exactly_ what > you're getting us into. Ultimately we'd like the path-based LSMs to reach parity with the inode-based LSMs. This proposal's goal is to provide users the ability to control (in a complete and easy way) file metadata access. For these we need to extend the inode_*attr hooks and inode_*acl hooks to handle paths. The chown/chmod hooks are already good. In the future, I'd also like to be able to control directory traversals (e.g. chdir), which currently only calls inode_permission(). What would be the best way to reach this goal?