From: Greg KH <gregkh@linux-foundation.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: stable@vger.kernel.org, akpm@linux-foundation.org,
broonie@kernel.org, mark.rutland@arm.com, labbott@redhat.com,
Michal Hocko <mhocko@suse.com>,
zhong jiang <zhongjiang@huawei.com>,
Dave Hansen <dave.hansen@intel.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [STABLE BACKPORT] mm/vmalloc.c: huge-vmap: fail gracefully on unexpected huge vmap mappings
Date: Mon, 3 Jul 2017 13:46:10 +0200 [thread overview]
Message-ID: <20170703114610.GA19948@kroah.com> (raw)
In-Reply-To: <20170703111351.26561-1-ard.biesheuvel@linaro.org>
On Mon, Jul 03, 2017 at 12:13:51PM +0100, Ard Biesheuvel wrote:
> Existing code that uses vmalloc_to_page() may assume that any address
> for which is_vmalloc_addr() returns true may be passed into
> vmalloc_to_page() to retrieve the associated struct page.
>
> This is not un unreasonable assumption to make, but on architectures
> that have CONFIG_HAVE_ARCH_HUGE_VMAP=y, it no longer holds, and we need
> to ensure that vmalloc_to_page() does not go off into the weeds trying
> to dereference huge PUDs or PMDs as table entries.
>
> Given that vmalloc() and vmap() themselves never create huge mappings or
> deal with compound pages at all, there is no correct answer in this
> case, so return NULL instead, and issue a warning.
>
> When reading /proc/kcore on arm64, you will hit an oops as soon as you
> hit the huge mappings used for the various segments that make up the
> mapping of vmlinux. With this patch applied, you will no longer hit the
> oops, but the kcore contents willl be incorrect (these regions will be
> zeroed out)
>
> We are fixing this for kcore specifically, so it avoids vread() for
> those regions. At least one other problematic user exists, i.e.,
> /dev/kmem, but that is currently broken on arm64 for other reasons.
>
> Link: http://lkml.kernel.org/r/20170609082226.26152-1-ard.biesheuvel@linaro.org
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Acked-by: Mark Rutland <mark.rutland@arm.com>
> Reviewed-by: Laura Abbott <labbott@redhat.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: zhong jiang <zhongjiang@huawei.com>
> Cc: Dave Hansen <dave.hansen@intel.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> (cherry picked from commit 029c54b09599573015a5c18dbe59cbdf42742237)
> [ardb: non-trivial backport to v4.9]
Thanks for this, now queued up.
greg k-h
prev parent reply other threads:[~2017-07-03 11:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-03 11:13 [STABLE BACKPORT] mm/vmalloc.c: huge-vmap: fail gracefully on unexpected huge vmap mappings Ard Biesheuvel
2017-07-03 11:46 ` Greg KH [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=20170703114610.GA19948@kroah.com \
--to=gregkh@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=broonie@kernel.org \
--cc=dave.hansen@intel.com \
--cc=labbott@redhat.com \
--cc=mark.rutland@arm.com \
--cc=mhocko@suse.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=zhongjiang@huawei.com \
/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