Re: [PATCH RFC 2/2] mm, madvise: move prctl_set_vma() to mm/madvise.c
From: Vlastimil Babka
Date: Tue Jun 24 2025 - 04:12:31 EST
On 6/23/25 19:13, Lorenzo Stoakes wrote:
>> +{
>> + struct mm_struct *mm = current->mm;
>> + const char __user *uname;
>> + struct anon_vma_name *anon_name = NULL;
>> + int error;
>> +
>> + switch (opt) {
>> + case PR_SET_VMA_ANON_NAME:
>
> So I'd like to copy just the below over to madvise - we can decide to move stuff
> around _later_ since it's really weird to have all the anon_vma_name stuff live
> in madvise (apart from the stuff in include/linux/mm-inline.h obv) - but I think
> that can be a follow-up patch.
Sounds good, will try to come up with a name for that function then :)
> I'd like to then split out bits and pieces to make this less yucky too.
>
> Maybe add anon_vma_name_from_user() grabbing the characters, doing the
> strndup_user() etc., have it call a new anon_vma_name_validate() static function
> which does the is_valid_name_char() check against all chars, etc.
Right, I'm fine leaving the followup cleanups to someone else again. My
biggest bother was patch 1 anyway :)
Thanks!