linux-csky.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@stackframe.org>
To: Helge Deller <deller@gmx.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-csky@vger.kernel.org, linux-mm@kvack.org,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Guo Ren <guoren@kernel.org>,
	linux-parisc@vger.kernel.org,
	Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Subject: Re: [PATCH v2] usercopy/csky: Do not fail on memory from former init sections
Date: Thu, 27 Jan 2022 20:03:38 +0100	[thread overview]
Message-ID: <87k0el57cl.fsf@x1.stackframe.org> (raw)
In-Reply-To: <YfLpNkmlvoR8iPcq@ls3530> (Helge Deller's message of "Thu, 27 Jan 2022 19:49:26 +0100")

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

      reply	other threads:[~2022-01-27 19:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 18:49 [PATCH v2] usercopy/csky: Do not fail on memory from former init sections Helge Deller
2022-01-27 19:03 ` Sven Schnelle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k0el57cl.fsf@x1.stackframe.org \
    --to=svens@stackframe.org \
    --cc=akpm@linux-foundation.org \
    --cc=deller@gmx.de \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=guoren@kernel.org \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-parisc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).