Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2982351rdb; Fri, 22 Sep 2023 14:12:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFglVaiiwF1wmrLPchfJzxcV7cyvEEa2hZfjD2z7T9a+OowxpsRa3Q/fFj2K8Vbxp1tAIEz X-Received: by 2002:a17:90b:4b41:b0:274:24e2:ae6d with SMTP id mi1-20020a17090b4b4100b0027424e2ae6dmr915489pjb.0.1695417170720; Fri, 22 Sep 2023 14:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695417170; cv=none; d=google.com; s=arc-20160816; b=qJfp5P9qp6RghSdNwHGWZPKRcKJzwgLufKB54TAWQVfIa4D4FVcOcboGjn43ESNbmZ m5H5emRiKTmR+V7S5WtIJHaI5OoI8FGC3yqz9FX9CIpJSqvrEAWiyLXRBFXZv2AQwYde FdCxZXPmefHq9a0X6QMUzCf97ULUw9u8eYTsOb16L84aZTFKApEnIKpDi3Nh1lZ0w2Kt p4LVnOBPAnW0Psk+9KEzef00AwBXiz7wkZNlt5T0fc895Z0Vn7lavXWM4RESnrnAG8R2 m5Grmf/taxAToBMtvgFsLeQtVh0viUmYSNq9FEGgbHskxNDijNPLXij2y/naKMBnnhQI +tJA== 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=Pn4WOLyulan8COpDJFoPB8+j8ThkORhLngWXjzEExS0=; fh=sS+J4OyOC0EcVLWJpS3mBHGeO+0+dYZJ+ImCUfzsrH4=; b=kLBYkSe4snk/9xfrnCF9KYzg3S/c2xFvRPefg265LMlKIDSsVdXq5L1H0kEjrp3BDr 5HDswJJ67taXN7QutquEbx4V8CEVfQXpxcIk5QZjymLcjUe64Q+ViiQVjqNIL/vC5Zxm H4anHRRH84hJwl5JiZV5xhHqr8DuFvlCf2Go/UUK01DQuXvz1Nm8VDALqtyU8BI0A08n XYrpmaTj1LMmhY4swu686x3bTFna02PmxRomvLNUXM9OLY/R2znOURX7Xt3TW7rGn9ga 8xU5Tg0PChXv3A2xg9WB+n8etEDsLVWJUupIifcA909+GcbBrvJYxlxQO6lCxes8i2km nrbg== 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:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id gv12-20020a17090b11cc00b002749baa2edesi6863417pjb.24.2023.09.22.14.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 14:12:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id A57BB80D9B3F; Fri, 22 Sep 2023 14:12:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229808AbjIVVML (ORCPT + 99 others); Fri, 22 Sep 2023 17:12:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbjIVVMJ (ORCPT ); Fri, 22 Sep 2023 17:12:09 -0400 Received: from 66-220-144-179.mail-mxout.facebook.com (66-220-144-179.mail-mxout.facebook.com [66.220.144.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD64C1 for ; Fri, 22 Sep 2023 14:12:03 -0700 (PDT) Received: by devbig1114.prn1.facebook.com (Postfix, from userid 425415) id CA938C60DC47; Fri, 22 Sep 2023 14:11:49 -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 v4 0/2] mm/ksm: add fork-exec support for prctl Date: Fri, 22 Sep 2023 14:11:39 -0700 Message-Id: <20230922211141.320789-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=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Fri, 22 Sep 2023 14:12:12 -0700 (PDT) X-Spam-Level: ** 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: - V4: - Added motivation for the fix to the commit message of the first patch - V3: - Combined two lines in function ksm_fork_exec_child() - 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 | 66 ++++++++++++++++++- 2 files changed, 70 insertions(+), 3 deletions(-) base-commit: 15bcc9730fcd7526a3b92eff105d6701767a53bb --=20 2.39.3