From patchwork Tue Jan 7 14:47:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13929108 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 38965E77197 for ; Tue, 7 Jan 2025 14:48:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF9888D0005; Tue, 7 Jan 2025 09:48:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA9FC8D0001; Tue, 7 Jan 2025 09:48:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FBC18D0005; Tue, 7 Jan 2025 09:48:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7DC288D0001 for ; Tue, 7 Jan 2025 09:48:10 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DEC371601E0 for ; Tue, 7 Jan 2025 14:48:09 +0000 (UTC) X-FDA: 82980935898.03.F031FBB Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 5893516001D for ; Tue, 7 Jan 2025 14:48:08 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736261288; 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: references; bh=pVjklTDHn6w6Rf+KP/CAa/cuFxOZ2UCdB+v/y+gNE0c=; b=XCAfrwZ29VfnAwmzESX5pt34nxztD5TMIrqb6LQ8UeBv48fRhPJMbVPR44xjRDOWNZPLrD SUczJyeDJLVh/q1ld9ijexfEbd/ZrRoDLHG8x0rSsTgVUejgzP20GZb2CdvZ+JpYI06bZ/ c0Of2ns2x6ItVoImqDvO+ouxnFiUKfI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736261288; a=rsa-sha256; cv=none; b=MjMGj3mpPZlyAvNgD4dJvi34T2vIeP22Yoc7NXLY9+/Gza7K1VLbdVcidzX7hQRy8DCN7H PmCx3UHl/SCL4xXOci9t7r4af6xZp/h74W1IyOZKhZn41lpCOVU+tEEf/GQevn8QRvn9Mt zVCuNPb2Esm9W+kKOT+FK974ZSnFzwE= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CBC301424; Tue, 7 Jan 2025 06:48:35 -0800 (PST) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 20D563F59E; Tue, 7 Jan 2025 06:48:04 -0800 (PST) From: Ryan Roberts To: Andrew Morton , Muchun Song , "Liam R. Howlett" , Lorenzo Stoakes , Vlastimil Babka , Jann Horn , Shuah Khan , Peter Xu , David Hildenbrand , =?utf-8?q?Miko=C5=82aj_Lenczewski?= , Mark Rutland Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: [PATCH v1 0/2] mm: Clear uffd-wp PTE/PMD state on mremap() Date: Tue, 7 Jan 2025 14:47:51 +0000 Message-ID: <20250107144755.1871363-1-ryan.roberts@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Stat-Signature: 1rf6hsbxcogxjueutsgeiafnigjbrzdg X-Rspamd-Queue-Id: 5893516001D X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1736261288-886966 X-HE-Meta: U2FsdGVkX1/UDEabQfOdq2kqyKFDhBnhtvmvreJVLwWjmyAn6Gd/SF6EVfs5qO12wOE/V3yqC8RJlo4/pjNce7YWe1Bv0dM7bz2YoZcQhGY/rCG9k+MOjd5aCbkVPWO28iqxfn5003VJ0hUObRvJjftPKT5LezLZ3rkt1zCCnsR8Gj+CAf0YJnm0WJnJYAZYSWrRm/+fFDeesWULqKn+3J9ec/SrtCbpFPumjcRS0GTy+of4KWA0LfYtd1LoQ0IHbI6eomg3uSqtfm82AhzXWjgQ0ACAcqq5mW42tfUTmepR8NKdVe2s5fcbYfEHRP+rCyARpWFPk2IF+WotPjP3Tnlb1hnzMZ4EszskgGzIlEzLrCAxI3MSJvCoJXthhNisCMFog38+vMnWy+FRCoMvaSfEfClBXeVkBKtmWjf8BKRpy1rtXYW9jqif4zcebB+r8+5w6RWjvQRTMcaN8nw/U8SUJ6ggKy2pzCEaU9XtWIgUNs+JalEVw4JmU712EOG0HHYHn0nVDIXrzvYbs8SEINSaVPz6PY/CI9CGvgRK37BMdvqwAM4vL3L9ypGL/3joI23Tyip1VQ3W5m3JI60GEm1PgO8aKw9Kha0S006HxsiyrViYh0z65kcvgdaavMU+QAQLC+9/bjJFAYf7kYwyWMXvmPbvnSCRuel3vKP2NGuvl8j1yS9OUEh2We3xdTDlmViInYYMl3J3qfLHUD3Pgv7rCBgiXOvjyB218o4UPI3VcygsMw1xxIOvCbETJOjuPOppAKMHaZ0vDNGcWUs8gDArmwAdTddreshZ0pFYA+rwsi/pMgatbZAbtT5sVd1wctFBvLJYkIrzQL6CpK1rDvsihIJuAGB4AQ3kiX5imt2ZREUCvNoJV99D6Cz6jDJLc+ZfxuZmh1PnBbmIP4m2j+ae8kqzG8w7SD7mI6Rfct3tRhi1TxNRkPmE/m1J4CxN975TzTzdmxMGNyZJ2Yq 3s7+9sm4 zx+ocXKVy2N5luhurp86jemaDgt8Tq0pia/WQCk0Pex8p1iVM0UQQ96ZX7TILWda9N3zX4b6poy+S5mcxD/gYAeKfknYlU7lUq2CCxjpBDIb6gm9uFuzVekzUZ+hbz/fMcesg X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi All, This series contains a fix for a warning emitted when a uffd-registered region, which doesn't have UFFD_FEATURE_EVENT_REMAP, is mremap()ed. patch 1 describes the problem and fixes it, and patch 2 adds a selftest to verify the fix. Thanks to MikoĊ‚aj Lenczewski who originally created the patch, which I have subsequently extended. Applies on top of mm-unstable (f349e79bfbf3) Thanks, Ryan Ryan Roberts (2): mm: Clear uffd-wp PTE/PMD state on mremap() selftests/mm: Introduce uffd-wp-mremap regression test include/linux/userfaultfd_k.h | 12 + mm/huge_memory.c | 12 + mm/hugetlb.c | 14 +- mm/mremap.c | 32 +- tools/testing/selftests/mm/.gitignore | 1 + tools/testing/selftests/mm/Makefile | 2 + tools/testing/selftests/mm/run_vmtests.sh | 1 + tools/testing/selftests/mm/uffd-wp-mremap.c | 380 ++++++++++++++++++++ 8 files changed, 452 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/mm/uffd-wp-mremap.c --- 2.43.0