linux/include
Jinjiang Tu 57977d414b mm/ksm: fix ksm exec support for prctl
[ Upstream commit 3a9e567ca4 ]

Patch series "mm/ksm: fix ksm exec support for prctl", v4.

commit 3c6f33b727 ("mm/ksm: support fork/exec for prctl") inherits
MMF_VM_MERGE_ANY flag when a task calls execve().  However, it doesn't
create the mm_slot, so ksmd will not try to scan this task.  The first
patch fixes the issue.

The second patch refactors to prepare for the third patch.  The third
patch extends the selftests of ksm to verfity the deduplication really
happens after fork/exec inherits ths KSM setting.

This patch (of 3):

commit 3c6f33b727 ("mm/ksm: support fork/exec for prctl") inherits
MMF_VM_MERGE_ANY flag when a task calls execve().  Howerver, it doesn't
create the mm_slot, so ksmd will not try to scan this task.

To fix it, allocate and add the mm_slot to ksm_mm_head in __bprm_mm_init()
when the mm has MMF_VM_MERGE_ANY flag.

Link: https://lkml.kernel.org/r/20240328111010.1502191-1-tujinjiang@huawei.com
Link: https://lkml.kernel.org/r/20240328111010.1502191-2-tujinjiang@huawei.com
Fixes: 3c6f33b727 ("mm/ksm: support fork/exec for prctl")
Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Nanyong Sun <sunnanyong@huawei.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Stefan Roesch <shr@devkernel.io>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-05-30 09:49:45 +02:00
..
acpi ACPI: bus: allow _UID matching for integer zero 2024-04-17 11:23:29 +02:00
asm-generic sched: Add missing memory barrier in switch_mm_cid 2024-04-27 17:13:01 +02:00
clocksource
crypto crypto: skcipher - remove excess kerneldoc members 2023-12-29 11:25:56 +08:00
drm drm/edid: Parse topology block for all DispID structure v1.x 2024-05-30 09:49:41 +02:00
dt-bindings clk: renesas: r8a779g0: Correct PFC/GPIO parent clocks 2024-03-26 18:17:05 -04:00
keys
kunit Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
kvm KVM: arm64: Fix host-programmed guest events in nVHE 2024-04-10 16:38:01 +02:00
linux mm/ksm: fix ksm exec support for prctl 2024-05-30 09:49:45 +02:00
math-emu
media media: mc: Add num_links flag to media_pad 2024-04-03 15:32:03 +02:00
memory
misc
net Bluetooth: hci_core: Fix not handling hdev->le_num_of_adv_sets=1 2024-05-30 09:49:31 +02:00
pcmcia
ras
rdma
rv
scsi scsi: sd: Fix TCG OPAL unlock on system resume 2024-04-03 15:32:45 +02:00
soc soc: qcom: socinfo: rename PM2250 to PM4125 2024-03-26 18:16:34 -04:00
sound ALSA: emu10k1: move the whole GPIO event handling to the workqueue 2024-05-17 12:14:30 +02:00
target
trace ASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value 2024-05-30 09:49:39 +02:00
uapi Bluetooth: HCI: Remove HCI_AMP support 2024-05-30 09:49:30 +02:00
ufs
vdso
video video/sticore: Remove info field from STI struct 2024-01-12 12:38:37 +01:00
xen xen: update PV-device interface headers 2024-01-09 11:46:24 +01:00