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 9F4CFC47089 for ; Fri, 2 Dec 2022 15:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233666AbiLBPlr (ORCPT ); Fri, 2 Dec 2022 10:41:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbiLBPln (ORCPT ); Fri, 2 Dec 2022 10:41:43 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33FFCC4609 for ; Fri, 2 Dec 2022 07:40:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669995651; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ukZurXWBYF9XacBE0s0LYySmWKNtgdpXiH8C9SL7Axg=; b=fVNlgw8LliFz07cPxPWzMVZE4/FnWOFrOLlG5aNNyBd1h6l6n8XzcixTR/NeUXLP9bK6nE 1Ix6j8oVxUY/MbQCukojIhDTu7O/C4jjXTkBZGIYIjuAT5kuIYhQDjSTQCqeLN9M+kkKiu tcG6pVgzPD0h7EUsaDoJRFHSmVoGMls= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-189-0GSF3-fRPS2slxirSH7v7Q-1; Fri, 02 Dec 2022 10:40:50 -0500 X-MC-Unique: 0GSF3-fRPS2slxirSH7v7Q-1 Received: by mail-wm1-f69.google.com with SMTP id z15-20020a1c4c0f000000b003cf6f80007cso2072945wmf.3 for ; Fri, 02 Dec 2022 07:40:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ukZurXWBYF9XacBE0s0LYySmWKNtgdpXiH8C9SL7Axg=; b=TretLy+09efiDLPda9f06ODk3sLC1YnMt/7oEB71Jl5GAhfAQUgfxFwmaGhs4QIk2S uTyXrwWD/Hm7PHnesGDcag2CbNq1p2vAP/906tyrvPv9qPdExDtzwKVeHREEkeAKEZUD l3D6iGA0hvlbiAp+rSt3XEV/4rOH9Kh8v8eLSQ89Mbqr82ipJm2onPZsiqa/zITUeVXk 75FLPuo66/3RcESJLU538iHbBU9XcrK2j9yx1PiFUcaaHvmxlK/JHvhJ35Qx6s/UhLig O1kWhihgQUWzLW1USQSqnyGmx5f4FPj/7Dzp4O7B21ksrpTmJPB8qfSawP/pnitV40Bo q9tA== X-Gm-Message-State: ANoB5pkSqCtT2uDQV0R7rG/salWt+Scq7CMfmSQQTYAAbr73VP/DR1dX 50hkiTCxU8o+8ZGPqAnSfS1+KqbN6uOWVkisfrc+divSxOR9AJQ/H7kRl6/ZJq8tiLwfnk9D4yI cP04RJicyhuarc9L2fOOhJkUA X-Received: by 2002:a1c:f015:0:b0:3cf:7818:b123 with SMTP id a21-20020a1cf015000000b003cf7818b123mr56155922wmb.8.1669995648915; Fri, 02 Dec 2022 07:40:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf6XWXVf4E+myn6zx3UJjMA1ITegc4vnWDGw2UgAobBJt+oz3eX0LXIw1B+lzdUlHUDFdcID6w== X-Received: by 2002:a1c:f015:0:b0:3cf:7818:b123 with SMTP id a21-20020a1cf015000000b003cf7818b123mr56155902wmb.8.1669995648619; Fri, 02 Dec 2022 07:40:48 -0800 (PST) Received: from ?IPV6:2003:cb:c703:7a00:852e:72cd:ed76:d72f? (p200300cbc7037a00852e72cded76d72f.dip0.t-ipconnect.de. [2003:cb:c703:7a00:852e:72cd:ed76:d72f]) by smtp.gmail.com with ESMTPSA id m21-20020a05600c4f5500b003b4fe03c881sm14181214wmq.48.2022.12.02.07.40.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Dec 2022 07:40:48 -0800 (PST) Message-ID: <0e864a86-040b-810d-86ee-f702604e7f5f@redhat.com> Date: Fri, 2 Dec 2022 16:40:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Content-Language: en-US To: Peter Xu Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport , Nadav Amit , Andrea Arcangeli , Ives van Hoorne , Axel Rasmussen , Alistair Popple , stable@vger.kernel.org References: <20221114000447.1681003-1-peterx@redhat.com> <20221114000447.1681003-2-peterx@redhat.com> <5ddf1310-b49f-6e66-a22a-6de361602558@redhat.com> <20221130142425.6a7fdfa3e5954f3c305a77ee@linux-foundation.org> <20221201143058.80296541cc6802d1e5990033@linux-foundation.org> <222fc0b2-6ec0-98e7-833f-ea868b248446@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v3 1/2] mm/migrate: Fix read-only page got writable when recover pte In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>>> >>>> David, do you feel that the proposed fix will at least address the bug >>>> without adverse side-effects? >>> >>> Usually, when I suspect something is dodgy I unconsciously push back >>> harder than I usually would. > > Please consider using unconsciousness only for self guidance, figuring out > directions, or making decisions on one's own. Yeah, sorry about my communication. I expressed that this approach felt wrong to me, I just wasn't able to phrase exactly why I thought migration is doing the right thing and didn't have a lot of time to look into the details. Now I dedicated some time and realized that mproctect() is doing the exact same thing, it became clearer to me why migration code wasn't broken before. > > For discussions on the list which can get more than one person involved, we > do need consciousness and reasonings. Yeah, I need vacation. > > Thanks for the reproducer, that's definitely good reasonings. Do you have > other reproducer that can trigger an issue without mprotect()? As noted in the RFC patch I sent, I suspect NUMA hinting page remapping might similarly trigger it. I did not try reproducing it, though. > > As I probably mentioned before in other threads mprotect() is IMHO > conceptually against uffd-wp and I don't yet figured out how to use them > all right. For example, we can uffd-wr-protect a pte in uffd-wp range, > then if we do "mprotect(RW)" it's hard to tell whether the user wants it > write or not. E.g., using mprotect(RW) to resolve page faults should be > wrong because it'll not touch the uffd-wp bit at all. I confess I never > thought more on how we should define the interactions between uffd-wp and > mprotect. > > In short, it'll be great if you have other reproducers for any uffd-wp > issues other than mprotect(). > > I said that also because I just got another message from Ives privately > that there _seems_ to have yet another even harder to reproduce bug here > (Ives, feel free to fill in any more information if you got it). So if you > can figure out what's missing and already write a reproducer, that'll be > perfect. Maybe NUMA hitning on the fallback path, when we didn't migrate or migration failed? -- Thanks, David / dhildenb