Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4888081pxj; Tue, 25 May 2021 20:09:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwp9sDD+i7jQcyYGTLhurpbmQTa1ib5cJf9zI8YhaOa3uYxYjkUstcoepUV05X+PEvXrLYA X-Received: by 2002:a17:907:c01:: with SMTP id ga1mr12501837ejc.80.1621998573389; Tue, 25 May 2021 20:09:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621998573; cv=none; d=google.com; s=arc-20160816; b=E+dK+MoT1NemUPwGc7K0Crle8X0cQlDfNKUHDRvjoeytPDbwF9BAd340x0hKWfTwxF lm4GsmHsawLOCdZchibiXVWur8eCtuODe2+4BYMiB/dcekWCDgT+7IbfJb97J3J6ebgm KPngx1Ljc5mjlxPUPEuizIel+usnDytpZ/hiCoqnqtVdsBghNB8rEXDtOErMZiziGzBx Vgc1053URIULwwcrSybCFoswNKjHcv1lb/LE97YtEWlJKgOSiQIrYiPPXC+FtYDcnqgj wKB/rG30Ugdo8QvoDv7sn3KrHJ356n1IlKnA6kofJu5LJUPuKV+oQdYoTXee19Xx1IwE SzzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=8BLp9mtv2B4AZWLCGmDbIMKAprCSKbftBAyZAx7qkdk=; b=ISmYEWpX4G4H0lE0e40ZG/xgGc+UGG/smZZjwd+OYgMsjI/+TlcSjy8qe2mct/GPp5 jh8K5n/i97S0L5hlw7pLqB4WMeQ0reFrndOyGtrhKlpgkH1/YdOMrt4LFqXdyo7Rokfw rz6YfHJoFhgVP6UPZUxJnqG2YFesgLyta+EDilGaWQi7kZ1udlrBuOD6qBaBUTtYM13R NeUVkUEaT+5fI6FW5T3bnLiSAXP/DT5itn0I5XRH1N+lg4g8QQnJ7NwSXc2GMVmhT6Gq zYB6ZhHYQlTU+cBWXMJJd4rEIU4qkMAMByQGFqNfG/oFe94rirrIuH99fesHn2cOVhbR C+Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="kSfWwaZ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si18768767edu.311.2021.05.25.20.09.10; Tue, 25 May 2021 20:09:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="kSfWwaZ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230478AbhEZDGE (ORCPT + 99 others); Tue, 25 May 2021 23:06:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:46250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbhEZDGE (ORCPT ); Tue, 25 May 2021 23:06:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 323BE61059; Wed, 26 May 2021 03:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1621998272; bh=V4OpdXOQ49FmWgr/xUUxYOmoUsWXjcuopfW08hMrjv8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kSfWwaZ/I/MUjqP8ClC5NFBBhtbtwTtUV5fuaH+f597H5ZPRBtKz5JzjREaFInqZN FF4Kp0lT5LeFOBHGqlx8A6hjo0/JRkSpISjVFlOo2PsY5bfR57DXmbJt/Ngf/fyA/H YBq8GQ0THZbtXlJib70TNVVst5pdpdbC8jp65eTQ= Date: Tue, 25 May 2021 20:04:31 -0700 From: Andrew Morton To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Kravetz , Mike Rapoport , Axel Rasmussen , Andrea Arcangeli , Hugh Dickins , "Kirill A . Shutemov" , Jerome Glisse Subject: Re: [PATCH 2/6] mm/userfaultfd: Fix uffd-wp special cases for fork() Message-Id: <20210525200431.41eb48106ba681151f320afb@linux-foundation.org> In-Reply-To: References: <20210428225030.9708-1-peterx@redhat.com> <20210428225030.9708-3-peterx@redhat.com> <20210525171558.3b223a89c16bdf002f3e83cf@linux-foundation.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 May 2021 20:36:18 -0400 Peter Xu wrote: > On Tue, May 25, 2021 at 05:15:58PM -0700, Andrew Morton wrote: > > This run afoul of Alistair's "mm: Device exclusive memory access", > > https://lkml.kernel.org/r/20210524132725.12697-8-apopple@nvidia.com > > > > `vma' is now undeclared. I think this? > > > > --- a/mm/memory.c~mm-userfaultfd-fix-uffd-wp-special-cases-for-fork-fix > > +++ a/mm/memory.c > > @@ -850,8 +850,8 @@ copy_nonpresent_pte(struct mm_struct *ds > > * exclusive entries currently only support private writable > > * (ie. COW) mappings. > > */ > > - VM_BUG_ON(!is_cow_mapping(vma->vm_flags)); > > - if (try_restore_exclusive_pte(src_mm, src_pte, vma, addr)) > > + VM_BUG_ON(!is_cow_mapping(dst_vma->vm_flags)); > > This one looks good, as both src_vma/dst_vma should have the same flags related > to is_cow. > > > + if (try_restore_exclusive_pte(src_mm, src_pte, dst_vma, addr)) > > Should this be s/dst_vma/src_vma/ perhaps? Alistairs please correct me > otherwise, as it tries to restore the pte for src mm not dst (the child). > > I haven't yet got time to look at the new series, planning to do it tomorrow > maybe.. but I see that it's already queued in -mm. Andrew, we do have chance > to go back if necessary, right? Sure. > I haven't looked at the rest, but I think try_restore_exclusive_pte() can at > least drop the *mm pointer as it's never used (even if we need, we've got > vma->vm_mm too).. OK, thanks. I just released a tree into linux-next (hopefully this blooper won't cause too much damage). Please send a suitable fixup.