[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87k0el57cl.fsf@x1.stackframe.org>
Date: Thu, 27 Jan 2022 20:03:38 +0100
From: Sven Schnelle <svens@...ckframe.org>
To: Helge Deller <deller@....de>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-csky@...r.kernel.org, linux-mm@...ck.org,
Linux Kernel <linux-kernel@...r.kernel.org>,
Guo Ren <guoren@...nel.org>, linux-parisc@...r.kernel.org,
Gerald Schaefer <gerald.schaefer@...ux.ibm.com>
Subject: Re: [PATCH v2] usercopy/csky: Do not fail on memory from former
init sections
Helge Deller <deller@....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
Powered by blists - more mailing lists