Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp377791rdb; Fri, 6 Oct 2023 06:22:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3Agak0AWfSWjBq03STmqctJ/SAX4TLAfJBHc9Av48MEzA80jSWOE9kXrYaXZuLxHvB7uv X-Received: by 2002:a05:6a00:1792:b0:68f:c8b4:1a2b with SMTP id s18-20020a056a00179200b0068fc8b41a2bmr7172768pfg.17.1696598527417; Fri, 06 Oct 2023 06:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696598527; cv=none; d=google.com; s=arc-20160816; b=rMzE5+1/7wp4tK3i+QTZEh8RkbrsfT0kZwmJh/9HK/DJn20/Wmrg+O3QNo5ZNDehtR zOpGOed4U4ayG2aS3wa0pSX1qyzCIHfflqNkJR7kM3t2166g8zXWvkIJKQdZWIRdOONq Qw5mgPB6/RAprT6AilZReXP81TAboDcwVAhX5M6bqbKvTCJdfJw3fmyguErXV+0Z3n+3 MZuUXq3SBWdOlYLL7HSN5gCKZZqK3mQFBEepeZC03LOSOef4rbXLFuZAKk821Eul9tQx F3EpwfaX9oskUFQ5wmThL93wVpuco9Geait4dncNyrNHJFIl+N8AGAY3nA/aH/LEAIF3 xNxw== 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=qcSsScFohaaUgke/VGA61awbehmAnr/eIu/hS13xN0w=; fh=PeNQ5gXO7G8fvg4fjPOKArPkyY7oyjxVVHTCkHGgM3Q=; b=0YqWxOA+ETqDAhM7ejxeqVQ721n9ba5uB+VURJzs5DPy9OnpvU3Bu+YJfZWT26/kJX Ht7SQM/A6GDiccFO+BJMSW6wXrT5md5IpMIbs9Y3p8IEZ6MH0k3pOM8855EXWTHZcZl7 AGsDGsddthRB+epR8otQGmt4Lf528PXLb0bPOGuj+b2c0JVMCtmqlbcDjj+KvvbZRC6F VdpnFQ1M7HjCZW9YHuSDSO3zEsI0gs+Ia82No3wbRBwziWMXJXCpgv0fr8RhwmcyPpR8 F90I28wEBjRIsX63iM7L+8/B7IFnJF3s9ZzOpyHnAO9QYj+ReEWhkO18J9ED8uZG5+fo jyGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Fr+Gt5/m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ea25-20020a056a004c1900b00690ffbb46e6si780513pfb.261.2023.10.06.06.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 06:22:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Fr+Gt5/m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 3792C82F05EF; Fri, 6 Oct 2023 06:22:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232319AbjJFNVy (ORCPT + 99 others); Fri, 6 Oct 2023 09:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231705AbjJFNVw (ORCPT ); Fri, 6 Oct 2023 09:21:52 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E92083; Fri, 6 Oct 2023 06:21:51 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40572aeb73cso18722705e9.3; Fri, 06 Oct 2023 06:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696598509; x=1697203309; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=qcSsScFohaaUgke/VGA61awbehmAnr/eIu/hS13xN0w=; b=Fr+Gt5/mTWwiEOOIbcxbgWw4Gu2CYGbbrVCcB464d2nkhFWAqYYPNC/VfNLHmzO0+n RuLI6nzdGzA3iEhrt9MP+bptUASPcYTjkYvNqU5uaExM2iE2WdWJmPGIRAgra3VAR9QC aTUE7VOYADVupn1QDraD34wNC08RbawFdaqy7VG0NSmXmLiH2cfkwdbTQJDYRmf+5af2 Y4ZzXJfDiYepagGxUuoM4PWFey/biY/F8qEhs8cBJEzwIdwMU2789OA0MBiPPK5Tl4a9 djB+x3y1ROprJPOWEBl86fR0P0mjskOnGjYOr62K1hFyGGMOt/wvnTbxSEgG1jkzFk0e imQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696598509; x=1697203309; 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=qcSsScFohaaUgke/VGA61awbehmAnr/eIu/hS13xN0w=; b=utFm4jQHP+L2PU0hYN+/iss8jhWr93TKk0eo84Hw9KBCotAQBAylR+76Tl9/cPgK4b PdLKNg0bWg7gxMF4CDg/7/Fh5q0G/M2KYBZEGiFPlU288ecAfkpwtWRvAzziHT4Xel6Q qYMiazIXV3R5qarVNOxOi7XR9ykRd1OxvaOB1qeXtuf/gNGXDSkTit3eOspT2dvOaBjZ aNb0AZE3nThietdJ77HB17BHUQqYxnUo3BgALN6tVIsLN3ZSlAcEj4kUHXjDeXFkhdA7 EMF4o3EzoL0eC+lsaN1MHAGuwp8w9j8jkLpN5N2n/ZzJXfEyxhnHU6bDZ4d6NSHmetj1 y2NA== X-Gm-Message-State: AOJu0YwvGQFa4BF6Fn7dFKaDOj87u9M/5FLICKyfxm6Nly1YMzkyG9ey hcbSZYmUmTKX7fzPTPzF8BPeQWOvGsk= X-Received: by 2002:a7b:c4d6:0:b0:405:3455:d603 with SMTP id g22-20020a7bc4d6000000b004053455d603mr7846261wmk.17.1696598509245; Fri, 06 Oct 2023 06:21:49 -0700 (PDT) Received: from f (cst-prg-67-191.cust.vodafone.cz. [46.135.67.191]) by smtp.gmail.com with ESMTPSA id u7-20020a7bc047000000b004063cced50bsm3760071wmc.23.2023.10.06.06.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 06:21:48 -0700 (PDT) Date: Fri, 6 Oct 2023 15:21:30 +0200 From: Mateusz Guzik To: Sven Schnelle Cc: Mark Brown , Christian Brauner , Jann Horn , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: Test failure from "file: convert to SLAB_TYPESAFE_BY_RCU" Message-ID: <20231006132130.bpekoewcsjqz4qps@f> References: <00e5cc23-a888-46ce-8789-fc182a2131b0@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 06 Oct 2023 06:22:06 -0700 (PDT) On Fri, Oct 06, 2023 at 02:54:04PM +0200, Sven Schnelle wrote: > Mateusz Guzik writes: > > > On Fri, Oct 06, 2023 at 11:19:58AM +0200, Sven Schnelle wrote: > >> I'm seeing the same with the strace test-suite on s390. The problem is > >> that /proc/*/fd now contains the file descriptors of the calling > >> process, and not the target process. > >> > > > > This is why: > > > > +static inline struct file *files_lookup_fdget_rcu(struct files_struct *files, unsigned int fd) > > +{ > > + RCU_LOCKDEP_WARN(!rcu_read_lock_held(), > > + "suspicious rcu_dereference_check() usage"); > > + return lookup_fdget_rcu(fd); > > +} > > > > files argument is now thrown away, instead it always uses current. > > Yes, passing files to lookup_fdget_rcu() fixes the issue. so i wrote this as an immediate fixup. not the prettiest, but should prevent the need to drop the patch from linux-next. diff --git a/fs/file.c b/fs/file.c index 2f6965848907..8d62d6f46982 100644 --- a/fs/file.c +++ b/fs/file.c @@ -1024,7 +1024,7 @@ static inline struct file *files_lookup_fdget_rcu(struct files_struct *files, un { RCU_LOCKDEP_WARN(!rcu_read_lock_held(), "suspicious rcu_dereference_check() usage"); - return lookup_fdget_rcu(fd); + return __fget_files_rcu(files, fd, 0); } struct file *task_lookup_fdget_rcu(struct task_struct *task, unsigned int fd)