Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4348232pxu; Mon, 21 Dec 2020 10:07:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcuYPAshfjtbVi83+HmXvwqLwawP+O8J4hRI1p59zOkPqh6qUdMJrxb3ZEchkJotawhy9C X-Received: by 2002:a17:906:591a:: with SMTP id h26mr16256891ejq.174.1608574058196; Mon, 21 Dec 2020 10:07:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608574058; cv=none; d=google.com; s=arc-20160816; b=gtPtLzk9KA++jNtxi5ApVpHxpdTSocZJsg4VkBibvlLWSz8Zmcxtcrt2yPyNsMQych gkRJ6DGI/4YXwS/+y6Q09lLU5gXKuaN1cwt2Wzq7zexm+nQHTxlHC4s+34aWrAHTlx1f bY7h7FL15t62EYHThoU2f7I2tb56Pb/VljrSX4aEwXa2crJlfCjy1YrtZcXQtLXMXSiF FfDRiEnmE+TMWG67wW7s0XHwH06qRJPNAq24JnK+r1ylRCSWUJtAkVc2GuwMQhJG8zly U19S8eVbWH3DujRVdkrDz2M/DXi2maryeFIpVjvxIX6dV7tlk4xr+sktQl5V4YR1fjg1 zDlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=6sjtlrhGUxO16NzG5DkLPHVO+T8orGHfRBW16dyzHT4=; b=uolStFjdiWkvqzwfuGtqn3lod/ilF9sdWSITXTumNgxR5UNOURI7fKa0lAGXgVCp7f SxwfX/u5ruETcuoSheiZ47bHx8dAXe1YAcyv6SNmffq0VYItDy+t4CsVQMo57wuNFS1y I8hD9jolvzlZfFoYO/4MLLM1d1O/8IKyQeUjyCdcO/rjJCM4c4Ic8aTfm6xVMq8uKoEa nSDiJyi26e6bXMX+d9LM10tgRUThJIPWOUuBZ6WE8f95V60dwO+xMyKMfQ+9/gipZCHZ WY9JNGvM04/aOzlEAizfkuulhrnWCFrYrGLPBk0EvYZ8Zdvgs8dmFxUcIJzoE7OFfPkE tU4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dD8umJMz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n17si9225966ejs.423.2020.12.21.10.07.15; Mon, 21 Dec 2020 10:07:38 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=dD8umJMz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726422AbgLUSFo (ORCPT + 99 others); Mon, 21 Dec 2020 13:05:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:52754 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbgLUSFo (ORCPT ); Mon, 21 Dec 2020 13:05:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608573857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6sjtlrhGUxO16NzG5DkLPHVO+T8orGHfRBW16dyzHT4=; b=dD8umJMzniuf9lZvWHWdABkktUEdTDbv/yuo555GpGPw8TFitUhyQR6pddTTcFOqs4JiEy b6buBOiRs/m4/GoCkkRRKWkqOqKkYZ5qfSemp+MzcKVsHBOUDnMCKabBv06TDZXV7B1suJ mHy50U0UdSgKhRJggEFwIOtem704Nlc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-vMu3G7ZzMYmvWk1oEPPh9A-1; Mon, 21 Dec 2020 13:04:14 -0500 X-MC-Unique: vMu3G7ZzMYmvWk1oEPPh9A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B32A06D24B; Mon, 21 Dec 2020 18:04:01 +0000 (UTC) Received: from mail (ovpn-112-5.rdu2.redhat.com [10.10.112.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C9041E5; Mon, 21 Dec 2020 18:03:58 +0000 (UTC) Date: Mon, 21 Dec 2020 13:03:57 -0500 From: Andrea Arcangeli To: Andy Lutomirski Cc: Nadav Amit , Dave Hansen , linux-mm , Peter Xu , lkml , Pavel Emelyanov , Mike Kravetz , Mike Rapoport , stable , Minchan Kim , Yu Zhao , Will Deacon , Peter Zijlstra Subject: Re: [PATCH] mm/userfaultfd: fix memory corruption due to writeprotect Message-ID: References: <20201219043006.2206347-1-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.3 (2020-12-04) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Sat, Dec 19, 2020 at 09:08:55PM -0800, Andy Lutomirski wrote: > On Sat, Dec 19, 2020 at 6:49 PM Andrea Arcangeli wrote: > > The ptes are changed always with the PT lock, in fact there's no > > problem with the PTE updates. The only difference with mprotect > > runtime is that the mmap_lock is taken for reading. And the effect > > contested for this change doesn't affect the PTE, but supposedly the > > tlb flushing deferral. > > Can you point me at where the lock ends up being taken in this path? pte_offset_map_lock in change_pte_range, as in mprotect, no difference. As I suspected on my follow up, the bug described wasn't there, but I'll look at the new theory posted. Thanks, Andrea