Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp905006rdb; Tue, 19 Sep 2023 13:58:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEM9+bprPbW1yz4kkhzMNRb5CANHzO6kIu3S8daWgdwrtzACXDoRYGGuNtO1M3oSyZz9mlP X-Received: by 2002:a05:6a20:4304:b0:125:3445:8af0 with SMTP id h4-20020a056a20430400b0012534458af0mr966391pzk.7.1695157089714; Tue, 19 Sep 2023 13:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695157089; cv=none; d=google.com; s=arc-20160816; b=cV7AClCsrRcYoVE3SOlUxA1LsjHS1D84ozGmRUQaJEknzZ/xrX84kmg00PbP6O5UIQ t+HqYjW6WNGfIAmRs1e4VWUP9J+j4VMotHBRHdsDT6Mi0iEQhFmeSvtO6v19Cpj/s/JP p4O16OQp1O3ld5fw0EKs1qP6fGSF7mX2Vzk9a2ZEqZId5dXMcv18po3DBoejSxWmBA6v YlcqCQQ7p7vQQiU8maInOF95RL86ukxO5l1TLOBptafYsv1rxteni976kflFnzDKGbj3 8AiSYU5CzbUvVvB44k8/llZuzdzVvb2qu7T5g1+nk39tVKJoiBcAKUkfgqRtc9Kdztae tBgw== 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=8zTfBJwmRQ0Fr3nlBPrc5M3zMldCRBNeqCsOYkllon0=; fh=sS+J4OyOC0EcVLWJpS3mBHGeO+0+dYZJ+ImCUfzsrH4=; b=G29iuE3QO5wkqHWiXuIJqEXXL44inZ42N9s+oasRpC82W9XJtr6VRuRFW6IOb45p3a BnOYREgNr/OKqsfKQhJOg2QNKqQclBsKQebiNWGdKUCIi2GsUV8JKQhmYZv1NJDo2neL SwLjmZM9nOhqOVF72XHQG4/ltkMUh/6jtbD94EJRoz6mGuTTpGfaiazkLvg6K/zwQjvg fHOPEO2UHfNnOULxqaji1rDxH1IrA0WUjTbcq76fxenT29oZ6Q/+VjQh4gBb/V3yQmua rYR36CGtrC0F8uNGyoJajisiJANCUgQJl/8P1+fucBWUzBaayT8Jry5nyYYcIKY66slb RXNA== 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:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id br15-20020a056a00440f00b0068e3baee27esi10240882pfb.266.2023.09.19.13.58.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 13:58:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 7C5D7801BCDD; Tue, 19 Sep 2023 13:52:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233253AbjISUwX (ORCPT + 99 others); Tue, 19 Sep 2023 16:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233139AbjISUwV (ORCPT ); Tue, 19 Sep 2023 16:52:21 -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 6270CBF for ; Tue, 19 Sep 2023 13:52:14 -0700 (PDT) Received: by devbig1114.prn1.facebook.com (Postfix, from userid 425415) id 4CB08C361C1B; Tue, 19 Sep 2023 13:51:59 -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 v1 0/2] mm/ksm: add fork-exec support for prctl Date: Tue, 19 Sep 2023 13:51:56 -0700 Message-Id: <20230919205158.1897353-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.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RDNS_DYNAMIC,SPF_HELO_PASS,SPF_NEUTRAL, TVD_RCVD_IP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Tue, 19 Sep 2023 13:52:20 -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 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 ++- tools/testing/selftests/mm/Makefile | 2 + .../selftests/mm/ksm_fork_exec_child.c | 9 ++++ .../selftests/mm/ksm_functional_tests.c | 50 ++++++++++++++++++- 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 tools/testing/selftests/mm/ksm_fork_exec_child.c base-commit: 15bcc9730fcd7526a3b92eff105d6701767a53bb --=20 2.39.3