# Re: \[PATCH v2 4/6\] mm: replace vma-\>vm\_flags indirect modification in ksm\_madvise

- From: Michal Hocko \<mhocko@suse.com\>
- Date: 2023-01-25 09:39:00 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2023/01/242256
- Thread: https://ratatoskr.run/linux-mm/2023/01/242241/t.md

```text
On Wed 25-01-23 00:38:49, Suren Baghdasaryan wrote:
> Replace indirect modifications to vma->vm_flags with calls to modifier
> functions to be able to track flag changes and to keep vma locking
> correctness. Add a BUG_ON check in ksm_madvise() to catch indirect
> vm_flags modification attempts.

Those BUG_ONs scream to much IMHO. KSM is an MM internal code so I
gueess we should be willing to trust it.

> Signed-off-by: Suren Baghdasaryan <surenb@google.com>

Acked-by: Michal Hocko <mhocko@suse.com>
-- 
Michal Hocko
SUSE Labs
```
