From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E4DAC433E1 for ; Tue, 4 Aug 2020 19:18:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 591E32086A for ; Tue, 4 Aug 2020 19:18:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="nQ4grv0/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727031AbgHDTSw (ORCPT ); Tue, 4 Aug 2020 15:18:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbgHDTSv (ORCPT ); Tue, 4 Aug 2020 15:18:51 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 836B6C06179E for ; Tue, 4 Aug 2020 12:18:51 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id g19so29877873ejc.9 for ; Tue, 04 Aug 2020 12:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iECZKbCttisI32R5vOBuQe0LHnglBF7s4axnvjSdNlk=; b=nQ4grv0/FGhjcX/X9Q+kj/w809eT436vH2U+X4EgTlnaRGNA7g8vikX3m+zfSmYRaT i6cmBUlwtVL6LQdpbpBz3ozbnlKtLwkowabhGu0920duv5F6NKDItb0IoNMhvkRdBd2i gIIVodOYdnVzl0Ma8TCtUfhW97EQEZHXDBBfE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iECZKbCttisI32R5vOBuQe0LHnglBF7s4axnvjSdNlk=; b=ALqL8neCeoNow0DN8+Ms7S5I3S0iTpTjmgXNmqVgjsHSSL1BVAmTWFne3xrAu1jgSe bo8yWEEZrJaFx68C4ul+T6Tk5xl8ETXhfwn4U4i4+c5U7DWjGkhuPckZzpvErvNgfIDt dinTPTlBby37a3EoFbwLiXscEIBuwhIOeTKhGTPeE7HMzhtMe7Iv4fIpQwuYr/zMKqEc FIwFDo05LvL1gffVLAn0gQsrynXsYvEfyV0YpFGbOdbFfj8/Zs41Cq9JvVz62CGiZUda 7rexlXarjSiCmbxAQ1U81GXYpFFqOtkdbF5RYlB1yrUAE9tdxGcD9OSuR/J5QgMwSMqv cZAA== X-Gm-Message-State: AOAM532hUkxlGBFbaxOdFPx9KPnjJqCOnlbsPFrxTpzj18+2vE7wCly2 4mi7kLm9BG1y7q/mtBFC1gqWqbEeeqXLMljX1ruGMA== X-Google-Smtp-Source: ABdhPJxzCVu2FMIuLxYbxYX+UMEg7zT277U5zuZN2lWf6qdwT1ZHQkTlmDhsVnKdcF178T6jfpPcrpCd3ySV7qJkuu8= X-Received: by 2002:a17:906:4aca:: with SMTP id u10mr20883333ejt.320.1596568729975; Tue, 04 Aug 2020 12:18:49 -0700 (PDT) MIME-Version: 1.0 References: <159646178122.1784947.11705396571718464082.stgit@warthog.procyon.org.uk> <1596555579.10158.23.camel@HansenPartnership.com> In-Reply-To: <1596555579.10158.23.camel@HansenPartnership.com> From: Miklos Szeredi Date: Tue, 4 Aug 2020 21:18:38 +0200 Message-ID: Subject: Re: [PATCH 00/18] VFS: Filesystem information [ver #21] To: James Bottomley Cc: David Howells , Al Viro , "Theodore Ts'o" , Andreas Dilger , Eric Biggers , Jeff Layton , linux-ext4@vger.kernel.org, Carlos Maiolino , "Darrick J. Wong" , Linux API , Linus Torvalds , Ian Kent , Miklos Szeredi , Christian Brauner , Jann Horn , Karel Zak , Jeff Layton , linux-fsdevel@vger.kernel.org, LSM , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 4, 2020 at 5:40 PM James Bottomley wrote: > > On Mon, 2020-08-03 at 14:36 +0100, David Howells wrote: > > Here's a set of patches that adds a system call, fsinfo(), that > > allows information about the VFS, mount topology, superblock and > > files to be retrieved. > > > > The patchset is based on top of the notifications patchset and allows > > event counters implemented in the latter to be retrieved to allow > > overruns to be efficiently managed. > > Could I repeat the question I asked about six months back that never > got answered: > > https://lore.kernel.org/linux-api/1582316494.3376.45.camel@HansenPartnership.com/ > > It sort of petered out into a long winding thread about why not use > sysfs instead, which really doesn't look like a good idea to me. > > I'll repeat the information for those who want to quote it easily on > reply without having to use a web interface: > > --- > Could I make a suggestion about how this should be done in a way that > doesn't actually require the fsinfo syscall at all: it could just be > done with fsconfig. The idea is based on something I've wanted to do > for configfd but couldn't because otherwise it wouldn't substitute for > fsconfig, but Christian made me think it was actually essential to the > ability of the seccomp and other verifier tools in the critique of > configfd and I belive the same critique applies here. > > Instead of making fsconfig functionally configure ... as in you pass > the attribute name, type and parameters down into the fs specific > handler and the handler does a string match and then verifies the > parameters and then acts on them, make it table configured, so what > each fstype does is register a table of attributes which can be got and > optionally set (with each attribute having a get and optional set > function). We'd have multiple tables per fstype, so the generic VFS > can register a table of attributes it understands for every fstype > (things like name, uuid and the like) and then each fs type would > register a table of fs specific attributes following the same pattern. > The system would examine the fs specific table before the generic one, > allowing overrides. fsconfig would have the ability to both get and > set attributes, permitting retrieval as well as setting (which is how I > get rid of the fsinfo syscall), we'd have a global parameter, which > would retrieve the entire table by name and type so the whole thing is > introspectable because the upper layer knows a-priori all the > attributes which can be set for a given fs type and what type they are > (so we can make more of the parsing generic). Any attribute which > doesn't have a set routine would be read only and all attributes would > have to have a get routine meaning everything is queryable. fsconfig(2) takes an fd referring to an fs_context, that in turn refers to a super_block. So using fsconfig() for retrieving super_block attributes would be fine (modulo value being const, and lack of buffer size). But what about mount attributes? I don't buy the argument that an API needs to be designed around the requirements of seccomp and the like. It should be the other way round. In that, I think your configfd idea was fine, and would answer the above question. Thanks, Miklos