* Re: [PATCH v2] usercopy/csky: Do not fail on memory from former init sections
[not found] <YfLpNkmlvoR8iPcq@ls3530>
@ 2022-01-27 19:03 ` Sven Schnelle
0 siblings, 0 replies; only message in thread
From: Sven Schnelle @ 2022-01-27 19:03 UTC (permalink / raw)
To: Helge Deller
Cc: Andrew Morton, linux-csky, linux-mm, Linux Kernel, Guo Ren,
linux-parisc, Gerald Schaefer
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-27 19:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <YfLpNkmlvoR8iPcq@ls3530>
2022-01-27 19:03 ` [PATCH v2] usercopy/csky: Do not fail on memory from former init sections Sven Schnelle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox