Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1045960rwb; Fri, 18 Nov 2022 11:53:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf7gp/OsDpRdKG91Hs0l2sQBWFYV2e4zK+ERg66UJGrAuvhZH8m045vllpiz59Sy65q2JCX5 X-Received: by 2002:a17:90a:2b46:b0:213:aa5f:a026 with SMTP id y6-20020a17090a2b4600b00213aa5fa026mr8998971pjc.243.1668801225081; Fri, 18 Nov 2022 11:53:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668801225; cv=none; d=google.com; s=arc-20160816; b=wsIXRwQEdVl2ayaJsfKcw1ShNRLzKdTk+8xgu4OWTWlXKQbyN6ui6+ptuOqTR/Kx7U f5+ptuCECpaOH2VcS9gpQwaQJ8+0TbNf+eX6+jqImLFdbQp70xry8pbqYX6w08a3EEmt hLOf5Lvxkx+KOZB6DA8hDRhGE9c1QSAvlMY+Zt4+ZzcucyDbabhKIFGp8jp0q8/baqXG Z3bjoJkaWeAiA/qMQ1he+OvfPhfyE6ocTjTX4yCMxP8wnGrHLWwgK/rf/mrF6S3ftvHx 04jSEnddYEIvCsNerwOz+hckFH7eVXFHkaD4Qp2/iry+65Kl0j7n/KUM3DJZANF+WUJO sKIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AG1SKrUV7k0X5TWOfCvNitOlF8TPG3jUR8Z8g6cbZlA=; b=F5tIRRzAFXQEGIxsyLc8OQnWfba6SWVSaya/r/VhsXnO3BLEk8G4hR3PW9aH9gLfyC ZcmpxS8jQ8qlJ53Z5vTasQBZ38G69Q2JKNzGKN2nJYLRBazXi0iXDwP6JuIllxmCHY51 WFUNJX9d1BkpSWAJfrmokgbZ8DSG4Pbuks+3wTBERTAL7IIzDjlOsDFaHsQjTEj1phyw 3aELZoVKzYDzJXUrLVnkGMBrl8U8j9/tzxE7RDihfQrOfxRKqkW0fJ7LpKkKrtHOUfA0 ZxW41/UKEAA8QzqQYFy2NGAaThIgdqkzsHq+WaktRwHZTuvpTgP8GbT+9QXo4kN1VY90 R76Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="bb/NbTGi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k18-20020a056a00135200b00571e1bb9312si4537561pfu.173.2022.11.18.11.53.31; Fri, 18 Nov 2022 11:53:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@redhat.com header.s=mimecast20190719 header.b="bb/NbTGi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235286AbiKRTea (ORCPT + 90 others); Fri, 18 Nov 2022 14:34:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235666AbiKRTeY (ORCPT ); Fri, 18 Nov 2022 14:34:24 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4130A2D5 for ; Fri, 18 Nov 2022 11:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668800004; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AG1SKrUV7k0X5TWOfCvNitOlF8TPG3jUR8Z8g6cbZlA=; b=bb/NbTGioALLx/x7qW2DkG+xfag0CQQUTq+VRmYpxbsN+0TPoJizfvkN1EDiRmS7rccyru d6pcutmLPXQ2jQ41nvzWpyMWJpEhjgwoZ1uAkE5MKSpZfrIUZrBunx5DBe8jw6v36f2/OE i5fdWtYNaW8mtHUzkSJHM9claONETlU= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-141-n_LDrY5YM6mHxHOfEqTmjA-1; Fri, 18 Nov 2022 14:33:23 -0500 X-MC-Unique: n_LDrY5YM6mHxHOfEqTmjA-1 Received: by mail-qt1-f199.google.com with SMTP id i13-20020ac8764d000000b003a4ec8693dcso5866562qtr.14 for ; Fri, 18 Nov 2022 11:33:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AG1SKrUV7k0X5TWOfCvNitOlF8TPG3jUR8Z8g6cbZlA=; b=uWtRCiYxCuZI9Tf5x6j3wSRACzO9NjVsOIz13iXDZ5b5yDU7BGc6upbQPNTcwKaXKF lQ0QnjawyX41lhJB0a0Xv2MhUJ5CYF2KxYLjAKKDpYlZTapHTxgeL5sguUyfMCptprMz lOPd3560P0P1Ho2gwLtRc3wgt5ah5yp8AkZQyDmnBBc2+17Zj3/BSLUGuTLBw6KBdCLz xtxJK4kZo9PQIagLwLHPjeRz5f9u4VmefbCNBGzIJX9sUWEmVcj5J6boSuLhjZ2wR1pv isvvNF1Y1QASABACA+HZjwXPcpQRpPoBbKqDrGTYBZ+iHmnPDgUvN3LQ7mAQmh0smady XYOw== X-Gm-Message-State: ANoB5pnLX7QD7CTn6LeeG1Sh/clcZvVYz191U6pdkL/U4LcNtUQD7nUa lYIPBmBFjojDCLamMs8hAiOOkqElURGwDtwh9aB8j5CDGiclp0r4o51dq0iliGXZc8W/cnHsFFF XKShU4TOWhtJ1CQLn+TWGnnSB X-Received: by 2002:a0c:f254:0:b0:4af:b70e:1305 with SMTP id z20-20020a0cf254000000b004afb70e1305mr7988783qvl.127.1668800002825; Fri, 18 Nov 2022 11:33:22 -0800 (PST) X-Received: by 2002:a0c:f254:0:b0:4af:b70e:1305 with SMTP id z20-20020a0cf254000000b004afb70e1305mr7988767qvl.127.1668800002597; Fri, 18 Nov 2022 11:33:22 -0800 (PST) Received: from bfoster (c-24-61-119-116.hsd1.ma.comcast.net. [24.61.119.116]) by smtp.gmail.com with ESMTPSA id a13-20020ac84d8d000000b003a5430ee366sm2391449qtw.60.2022.11.18.11.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 11:33:22 -0800 (PST) Date: Fri, 18 Nov 2022 14:33:27 -0500 From: Brian Foster To: Ivan Babrou Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@cloudflare.com, Alexey Dobriyan , Al Viro , Theodore Ts'o , David Laight , Jonathan Corbet , Andrew Morton , David Hildenbrand , Johannes Weiner , Christoph Anton Mitterer , Mike Rapoport , Paul Gortmaker , Kalesh Singh , Christian Brauner Subject: Re: [PATCH v4] proc: report open files as size in stat() for /proc/pid/fd Message-ID: References: <20221024173140.30673-1-ivan@cloudflare.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham 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-kernel@vger.kernel.org On Fri, Nov 18, 2022 at 11:18:36AM -0800, Ivan Babrou wrote: > On Fri, Nov 18, 2022 at 11:10 AM Brian Foster wrote: > > > +static int proc_fd_getattr(struct user_namespace *mnt_userns, > > > + const struct path *path, struct kstat *stat, > > > + u32 request_mask, unsigned int query_flags) > > > +{ > > > + struct inode *inode = d_inode(path->dentry); > > > + int rv = 0; > > > + > > > + generic_fillattr(&init_user_ns, inode, stat); > > > + > > > > Sorry I missed this on v3, but shouldn't this pass through the > > mnt_userns parameter? > > The mnt_userns parameter was added in 549c729 (fs: make helpers idmap > mount aware), and it's not passed anywhere in fs/proc. > > Looking at other uses of generic_fillattr, all of them use "init_user_ns": > Interesting. It looks like this would have used mnt_userns from vfs_getattr_nosec() before proc_fd_getattr() is wired up, right? I'm not familiar enough with that change to say whether /proc should use one value or the other, or perhaps it just doesn't matter.? Christian? Brian > $ rg generic_fillattr fs/proc > fs/proc/proc_net.c > 301: generic_fillattr(&init_user_ns, inode, stat); > > fs/proc/base.c > 1970: generic_fillattr(&init_user_ns, inode, stat); > 3856: generic_fillattr(&init_user_ns, inode, stat); > > fs/proc/root.c > 315: generic_fillattr(&init_user_ns, d_inode(path->dentry), stat); > > fs/proc/generic.c > 150: generic_fillattr(&init_user_ns, inode, stat); > > fs/proc/proc_sysctl.c > 841: generic_fillattr(&init_user_ns, inode, stat); >