From patchwork Fri Mar 22 06:09:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjiang Tu X-Patchwork-Id: 13599648 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 1217AC47DD9 for ; Fri, 22 Mar 2024 06:10:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 97CCE6B0083; Fri, 22 Mar 2024 02:10:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9064F6B0087; Fri, 22 Mar 2024 02:10:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A6A86B0088; Fri, 22 Mar 2024 02:10:02 -0400 (EDT) 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 68D066B0083 for ; Fri, 22 Mar 2024 02:10:02 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 34A411C094C for ; Fri, 22 Mar 2024 06:10:02 +0000 (UTC) X-FDA: 81923649444.21.3ADD78C Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf05.hostedemail.com (Postfix) with ESMTP id 8DC2D10000B for ; Fri, 22 Mar 2024 06:09:59 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of tujinjiang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=tujinjiang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711087800; 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=MU5Qi6NzIMyLj8Pc4UcF8GVR3uyf0Z2bAi7FXoSLCXk=; b=z87B1frXjVS7iCTSUrgo6Iz9kRZqS+o0KnkF4xXkXykp8oFgH+CbyK2iHweWkV+LpLdOcw JZwXVYXCAGkW2kY+f7tUjVKidQ40Jf2RIF58lBttZG7lJcKkjidDB57yPq5uYpCBXjv/yG mvDV5P36cD9omMaDRIq3+QTn4QqCIMQ= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of tujinjiang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=tujinjiang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711087800; a=rsa-sha256; cv=none; b=MbbOEM5CU+LlqmU3Lfutp5raINQqRZLs7+TSWEREFesnHjAUkBxizHiUdYvHDrFZOP4Jpt 2TYjyesEKtUBEgaYFHiETf0MJG7PCD8LEzSDRn9rTNXbrefpKjZSWrGP4sRhLtNekyOuEk UfN3x63X1OL6ztwSJA/eARJR6zRhzv4= Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4V1Bgr5RFvztQXZ; Fri, 22 Mar 2024 14:07:36 +0800 (CST) Received: from dggpeml500011.china.huawei.com (unknown [7.185.36.84]) by mail.maildlp.com (Postfix) with ESMTPS id 4F39B1400E4; Fri, 22 Mar 2024 14:09:55 +0800 (CST) Received: from huawei.com (10.175.113.32) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 22 Mar 2024 14:09:54 +0800 From: Jinjiang Tu To: , , , , , , , CC: Subject: [PATCH v2 0/2] mm/ksm: fix ksm exec support for prctl Date: Fri, 22 Mar 2024 14:09:45 +0800 Message-ID: <20240322060947.3254967-1-tujinjiang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500011.china.huawei.com (7.185.36.84) X-Rspamd-Queue-Id: 8DC2D10000B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 6frtenr3kdcccehgd1gp1x4i41jfn8iz X-HE-Tag: 1711087799-291797 X-HE-Meta: U2FsdGVkX1/V3WgRIyxmKB2uvH8UrtTriGWhV0sT8KeNPEuG0yUIroKIoN5zZBwlgrzIcP3ATvJIVfENOIkrxQyNG/rVDhxV5TB3m+CltW4/E4Y7VJ6rDENC6aBxl6EkE6/yXgOFKXNUgStDZL/UXTkDysCYK+OZv5qg37qIxzcD3RhQmlLzplmCUIvLEzoSzvhb7TxXT5/uTYa+GeQEg9hWH/MLwbN8gTElxZaIlxucnUkEyXRm16Fkt0H/mbR/i0sIbjj7HuZmUddwe5HvcjMKSRu0DjPFpC2ggMCaWt61O5seyuatQFPe6YaTldKnaKu8zi8Bkf5FRCYGjc/YT/LR92p8EdOAnQejnYbstLWtHVKShFWD+RtY2nM5NtdujiHJ/+mV/j3Qv6eChExNKEyxWiCAapE8SwaV0RWpINLCKyTaU5dl9kdchtq6EAj3jGSgPz0kzCQtJX3Dp2OLw/ynR5mOgTNrcu08RR6ZYJ8duAeIJnO6ChPfM5zg5hvYlnGztQLzhWDxCmJmpc3LxH0SDgFxkJgaX8pmA9QKswD1OO4R17ltgHUfkUlFAsK5ZVbbwobi2EvCj2FnZ1ak54+1EafLOOhQi4195pnWX2Hl92BiUzF2VH9BoH4IZeef8NvEiU7Owae2JHoppofc0U2nGb2ng9frc5VHsIFtiiFL27H9qPs1UlTzsD+bXN4BW9t8Oh3gpJ17yg+FvZZJ9bDs0hTkjUAmuAbCPqi9+jvc3tX3/FBFiDhVhNqTqaaML7+CuEUFod1tF79GzQaMMZdm01UNkQtpaP+mpZALdGXtJbWISpW3932CHKEn/3NQ4a/QTi47ZvOvsuP6Dd9JSB7AF9OjXz8k 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: List-Subscribe: List-Unsubscribe: commit 3c6f33b7273a ("mm/ksm: support fork/exec for prctl") inherits MMF_VM_MERGE_ANY flag when a task calls execve(). Howerver, it doesn't create the mm_slot, so ksmd will not try to scan this task. The first patch fixes the issue. The second patch extend the selftests of ksm to verfity the deduplication really happens after fork/exec inherits ths KSM setting. Changelog since v1: - Add ksm cleanup in __bprm_mm_init() when error occurs. - Add some comment. - Extend the selftests of ksm fork/exec. Jinjiang Tu (2): mm/ksm: fix ksm exec support for prctl selftest/mm: ksm_functional_tests: extend test case for ksm fork/exec fs/exec.c | 10 +++ include/linux/ksm.h | 13 +++ .../selftests/mm/ksm_functional_tests.c | 79 +++++++++++++++++-- 3 files changed, 96 insertions(+), 6 deletions(-)