Re: [PATCH 3/4] mm/ksm: make break_ksm() more scalable

From: Matthew Wilcox

Date: Sun Sep 13 2026 - 00:43:19 EST


On Fri, Sep 11, 2026 at 04:12:10PM +0800, xu.xin16@xxxxxxxxxx wrote:
> +++ b/mm/ksm.c
> @@ -660,16 +660,11 @@ static int break_ksm_pmd_entry(pmd_t *pmdp, unsigned long addr, unsigned long en
> return found;
> }
>
> -static const struct mm_walk_ops break_ksm_ops = {
> +static struct mm_walk_ops break_ksm_ops = {
> .pmd_entry = break_ksm_pmd_entry,
> .walk_lock = PGWALK_RDLOCK,
> };

Absolutely not. This is a struct full of function pointers, and
you're making it modifiable. That makes it a big juicy target for
attackers to find and exploit.