From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BD95C77B7E for ; Thu, 1 Jun 2023 15:37:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234932AbjFAPhm convert rfc822-to-8bit (ORCPT ); Thu, 1 Jun 2023 11:37:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233956AbjFAPhl (ORCPT ); Thu, 1 Jun 2023 11:37:41 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A32A8FB for ; Thu, 1 Jun 2023 08:37:39 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-263-AHup6Xd1OrWFzyw2F6GqSw-1; Thu, 01 Jun 2023 16:37:36 +0100 X-MC-Unique: AHup6Xd1OrWFzyw2F6GqSw-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 1 Jun 2023 16:37:32 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Thu, 1 Jun 2023 16:37:32 +0100 From: David Laight To: 'Jan Kara' , Christian Brauner CC: Al Viro , "linux-fsdevel@vger.kernel.org" , Miklos Szeredi , "Darrick J. Wong" , Ted Tso , Jaegeuk Kim , "linux-ext4@vger.kernel.org" , "linux-xfs@vger.kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" , "stable@vger.kernel.org" Subject: RE: [PATCH v2 4/6] fs: Establish locking order for unrelated directories Thread-Topic: [PATCH v2 4/6] fs: Establish locking order for unrelated directories Thread-Index: AQHZlJ1FZufsO2GDRE+EhxV9kbhF9692EqgQ Date: Thu, 1 Jun 2023 15:37:32 +0000 Message-ID: References: <20230601104525.27897-1-jack@suse.cz> <20230601105830.13168-4-jack@suse.cz> <20230601-gebracht-gesehen-c779a56b3bf3@brauner> <20230601152449.h4ur5zrfqjqygujd@quack3> In-Reply-To: <20230601152449.h4ur5zrfqjqygujd@quack3> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org ... > > > + * Lock any non-NULL argument. The caller must make sure that if he is passing > > > + * in two directories, one is not ancestor of the other Not directly relevant to this change but is the 'not an ancestor' check actually robust? I found a condition in which the kernel 'pwd' code (which follows the inode chain) failed to stop at the base of a chroot. I suspect that the ancestor check would fail the same way. IIRC the problematic code used unshare() to 'escape' from a network natespace. If it was inside a chroot (that wasn't on a mount point) there ware two copies of the 'chroot /' inode and the match failed. I might be able to find the test case. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)