From patchwork Mon Jul 25 14:20:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12928119 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 02708C43334 for ; Mon, 25 Jul 2022 14:20:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B1908E0002; Mon, 25 Jul 2022 10:20:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 861608E0001; Mon, 25 Jul 2022 10:20:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 728B18E0002; Mon, 25 Jul 2022 10:20:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 613468E0001 for ; Mon, 25 Jul 2022 10:20:53 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2A250160138 for ; Mon, 25 Jul 2022 14:20:53 +0000 (UTC) X-FDA: 79725833586.21.E06E573 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 7FA651A009C for ; Mon, 25 Jul 2022 14:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658758852; 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; bh=VjhxBnXfdQJxc8cGv/KCPbDaOiUZz+5THvMR1Yb191c=; b=LlXMOTMSYqezinWOISth4yH2ztxevx0RTN1hyWVEfZsywEae1lvJ/+GiMQlj3W2iROCKZY aesw9Yt3Jnku63Mxk05NNI8+mvitJ1ZSGfJCHqVwfa2syYI901VOn48eSqgFHIzWVu9dU7 Hs85XibgdK8Usb5GXXV3ecyPlHR5ZyQ= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-583-VRvdf7qZPSeQz5l2NYmudg-1; Mon, 25 Jul 2022 10:20:51 -0400 X-MC-Unique: VRvdf7qZPSeQz5l2NYmudg-1 Received: by mail-qk1-f198.google.com with SMTP id h8-20020a05620a284800b006b5c98f09fbso10032455qkp.21 for ; Mon, 25 Jul 2022 07:20:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VjhxBnXfdQJxc8cGv/KCPbDaOiUZz+5THvMR1Yb191c=; b=28DEO82iFY7rsspi6mobF6tgLuNsymzPCAcMtssOq81rq588L4jkzgHyYvqBO0+4Mo q2xEgETIsbg5G3wK1Ch/XRq6YbpzOONZ0detidqL4IVs0g5/tDuF7qxcix/eU1UJyH3n 2X5CpKIGzN0047etqH5p6OS56yA0vGOGeCBU1g3600fIXlM2m9VwCD0DD+JmWR3hiBqc HPZ59oA45r6piiobQw7pArh0FDOuRCDWrVQlTCFbzV09dVZ0rfQfIw5MA1RADl5CJQy3 HYpfgokFvmKmabbvoJBlJ/+7fgc78HzPlPR62mEX/ucqTKIXuhcdAPbDMB9xwW8Pm8bZ t8wQ== X-Gm-Message-State: AJIora96rJGaDPhBcRhofoF2Hsg2Ds+w1VVb/3NM4Ik03OdJBGkveV9A c48UFu+Tpif7gwChwyg0TdNBTQ/mBnXXjIinGifTf0bWcagKzTJg4HZ3UbYzlisci2GC1sS2O74 fD8lqo21suE0= X-Received: by 2002:a37:53c1:0:b0:6b5:513a:c5bc with SMTP id h184-20020a3753c1000000b006b5513ac5bcmr9200695qkb.0.1658758850469; Mon, 25 Jul 2022 07:20:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vc+ZkWRV13O7tEb5YUXw2eqXLazt18OupxEcZFVdKte1/R5yctu83n1UbltLHwdXwnsonh0w== X-Received: by 2002:a37:53c1:0:b0:6b5:513a:c5bc with SMTP id h184-20020a3753c1000000b006b5513ac5bcmr9200673qkb.0.1658758850216; Mon, 25 Jul 2022 07:20:50 -0700 (PDT) Received: from localhost.localdomain (bras-base-aurron9127w-grc-35-70-27-3-10.dsl.bell.ca. [70.27.3.10]) by smtp.gmail.com with ESMTPSA id ey14-20020a05622a4c0e00b0031f0ab4eceasm7626071qtb.7.2022.07.25.07.20.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 25 Jul 2022 07:20:49 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: peterx@redhat.com, Nadav Amit , Andrea Arcangeli , Andrew Morton , David Hildenbrand Subject: [PATCH v4 0/3] mm/mprotect: Fix soft-dirty checks Date: Mon, 25 Jul 2022 10:20:45 -0400 Message-Id: <20220725142048.30450-1-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658758852; 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:dkim-signature; bh=VjhxBnXfdQJxc8cGv/KCPbDaOiUZz+5THvMR1Yb191c=; b=pN3ezNjZkxtiFyYd0JxcatV+Ek+nAwwJuJPb5o6aNnehRiFZHhFSspltl3jDV00lIVrC4+ RlLqCPE8u1eq9L4MltWL4nGxDKhm6+b9g68qgF4kajZuu9k2xZXlXyl/Q++Ij4/DEsF7FF D7gEXchIS6HaEWM/EvTUJNtT7NJzJMU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658758852; a=rsa-sha256; cv=none; b=No7OmqnIcOFb5rslyWtuS8hCUVahzEAhNh17u59v8KQyD6AOozPaf96vOTidqY7POLW358 pTx6OlKacyNgWxzHNWbVtgEQm8sHiv82F+M9Wisj3ikXGTuNDSW0yhRSOlJUBls1PulFC6 zj8G1pJWENNSugCwvmFqKt7JW7KlhhA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LlXMOTMS; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf19.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 7FA651A009C Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LlXMOTMS; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf19.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com X-Rspam-User: X-Stat-Signature: pp7ysj97t5m1uc97ud5wx8jqp158tzwa X-HE-Tag: 1658758852-891215 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: v4: - Add r-bs - Fix spellings and commit messages (on Fixes) [David] - In the new test case unlink() after open() to not leave temp file even failed v2: https://lore.kernel.org/lkml/20220720220324.88538-1-peterx@redhat.com v3: https://lore.kernel.org/lkml/20220721183338.27871-1-peterx@redhat.com Patch 1 is the previous patch and real fix. Two more test patches added to add mprotect test to soft-dirty.c, meanwhile add soft-dirty test into the vm test loop. Please review, thanks. Peter Xu (3): mm/mprotect: Fix soft-dirty check in can_change_pte_writable() selftests: soft-dirty: Add test for mprotect selftests: Add soft-dirty into run_vmtests.sh mm/internal.h | 18 ++++++ mm/mmap.c | 2 +- mm/mprotect.c | 2 +- tools/testing/selftests/vm/run_vmtests.sh | 2 + tools/testing/selftests/vm/soft-dirty.c | 67 ++++++++++++++++++++++- 5 files changed, 88 insertions(+), 3 deletions(-)