linux-stable/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 clocksource: hyper-v: Adjust hv_read_tsc_page_tsc() to avoid special casing U64_MAX 2023-06-05 21:11:07 +02:00
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 integrity: PowerVM support for loading third party code signing keys 2023-08-17 20:12:35 +00:00
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 powerpc/math-emu: Remove -w build flag and fix warnings 2022-09-05 17:28:25 +10:00
media media: mc: Add num_links flag to media_pad 2024-04-03 15:32:03 +02:00
memory memory: renesas-rpc-if: Remove Runtime PM wrappers 2023-01-23 11:48:00 +01:00
misc cxl: fix typo in comment 2022-11-24 23:12:19 +11:00
net Bluetooth: hci_core: Fix not handling hdev->le_num_of_adv_sets=1 2024-05-30 09:49:31 +02:00
pcmcia ARM: pxa/sa1100: move I/O space to PCI_IOBASE 2022-05-07 22:56:17 +02:00
ras mm, hwpoison: enable memory error handling on 1GB hugepage 2022-08-08 18:06:44 -07:00
rdma RDMA/core: Fix umem iterator when PAGE_SIZE is greater then HCA pgsz 2023-12-04 20:02:41 -04:00
rv rv: Set variable 'da_mon_##name' to static 2023-09-01 21:00:00 -04:00
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 scsi: target: core: Unexport target_queue_submission() 2023-10-13 15:53:58 -04:00
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 scsi: ufs: core: Rename ufshcd_auto_hibern8_enable() and make it static 2023-12-18 20:51:14 -05:00
vdso arch: vdso: consolidate gettime prototypes 2023-11-23 11:32:32 +01:00
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