From patchwork Wed Sep 13 15:22:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 13383296 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 4E618EDEC75 for ; Wed, 13 Sep 2023 15:23:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241405AbjIMPXn (ORCPT ); Wed, 13 Sep 2023 11:23:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239049AbjIMPXl (ORCPT ); Wed, 13 Sep 2023 11:23:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3D800E6D for ; Wed, 13 Sep 2023 08:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694618564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=fibNFcMGfhpyzyB1Dlmhk6FIYISVfSif6JjtonTL8MA=; b=JOYAFWqAwP37RIR06nLRZaxujQqkxnguiKhfEOH0PvkrQFzqA44JXIb9DLh4FHlUeSmzHd vOK+xpXF9FmYIba16wa/DBk5l4GMdYI2pg9OAzYC2Nnsf//Zwl+F97dPVUk/4pwD3iNJoz jdzAfDToY1CB8dOAsZcxda70MPo7uhI= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-259-MUGNUU-EM9-y3iDQRdsxkw-1; Wed, 13 Sep 2023 11:22:43 -0400 X-MC-Unique: MUGNUU-EM9-y3iDQRdsxkw-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-99388334de6so459314266b.0 for ; Wed, 13 Sep 2023 08:22:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694618561; x=1695223361; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fibNFcMGfhpyzyB1Dlmhk6FIYISVfSif6JjtonTL8MA=; b=YG5uJWzwTeicjXxgrH/S4irh2E2cjfJE3apeSUXUbtM158ViyH6N5sLfqpFkjQ7IPr kJs56w/qbZzGYrCK8w32dpmna8u1a1T2KZf2jNLfA6U5aqiga2c5vlu522c0GLfIXemX 1CsKlH4R2V9EIQ0ZehIwHTP8ZMfmhqaFy+eYPf1vVZJdr/461GZVivfUyc0+YcV7xj6g Iw9HfmgNETGpBE3FGLqFQPjkzIZRLLRhaA+pah3dtjASZh/StNwjWz7Hs3RfhskWpOh2 bhugcymc6//a4E43W4avyfF9A78vBhNITTz6Au0XdfiFOsv2ZfHC1vESLSlhvHlVo7zr 7SAA== X-Gm-Message-State: AOJu0YyJ4iblMQNF39oe8kjDoUaJWDN1WungaQbD0PlsPJjoJpUVmWGt BH5yW2VW3+6YzKvl2dgRZ4VVA1aqbPRiNShqXlWU8HyEkuiYD4L21yDS0gzf4Ar0hAlEvHU06wY kXa9A6XSEzfQjEI2TkhmwyVSpxDWQv/yvv0Zs5VCafuZ68i0Zz1dlhUzouXH0Khb5dV62oC9dUZ orwI/UsvM95g== X-Received: by 2002:a17:907:7742:b0:9a5:d657:47ee with SMTP id kx2-20020a170907774200b009a5d65747eemr2413316ejc.58.1694618561578; Wed, 13 Sep 2023 08:22:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCeVwF2+JcYHZGB2lIjCz1DTX4prKbW5ev4Hq7EfxD4YhEjBelhKvfKIbxLCPEf3bhJHP1ig== X-Received: by 2002:a17:907:7742:b0:9a5:d657:47ee with SMTP id kx2-20020a170907774200b009a5d65747eemr2413286ejc.58.1694618561127; Wed, 13 Sep 2023 08:22:41 -0700 (PDT) Received: from maszat.piliscsaba.szeredi.hu (79-120-253-96.pool.digikabel.hu. [79.120.253.96]) by smtp.gmail.com with ESMTPSA id q18-20020a170906a09200b0099b8234a9fesm8640663ejy.1.2023.09.13.08.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 08:22:40 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-man@vger.kernel.org, linux-security-module@vger.kernel.org, Karel Zak , Ian Kent , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein Subject: [RFC PATCH 0/3] quering mount attributes Date: Wed, 13 Sep 2023 17:22:33 +0200 Message-ID: <20230913152238.905247-1-mszeredi@redhat.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Implement the mount querying syscalls agreed on at LSF/MM 2023. This is an RFC with just x86_64 syscalls. Excepting notification this should allow full replacement for parsing /proc/self/mountinfo. It is not a replacement for /proc/$OTHER_PID/mountinfo, since mount namespace and root are taken from the current task. I guess namespace and root could be switched before invoking these syscalls but that sounds a bit complicated. Not sure if this is a problem. Test utility attached at the end. --- Miklos Szeredi (3): add unique mount ID add statmnt(2) syscall add listmnt(2) syscall arch/x86/entry/syscalls/syscall_64.tbl | 2 + fs/internal.h | 5 + fs/mount.h | 3 +- fs/namespace.c | 365 +++++++++++++++++++++++++ fs/proc_namespace.c | 19 +- fs/stat.c | 9 +- fs/statfs.c | 1 + include/linux/syscalls.h | 5 + include/uapi/asm-generic/unistd.h | 8 +- include/uapi/linux/mount.h | 36 +++ include/uapi/linux/stat.h | 1 + 11 files changed, 443 insertions(+), 11 deletions(-)