lkml.org 
[lkml]   [2022]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCHv4 3/8] mm: Pass down mm_struct to untagged_addr()
Kirill,


> diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c
> index feeb935a2299..abc096a68f05 100644
> --- a/lib/strnlen_user.c
> +++ b/lib/strnlen_user.c
> @@ -97,7 +97,7 @@ long strnlen_user(const char __user *str, long count)
> return 0;
>
> max_addr = TASK_SIZE_MAX;
> - src_addr = (unsigned long)untagged_addr(str);
> + src_addr = (unsigned long)untagged_addr(current->mm, str);

In a downstream kernel with LAM disabled I'm seeing current->mm being
NULL at this point, because strnlen_user() is being called by
kdevtmpfs.
IIUC current->mm is only guaranteed to be non-NULL in the userspace
process context, whereas untagged_addr() may get called in random
places.

Am I missing something?



--
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Liana Sebastian
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

\
 
 \ /
  Last update: 2022-07-05 17:44    [W:0.547 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site