From patchwork Wed Sep 20 19:01:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13393219 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 78E82C04FEA for ; Wed, 20 Sep 2023 19:01:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFB966B0194; Wed, 20 Sep 2023 15:01:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DAC306B0196; Wed, 20 Sep 2023 15:01:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9ADD6B0197; Wed, 20 Sep 2023 15:01:38 -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 B72CB6B0194 for ; Wed, 20 Sep 2023 15:01:38 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 86E09160C87 for ; Wed, 20 Sep 2023 19:01:38 +0000 (UTC) X-FDA: 81257894676.28.BE97227 Received: from 66-220-144-179.mail-mxout.facebook.com (66-220-144-179.mail-mxout.facebook.com [66.220.144.179]) by imf29.hostedemail.com (Postfix) with ESMTP id 07182120042 for ; Wed, 20 Sep 2023 19:01:36 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; spf=neutral (imf29.hostedemail.com: 66.220.144.179 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695236497; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=BE/XwmK4Ij4NMy9cOYu6AG52HrucGiCvmjRUuUJaT+0=; b=mP/ku8tgG0RU/A4cG4sUNyLf/kRlRJ+MHbsI/yBgtuSS+YmWBgro5JTwykP0emeWQqhIId JYSbj4OvM6YUoX4y3IzmJs7v9ptXmVQVsIcX8yV4U+jyK3tOGQRP70NXPLeCgpVV9z1Pgn SrTnLPN8Hx4qySHVLJ/e8B4Z66IY16A= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=neutral (imf29.hostedemail.com: 66.220.144.179 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695236497; a=rsa-sha256; cv=none; b=hcdigVJ2QoAi2uvLpt2IpX8vK0vV8Bd4+GSN7zBH14KiHYgjmL5da+7iE3wkQ17VKqkUXW rL2+B+PIxgIOsb964N8mXhVm6hABu1cgYJHsX55sZPCl1D1PGfjwI83HfjWcNgI5N/JLz6 1sPkqqXJM+EQg08tSdYSbo/B5l1uVo8= Received: by devbig1114.prn1.facebook.com (Postfix, from userid 425415) id 2E7A2C4363F4; Wed, 20 Sep 2023 12:01:22 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com Cc: shr@devkernel.io, akpm@linux-foundation.org, david@redhat.com, hannes@cmpxchg.org, riel@surriel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 0/2] mm/ksm: add fork-exec support for prctl Date: Wed, 20 Sep 2023 12:01:15 -0700 Message-Id: <20230920190117.784151-1-shr@devkernel.io> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Rspamd-Queue-Id: 07182120042 X-Rspam-User: X-Stat-Signature: ddomr91bbwmkonaetza7j8jdt3daafy6 X-Rspamd-Server: rspam01 X-HE-Tag: 1695236496-525722 X-HE-Meta: U2FsdGVkX19AQ7Cw+xovJ4hkGMk6hbe/buBZY7QeSpyr9evU1AGP9/4AWC7mmy5bDarupGx3BmrRcGp9/Bdoa6kqjybevlLS3JU7KLCIruuRlcXrX5WK2MN8a7cY5N++sCLzCFw43ggExkaRsd2dXWQhpnqzban4CqquDr7speeXibXbsTk3RJoU6VmWLFlSyLX/Q+w1gt6B1ge8y1SqPZ9A+lUrvkyA+H+fLe+ZTbWJCbT6kqhQFvR3CZeDVX7o30vQbvD/uX9FazQkPVmczfRDvmUEwdltvJ4/01g/zFBUTCWKU2G2l3L3btmD3kKWEAZdIxAJlCO6VsyKg1Oa9awCxqIPf2u6sAd7gxgVvLYw+/yHp2I51RtS/4iR8P8YLVBa1HD0qHjKw9cjQ38P55cj8zlU+9i7iCNXK4y2y0PP5pSg156DVmJHCV23q12BEaMRxLGn50Q1v0VstTsyyC3uwdW3B1dzFpwa7WbWzrz0xDSSK/C4fsXSynmkJfd6omGET2bmV6vcdz7GctOTLHAPyncLMml0AJZERI7ESyA3YgRhYJDxrTIw9GONwVAngnnt0RvC/qsVEWKFEFpTCXpdXXjQ5svVh2nhRJEf2Cxf7SlGY7Ncxx/gON63XbsD8A5GlX4nXt8s/9fYBetwbEEETR+s6WFAUtCgKta1ih8WFbrqJc67UnVZc5hxRGBv4k1zbSGGGndwFnxEKz+9P7Nx60z6H5Zpee370WRg4p7ZT6lfFAtZEIolZnv8WRCrKC+XZj3aCsUiv/soeTUmmlagDZZ6QufYdS/5L0fRKT166qCtQeQFXCAAkQDJzOq60hHLL3Nzl47BiTL3Axf0te5UN+e85/nWsgfwecOmD56O5iC28EsAN7BSvnaKbIbPAtdhwhL5Fx/WG6mGkBFoAVQNE9IgZEMgNtUzHWrnSH9NXxoX8RY2fhCLLCiG69XaKO/7+gxZdKvjgVNVreQ joMq60Ge k42isMyQiZdD6Z8Q= 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: A process can enable KSM with the prctl system call. When the process is forked the KSM flag is inherited by the child process. However if the process is executing an exec system call directly after the fork, the KSM setting is cleared. This patch series addresses this problem. 1) Change the mask in coredump.h for execing a new process 2) Add a new test case in ksm_functional_tests Changes: - V2: - Removed the child program from the patch series - Child program is implemented by the program itself - Added a new command line parameter for the child program - Removed new section from Makefile - Removed duplicate ; charaters - Added return in if clause - Used PR_GET_MEMORY_MERGE instead of magic numbers - Resetting PR_SET_MEMROY_MERGE at the end. Stefan Roesch (2): mm/ksm: support fork/exec for prctl mm/ksm: Test case for prctl fork/exec workflow include/linux/sched/coredump.h | 7 +- .../selftests/mm/ksm_functional_tests.c | 67 ++++++++++++++++++- 2 files changed, 71 insertions(+), 3 deletions(-) base-commit: 15bcc9730fcd7526a3b92eff105d6701767a53bb