Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp10885919rwb; Fri, 25 Nov 2022 08:46:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf4N1KXcv9Bt09G7bvIKTDAiqp2gwAqcZdUxi+sxa2FgQd1tIjV8TwTVglo6GuWvIY7etVAA X-Received: by 2002:a17:90a:448a:b0:218:48f3:2e48 with SMTP id t10-20020a17090a448a00b0021848f32e48mr40669001pjg.36.1669394809080; Fri, 25 Nov 2022 08:46:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669394809; cv=none; d=google.com; s=arc-20160816; b=03VBdM2XdQC72MRq/U2bRcsoQj0lUaUxnMRMKj11k7fChjKoyEnVIhYLI+11bj9+xG 8JYpQsZLfFrpX+DdD59VjVBMcgEeLuut6PwHHxnw10vl4SURiHXRZzy5SJ3/FFQuP1KG WqP2oVBaxgDQ+mmXupXLJIpPuI60pauV9dySTQ8+YbX/AiEHqn1ds3q2MrQC5U1FDqpp oH7bUtb+ECvVYfX4pEHsxZmWrNv6sCXGMyOObKFRGUmFMCjkc8VHPS096YwrMFTl7CjC uAvQvJm61XCIO0X6/OdxZ9G8awPfNv4dmrFLTD+Skw9kjOeok14cH9sndzYRwZvCYjNB 2WvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=x53sQaWDa/88sDZr4eyy32ZPwwt0aIb86EtvxNAGN44=; b=CsSqGMYTN4jSQC4gsEYuNXHKbWMpAYZ5CVi1EvZTSJzXDQ9vxeLONDwFqAKMGRcdBF T795aTEgPbhoAOpo1/YL1MC8t2rqKGvIOf6as3JwYqlHsWcDDQ7zsIh1AFWbtHgdG+rB e31GdqvcR8BvAkDkX6SZ8Yi4gBO9N8+jYd14Uw2iSfOMQpOcj+9oGlYbWZQUTJ3nhLUX 17cRzkR5NM7FuTBLpDsaNCuHY7UElANrbYv/fvRNmRREcdZMIpG+ftGU/0S8rf78NMUX fzRk09Lb5PjqsAzSTIFSZZzRfNAK6sH1LeBXfXXm3JMbvHqH5gcFiMWgZSMNb/hBLPhS dG9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=FgIlSpJU; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l12-20020a170902d34c00b00188ffe7f69fsi4110366plk.251.2022.11.25.08.46.35; Fri, 25 Nov 2022 08:46:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-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=@linux.org.uk header.s=zeniv-20220401 header.b=FgIlSpJU; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229626AbiKYQpd (ORCPT + 99 others); Fri, 25 Nov 2022 11:45:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbiKYQpd (ORCPT ); Fri, 25 Nov 2022 11:45:33 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFB262BB38; Fri, 25 Nov 2022 08:45:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=x53sQaWDa/88sDZr4eyy32ZPwwt0aIb86EtvxNAGN44=; b=FgIlSpJUVdmZH0PghTbL44P7IF e4NY5MC1spnQ/Hghs2BPEnAn4l+90NGdQnegTxnvF3OJ+U61eJwM1xO7mu1dExG7v6tzYFJlIwp6P B2aUL8HMJfhwXPEFKGEUx8W81rpFniQnI/SO1y7EbgaIaJZ1BUdY5gveE/1N4GNXa8B97uvPu85K6 Yklhfru9ymFK8ftcM08F8KvpHHcaOQRkbEAd2Tsqc4ddBcwjQEZAIlZg7vNI/YdzW+wA2axEbhN4Z espCpyFT59uiQWc205hVxBxnTMNyu5Rhgwc6LnCyra/HjzGVoTTOmo0NKot9JbtDIoan182Jla8Wi UlV/To0w==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oyboR-006i8e-1U; Fri, 25 Nov 2022 16:44:27 +0000 Date: Fri, 25 Nov 2022 16:44:27 +0000 From: Al Viro To: Jeff Layton Cc: Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Xiubo Li , Ilya Dryomov , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Christine Caulfield , David Teigland , Chuck Lever , Miklos Szeredi , Bob Peterson , Andreas Gruenbacher , Namjae Jeon , Sergey Senozhatsky , Trond Myklebust , Anna Schumaker , Mark Fasheh , Joel Becker , Joseph Qi , Mike Marshall , Martin Brandenburg , "Darrick J. Wong" , hch@lst.de, linux-kernel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, devel@lists.orangefs.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH] filelock: move file locking definitions to separate header file Message-ID: References: <20221120210004.381842-1-jlayton@kernel.org> <1d474f53670771f324745f597ec94b63a006d687.camel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1d474f53670771f324745f597ec94b63a006d687.camel@kernel.org> Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,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-nfs@vger.kernel.org On Fri, Nov 25, 2022 at 08:23:45AM -0500, Jeff Layton wrote: > I left it in fs.h for now. Some of the file_operations prototypes need > that typedef, and I figure that anyone who is including filelock.h will > almost certainly need to include fs.h anyway. We could move it into a > separate header too, but it's probably not worth it. > > HCH mentioned years ago though that we should just get rid of fl_owner_t > altogether and just use 'void *'. I didn't do it at the time because I > was focused on other changes, but this might be a good time to change > it. Might be... > > > +extern void show_fd_locks(struct seq_file *f, > > > + struct file *filp, struct files_struct *files); > > > > If anything, that would be better off as fl_owner_t... Again, a separate > > patch. > > I'm not sure what you mean here. This prototype hasn't changed, and is > only called from procfs. Take a look at that function and its caller. The use of 'files' argument there is (and can be) only as an opaque pointer to be compared to ->fl_owner; at that point it might be pointing to freed memory, for all we know (and give false positives if already reused). TBH, I'd never been able to finish the audit of files_struct pointers passed into locks subsystem; there definitely are moments when code from fs/locks.c is dealing with pointers to already freed instances - show_fd_locks() at the very least. They are not dereferenced, but beyond that...