lkml.org 
[lkml]   [2022]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2] usercopy/csky: Do not fail on memory from former init sections
Date
Helge Deller <deller@gmx.de> writes:

> While working on the parisc port I suddenly noticed that with
> HARDENED_USERCOPY=y the usercopy checks randomly reported errors which even
> prevented the kernel to boot into userspace.
>
> Specifically the function check_kernel_text_object() reported those errors, as
> it thought the kernel variable I was using belongs to the kernel text area, and
> as such was invalid to be used.
> [..]
> diff --git a/mm/usercopy.c b/mm/usercopy.c
> index b3de3c4eefba..37a35c6051bc 100644
> --- a/mm/usercopy.c
> +++ b/mm/usercopy.c
> @@ -113,6 +113,15 @@ static bool overlaps(const unsigned long ptr, unsigned long n,
> return true;
> }
>
> +static bool inside_init_area(const unsigned long ptr, unsigned long n,
> + char *start, char *end)
> +{
> + unsigned long initlow = (unsigned long) start;
> + unsigned long inithigh = (unsigned long) end;
> +
> + return (ptr >= initlow && (ptr + n) < inithigh);
> +}

Gerald added something similar with 7a5da02de8d6 ("locking/lockdep:
check for freed initmem in static_obj()"), so i wonder whether that
could be used?

Regards
Sven

\
 
 \ /
  Last update: 2022-01-27 20:21    [W:0.038 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site