From patchwork Thu Mar 9 16:54:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= X-Patchwork-Id: 13168006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62F96C742A7 for ; Thu, 9 Mar 2023 17:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbjCIRIQ (ORCPT ); Thu, 9 Mar 2023 12:08:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbjCIRIA (ORCPT ); Thu, 9 Mar 2023 12:08:00 -0500 X-Greylist: delayed 534 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 09 Mar 2023 09:04:37 PST Received: from smtp-42ab.mail.infomaniak.ch (smtp-42ab.mail.infomaniak.ch [84.16.66.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6BF4ED690 for ; Thu, 9 Mar 2023 09:04:35 -0800 (PST) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4PXb0V2x4kzMrBsq; Thu, 9 Mar 2023 17:55:38 +0100 (CET) Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4PXb0S4yJxz28qt; Thu, 9 Mar 2023 17:55:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1678380938; bh=ogM5pzTOPJ57a+lItppwvkB6tXtQU91aX+WE5VtmmcE=; h=From:To:Cc:Subject:Date:From; b=CVXMq/rQbiuM9zOgGARjrSOVIjtO1kgaAhwvBp8NUHE3mNkiQ/2xHLdfd0MUJvTIg 7v0YEpQaMbG6AGVYpDPVBHqvrjtay+Yzp78DwLMrN8ui7hppXKT7z4HkTYuYsTvjRp ZXF3Ti6YH59tZhuUZi8ONTjjDxyd1oH5LNrvy6fA= From: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= To: Anton Ivanov , Johannes Berg , Richard Weinberger Cc: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= , Christopher Obbard , Guenter Roeck , =?utf-8?q?G=C3=BCnther_Noack?= , Jakub Kicinski , James Morris , Jeff Xu , Kees Cook , Paul Moore , Ritesh Raj Sarraf , "Serge E . Hallyn" , Shuah Khan , Sjoerd Simons , Willem de Bruijn , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH v1 0/5] Landlock support for UML Date: Thu, 9 Mar 2023 17:54:50 +0100 Message-Id: <20230309165455.175131-1-mic@digikod.net> MIME-Version: 1.0 X-Infomaniak-Routing: alpha Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Hi, Commit cb2c7d1a1776 ("landlock: Support filesystem access-control") introduced a new ARCH_EPHEMERAL_INODES configuration, only enabled for User-Mode Linux. The reason was that UML's hostfs managed inodes in an ephemeral way: from the kernel point of view, the same inode struct could be created several times while being used by user space because the kernel didn't hold references to inodes. Because Landlock (and probably other subsystems) ties properties (i.e. access rights) to inode objects, it wasn't possible to create rules that match inodes and then allow specific accesses. This patch series fixes the way UML manages inodes according to the underlying filesystem. They are now properly handles as for other filesystems, which enables to support Landlock (and probably other features). Backporting these patches requires some selftest harness patches backports too. Regards, Mickaël Salaün (5): hostfs: Fix ephemeral inodes selftests/landlock: Don't create useless file layouts selftests/landlock: Add supports_filesystem() helper selftests/landlock: Make mounts configurable selftests/landlock: Add tests for pseudo filesystems arch/Kconfig | 7 - arch/um/Kconfig | 1 - fs/hostfs/hostfs.h | 1 + fs/hostfs/hostfs_kern.c | 213 ++++++------ fs/hostfs/hostfs_user.c | 1 + security/landlock/Kconfig | 2 +- tools/testing/selftests/landlock/config | 8 +- tools/testing/selftests/landlock/fs_test.c | 381 +++++++++++++++++++-- 8 files changed, 472 insertions(+), 142 deletions(-) base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6