Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5455822rdb; Wed, 13 Dec 2023 09:06:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlUZ0//O7hxPdYNqX9NySvp7X5WcmDJjfyosUzEV1Xom+vDGyn61xgXM2ianqF04+xVwWT X-Received: by 2002:a05:6a20:9184:b0:18f:97c:9269 with SMTP id v4-20020a056a20918400b0018f097c9269mr5420677pzd.78.1702487187200; Wed, 13 Dec 2023 09:06:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702487187; cv=none; d=google.com; s=arc-20160816; b=SWA9WyQdqkbeO7AbZGOhwe/qdBavyTC/KFEIIN3fK3x2s8Nnw1qWGkW5rJ6Kn0WvlO buDhClkmr7J36xKw9JPKluzbocskB8v/ntvWREYI3d+jUbtA/fibVN785EkxHTLcBLXy Ewx9Q1aYcvyUNmL00d+OLVrBMiYTnGmGCHwIy6VLNjsBHeUnVVHVzrSJRHjX+fg3X7Pb KhBDuojzCakuoWu9GRZhYmQpNnjqcIDmtuCmxtzcFNxz43jyMhhk3w41OJ7ViKZsEe0h AFKKrOTTKk8kphbugYv8tbNboO2e5Zue7cgKURflImmFYmqqoTV/ne+muuSTnarsr+K3 0SSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=izQi1471NL/cydZbe8/X42uR08bubeTVrkQFcuYiqzs=; fh=Y/X9jTbEAAtbrHKE/Ps5SW0MokKoyfIsiETzGNeGUC8=; b=QicdpugKbS/z0Pa33NEPVFJJJYXMwp+VaDkwZlSobsmut9Fi5DhMRWKaEXJPM7blFt vzsOBeI8lNRgsgmtGIYi8nv11c2U6PR8muNC2fEN2QemGX4p/14DQkTnx8N+W4NafrMF zr9FrZ+Q5aaQnr5N7t+wWEXuzBZJM0c4TBzJAdfMLyKlPOq2hmpTFg2+tC9BsCqX/n+1 g06T24PT5T7MOvI2tVySAPlllxj5DCJanmuFMn2sTG37z/VrmfCjR/evFUpbza7Zzq5W de23nSC5fVlPPglt2lfQawB51tzzHmsJfAQCJYDEUSTIqd74Sgcu5z3WoqhZ6ExQJ0sF wU2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PuDxgmyO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id b22-20020a656696000000b005bdc949fee3si9843963pgw.880.2023.12.13.09.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 09:06:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PuDxgmyO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2EFFA80874F4; Wed, 13 Dec 2023 09:06:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230353AbjLMRF7 (ORCPT + 99 others); Wed, 13 Dec 2023 12:05:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233706AbjLMRF6 (ORCPT ); Wed, 13 Dec 2023 12:05:58 -0500 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B94EF3; Wed, 13 Dec 2023 09:06:04 -0800 (PST) Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-77f8308616eso163758385a.2; Wed, 13 Dec 2023 09:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702487163; x=1703091963; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=izQi1471NL/cydZbe8/X42uR08bubeTVrkQFcuYiqzs=; b=PuDxgmyOLgfAht7UAhnupo6Q3t9Io7QAMqyzTbw6JkfT0hf/KwgODcgwV+uVRSwYgd W2pRnfIFFjcqBTIWut0PO4V6wERa8ZAgdxChZvlL9huHp/aE1I5QuzJ9EtIv80igJaQA 4HfapgSGtUpq69IeOuLtKzPfdxVsIz1DTrgke0SR/Q6JlCl9nHgqHhwqXUY/nkGYgjMI BJ/YNhX2hOhWb3FM1PGNnRDmpA4FTeUznxhRHytYF1kst6samGLpx07P/njI9Zudsu30 24kc1c6ILRUoYj/VGGbhPUpLTNtkm6y/p5jb0IlteFDEYQBJC8vllTj/CrH5BQd/BrvQ oL4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702487163; x=1703091963; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=izQi1471NL/cydZbe8/X42uR08bubeTVrkQFcuYiqzs=; b=cKLD1homxC7bCG86YPBy3GmQcGYn/pbR+WmN7y7CGyT1OY2COEZ0JxPKqA/iVGtjVF LIRxJFOqRtyWnAYdNNe5EugAwjGYYMlGwTXWuQT/4wC+lRYMGdhhbJKNKCF8fHt4yQKk LwXrjJEj6WCODilZ/Eqpu99gUa+zl5h1UUk79P8VLK+GE1eS2ZrSfEEsTZyaHvyIGgPb sX0Hrcl6euyq87fNss7BUzCYZLQFT3UrOjZ/NORDGj1oMh1GrfKeW9y7YrKyRDX3A69m iKjBzQxSUYT1INeu/SPb+/sCKqNGLFvhRCPWccsrHb6smfZsAe8kDaWnC8wjBI/H7Ubd Wdwg== X-Gm-Message-State: AOJu0Ywb9g6jotKgd2HtNJ6Vg/OhZOheGgfJTayU10ee4xgCA2D39Bl3 weaTPZqdVCcIl9arl9enp6ZwsccDEcLF/DB74aQID2oY X-Received: by 2002:a0c:ee24:0:b0:67a:99cb:e2f with SMTP id l4-20020a0cee24000000b0067a99cb0e2fmr6705131qvs.42.1702487163185; Wed, 13 Dec 2023 09:06:03 -0800 (PST) MIME-Version: 1.0 References: <20231211193048.580691-1-avagin@google.com> In-Reply-To: From: Amir Goldstein Date: Wed, 13 Dec 2023 19:05:52 +0200 Message-ID: Subject: Re: [PATCH 1/2] fs/proc: show correct device and inode numbers in /proc/pid/maps To: Andrei Vagin Cc: Andrew Morton , linux-kernel@vger.kernel.org, Alexander Mikhalitsyn , Christian Brauner , linux-fsdevel , Miklos Szeredi , overlayfs Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 13 Dec 2023 09:06:16 -0800 (PST) On Tue, Dec 12, 2023 at 9:08=E2=80=AFPM Andrei Vagin wr= ote: > > Hi Amir, > > On Mon, Dec 11, 2023 at 9:51=E2=80=AFPM Amir Goldstein wrote: > > > > +fsdevel, +overlayfs, +brauner, +miklos > > > > On Mon, Dec 11, 2023 at 9:30=E2=80=AFPM Andrei Vagin wrote: > > > > > > Device and inode numbers in /proc/pid/maps have to match numbers retu= rned by > > > statx for the same files. > > > > That statement may be true for regular files. > > It is not true for block/char as far as I know. > > > > I think that your fix will break that by displaying the ino/dev > > of the block/char reference inode and not their backing rdev inode. > > I think it doesn't break anything here. /proc/pid/maps shows dev of a > filesystem where the device file resides. > > 7f336b6c3000-7f336b6c4000 rw-p 00000000 00:05 7 > /dev/zero > $ stat /dev/zero > Device: 0,5 Inode: 7 Links: 1 Device type: 1,5 > > I checked that it works with and without my patch. It doesn't matter, loo= k at > the following comments. > > > > > > > > > /proc/pid/maps shows device and inode numbers of vma->vm_file-s. Here= is > > > an issue. If a mapped file is on a stackable file system (e.g., > > > overlayfs), vma->vm_file is a backing file whose f_inode is on the > > > underlying filesystem. To show correct numbers, we need to get a user > > > file and shows its numbers. The same trick is used to show file paths= in > > > /proc/pid/maps. > > > > For the *same* trick, see my patch below. > > The patch looks good to me. Thanks! Will you send it? > I can send it, if you want. I wouldn't mind if you send it with my Suggested-by though, as you are already testing it and posting the selftest. Thanks, Amir.