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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E55BC4321E for ; Fri, 2 Dec 2022 15:40:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67F8F6B0071; Fri, 2 Dec 2022 10:40:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 62F866B0073; Fri, 2 Dec 2022 10:40:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A9526B0074; Fri, 2 Dec 2022 10:40:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 3AB4F6B0071 for ; Fri, 2 Dec 2022 10:40:58 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E1E2CABBB0 for ; Fri, 2 Dec 2022 15:40:57 +0000 (UTC) X-FDA: 80197779354.11.29647F0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 6B81740017 for ; Fri, 2 Dec 2022 15:40:57 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eG+MUzAl; spf=pass (imf04.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669995657; h=from:from:sender: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:dkim-signature; bh=ukZurXWBYF9XacBE0s0LYySmWKNtgdpXiH8C9SL7Axg=; b=nUi6btxxW6VnbOtoopG02ghv5K3tUiGscKixsjdkE7kvmJgVoZg5zux3py4+Kc2jbFupAh lvy1c0ORE+3b5KDq5aqzlGmg/MAeKfz83XNwKhtzAa79cDF2UfLJxkkVj4iS1LKiZpz4kA hNP0U1691nZeuPbTi86jq6Z5TZDo48A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669995657; a=rsa-sha256; cv=none; b=oMVoRV1k40lOLKKTEIiFp5g5R27O/ELPsx2zmifiEKkxR7Kefh//CLaq0+gf56k7DheF/y MFr61Z7ZNkNqc0G2B6bO3C0ykxc7SAAc6lkoleXYm0ZvwAJCUXnjnCMvoeUhgW0Ol5qld/ LcszeBZO/akQFJ8prKNOIt3Ur0WCc0A= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eG+MUzAl; spf=pass (imf04.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669995656; 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=eG+MUzAlDsurqEtSnAC9Dc3YU9FFTNvSYsIOTOxJrreSDbukA69/zyxv1TCSccsk/Q9fav xojPYfE59jdk5qRxcdPGf5b6VebCpgUfMqQFgXOOtaPKFQMmwglcv8fdW2uGR81Q1uyL2w +5SeOHgTALupneqZhlWbGaG4j6bqddM= 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-626-RZUrmfB8NtCBYLVV-b4IDQ-1; Fri, 02 Dec 2022 10:40:50 -0500 X-MC-Unique: RZUrmfB8NtCBYLVV-b4IDQ-1 Received: by mail-wm1-f69.google.com with SMTP id c26-20020a05600c0ada00b003d07fd2473bso1828856wmr.9 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=5Iof4quU9KqN7x37KWs5+SUE31Bi1UG/QXiD6XQ3A3mgU5r/7Y0gs/4AwmV33hUECT oGE0N/KWQoj4hz6e49XFO74H2y59STYVtIzoDcSNrP6MIxplNkOIDN4Oy5rwZ+bUldw1 3f4xS05O6vK73Q0YifWeyYLNW9OI/Xg5sgMCNzn0pCswIyXmAPZOUDfcrU2GgPr4bjWC C2lQjhpJxem4IxmPawi1qN1QGz4z8U8hW+Q0MZb5y8aEj+43dMSSDQEO3aGe3ON1xBGf V04DS3BOtysKLbILavvcXHHJUDojOw/DRguJuMZFyFSyDGTtMZYGg5RnDIVy48ZoGJqL V3KA== X-Gm-Message-State: ANoB5pn8or5VpCjxW4RMNMaCyQRk0jCbLxx9CnNmNoSPP0LhDSCEWRQk iVVTFEC/qrPVlv2b44JcMo+zwVq90bWVKCEH8DZoYBIbt7VmTaSP2a0mpV2V+1BiBqZr6YfeG7D hq4FFXiwhyYY= X-Received: by 2002:a1c:f015:0:b0:3cf:7818:b123 with SMTP id a21-20020a1cf015000000b003cf7818b123mr56155916wmb.8.1669995648913; 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 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: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspam-User: X-Spamd-Result: default: False [4.40 / 9.00]; SORBS_IRL_BL(3.00)[209.85.128.69:received]; SUSPICIOUS_RECIPS(1.50)[]; BAYES_HAM(-0.20)[71.50%]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; R_SPF_ALLOW(0.00)[+ip4:170.10.133.0/24]; RCPT_COUNT_SEVEN(0.00)[11]; DMARC_POLICY_ALLOW(0.00)[redhat.com,none]; DKIM_TRACE(0.00)[redhat.com:+]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; HAS_ORG_HEADER(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[linux-mm@kvack.org]; TAGGED_RCPT(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; R_DKIM_ALLOW(0.00)[redhat.com:s=mimecast20190719]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Stat-Signature: 6har43i5mnhh9wfr4ck99mjiz18ozhiw X-Rspamd-Queue-Id: 6B81740017 X-Rspamd-Server: rspam05 X-HE-Tag: 1669995657-343599 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000219, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: >>>> >>>> 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