From patchwork Tue Sep 19 20:51:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13391869 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 01EA4CE79A9 for ; Tue, 19 Sep 2023 20:52:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9332D6B00D5; Tue, 19 Sep 2023 16:52:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BC106B00D6; Tue, 19 Sep 2023 16:52:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7840E6B00D7; Tue, 19 Sep 2023 16:52:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 664486B00D5 for ; Tue, 19 Sep 2023 16:52:13 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3D4911CA877 for ; Tue, 19 Sep 2023 20:52:13 +0000 (UTC) X-FDA: 81254544546.14.0AC96AC Received: from 66-220-144-179.mail-mxout.facebook.com (66-220-144-179.mail-mxout.facebook.com [66.220.144.179]) by imf11.hostedemail.com (Postfix) with ESMTP id A8CBC40004 for ; Tue, 19 Sep 2023 20:52:11 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=neutral (imf11.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=1695156731; 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=8zTfBJwmRQ0Fr3nlBPrc5M3zMldCRBNeqCsOYkllon0=; b=VEW9BUVEdXZ9wFva3dppLpAlcX76KXclA/jy7xxx51VzG+m9z6SxUzqp1Kr7Nbuu6Pq74o SiHBoB3svqbJX8al2PBuVakvnUoYJ1I7nRDmRCEWGtwsnXley+BOeVAc2W69FbZwLfFuqB WYM0OG02YXfNuDect4jcG4rt7xCO8gY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695156731; a=rsa-sha256; cv=none; b=OVhnPfbsuR6BrT7z7mDTLI6QVtSm/v2X0wunEjM4V55Yuhy5X8PfKrtBwreJexBIpoEJS1 yKvSoZSLGN8Q9kFtp4kd5/peC0o6ck9MLOuV+cANR2w9Q90bdL94TIHq2MBaDC6XG/BSC7 YdHfQhwMiiwBlZckwpRrkCIqRzdNJp0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=neutral (imf11.hostedemail.com: 66.220.144.179 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none 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 X-Stat-Signature: cki5qzkuast85zpx5gqrx5n957kgtegi X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A8CBC40004 X-Rspam-User: X-HE-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: 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 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