Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1546860rdb; Wed, 20 Sep 2023 12:11:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyReduxx/8oy+JMTeBeyHNcSmsAQ5S6p6IRtOwNEIx9BMoRQQhbmRflNFSDjSz9e/ISGYV X-Received: by 2002:a05:6a20:7483:b0:14d:d636:ed3a with SMTP id p3-20020a056a20748300b0014dd636ed3amr4018945pzd.23.1695237083030; Wed, 20 Sep 2023 12:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695237083; cv=none; d=google.com; s=arc-20160816; b=AvwCfWpsJ/r9MJAtYYpLwGj+Z1+I68Baaa/0330Vf26q/WBFLAhjoumXUOpe56LiNM PpENEhlrJFqP7cIBQsitXbdpVOc91q4iEEcGIXOAXWr0FycQxhxrM70mVn9r64YfOPp6 e8FzwTfAhElAsC7DntPD8aZ9+dD1R1B90g5G25ZrL0O+2i88gqC2SRLIKMg4PULGdrLL rjVoxFD6mbT6X7Lbqv58G5sL6uMhPGDMVfG2BENM7MUh1aCz85KpWZUBAMRKmTheHypp sY+c/zTMNKfWn5tC9S2EekjURiqV3EkoijM6ETW0wAw8A30KO8XsSaz6FcFDzMDq+E+9 VzjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=BE/XwmK4Ij4NMy9cOYu6AG52HrucGiCvmjRUuUJaT+0=; fh=sS+J4OyOC0EcVLWJpS3mBHGeO+0+dYZJ+ImCUfzsrH4=; b=oVoSG/Xfu42JEnvyYMSDsKPDDDe1C1VbNeAjlyEy4VQnPCmgvxtmQcy4LeFSr6WC/z nq3pvyJsipnGb6eIZUaIQUb+Iv3dzzZ1b88BQzdcK7kLfR86DtPNFuTg07hO0cq4lMME qgpgigeO2+6EV1xYbk4DBxpk4G2VqJR/nWQDAWJuSUi1c4eFyauhTwEOn414aE4NItf6 sWSM1P4Nb0LvWliRy2Bx0unsTuovNnGuArnxO+keTtjUkSc3AHRytaMz/OmJCf/Mr8VZ x/LQj//eYA9mq+3M9IR3sIYgu9ms36NfaKbM3am86lDjkuoWwM2S9eSCqF2qO3FZ98Y5 kVgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id fa25-20020a056a002d1900b00691016ba9bcsi325960pfb.14.2023.09.20.12.11.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 12:11:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 1DA0E8182DF6; Wed, 20 Sep 2023 12:01:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbjITTBm (ORCPT + 99 others); Wed, 20 Sep 2023 15:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbjITTBk (ORCPT ); Wed, 20 Sep 2023 15:01:40 -0400 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10F11AF for ; Wed, 20 Sep 2023 12:01:34 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 20 Sep 2023 12:01:42 -0700 (PDT) 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 --=20 2.39.3