Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1023130rwb; Fri, 18 Nov 2022 11:30:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf78enp8+gf2LHxvs/CSxYZpdaRRyQ+jR9dRXO0JYZHlK22YqS7Wn4gDT8s02hm/nLXze9id X-Received: by 2002:a17:902:8503:b0:178:4f50:673e with SMTP id bj3-20020a170902850300b001784f50673emr881343plb.126.1668799808147; Fri, 18 Nov 2022 11:30:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668799808; cv=none; d=google.com; s=arc-20160816; b=r8gmBhB1Dn9f4fEHPctqq3VobI3c7YwNaj/42IJqcsPNzEM1bLlG6VMtGOBKMa9rQK hZDgPe79cskazhhgmjYd+siCVPZUmiCwEyAJi/btFqGspDM9C78jWvzBp2y0Vv94oriU C4odaeumELIm2MRR+Qxb31/U39hmMKTRobngRle3X13ZS2+Mpw4eLjd79rdPyKaActLE YTD60W+TwKjY8nk4yQW2+EHimFH10Ip9gUenQ3qNiEV3hgm4q7IJDgKG2gSKlVCvjXCL 0gxLgZNLbuG4H6/V9NP56oIBzSgEpm0cA2CDdUUf5E6498jEuNTqKF5wZr742Bne67Em beEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=46Lq8zuv/x+zWGVVLn8B9wakNtwzIPndWxRzWrLURwI=; b=BsCGghq65lnB0WTRnQQ1ypeBLEy0ZhE9cVCFxuFu1eCItSd7vLhFzSQELcQfayTIqE LNKn3uar6Rph4DLG9PeHvVB8v5v49mFXW+txEiLZGa+rbqEUbAW1j0SMSI260l20bODw 5vQ0HWRRT8FhpaR8RC+19JDn6cezYzj9s4G5cQzC6cOw0AUisMfxuOftjNenMQalDTdF Qz6G3KgCLITDqc7gPjkX7JguM+DmufaEJxhuxZRdjP8iSDSY0R/a170R7/oe8BN5arCp jPUYSPUcwzOfmqjDWAkxu4MHPyorSrX4T379Y4JNPIz1iwnDrh28Z+PVhc3yU9eEgeA0 WtQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=MGOXMi+2; 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=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w20-20020a63fb54000000b00461ffae7b37si4519643pgj.0.2022.11.18.11.29.56; Fri, 18 Nov 2022 11:30:08 -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=@cloudflare.com header.s=google header.b=MGOXMi+2; 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=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235244AbiKRTSy (ORCPT + 90 others); Fri, 18 Nov 2022 14:18:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235350AbiKRTSw (ORCPT ); Fri, 18 Nov 2022 14:18:52 -0500 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63B586155 for ; Fri, 18 Nov 2022 11:18:48 -0800 (PST) Received: by mail-yb1-xb35.google.com with SMTP id b131so6726345yba.11 for ; Fri, 18 Nov 2022 11:18:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=46Lq8zuv/x+zWGVVLn8B9wakNtwzIPndWxRzWrLURwI=; b=MGOXMi+29GCwoeEFPsCLzpqC6GQd1fnoo6yb4wXlQh/IPqXLDzUy42z8COoPDR7RNl n1wa3LjO0IdKfcUjxJ1Yj5HXaWdIIjI5zLXfW+7kS1tJvj6oEejbNd6fQEnNv857kjPr P1Qh2dfNfoegYVnhRUAClhh6v8XimaujhUs/I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=46Lq8zuv/x+zWGVVLn8B9wakNtwzIPndWxRzWrLURwI=; b=FmrQVwpB+oTuZ0GsVdZXDOmZDgnaN6znknsvHDiQBrdRR9gqQQGPJg8vF7Q34ELeUa P3ECi/VaTiRtdKM76Jd2+NJtvmyHHDaEMJumD/cx8C/u5pQWBVPj4T1GILa8RZ4JO/aM lYjDnWTE+4N08uUm9lWdHJK9ABZQghDFwpn+pIiLmAjfQYCq+dENTwRHPMQ3MX0znMMW tJ6KqVvMzq1h7YL0HTveAPTbAsuLKw4p20Fp2OvDAtPwOsnEqpyR1/ATcNLdrqRWFZ3H CNlAsdAA9L780PvM9fPnK3njKT3YOuDQF2AbjS9xKkoYbtEHkeBrIMZBGgFdpsHJulNq rZ0A== X-Gm-Message-State: ANoB5pmhahokkNRKJIoaYdZ/+FOUiOVmyUx4ymuE49PMouzvZ6nx62xG YZ91hlm6NBN2SgPsLNFcimxCJ/u2wfN9v+62gKk6Bw== X-Received: by 2002:a25:3c07:0:b0:6c3:f821:4d0b with SMTP id j7-20020a253c07000000b006c3f8214d0bmr7823680yba.201.1668799127612; Fri, 18 Nov 2022 11:18:47 -0800 (PST) MIME-Version: 1.0 References: <20221024173140.30673-1-ivan@cloudflare.com> In-Reply-To: From: Ivan Babrou Date: Fri, 18 Nov 2022 11:18:36 -0800 Message-ID: Subject: Re: [PATCH v4] proc: report open files as size in stat() for /proc/pid/fd To: Brian Foster 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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: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": $ 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);