From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: fix the overlap between the kernel image and vmalloc address
Date: Tue, 25 Apr 2017 15:51:38 +0100 [thread overview]
Message-ID: <20170425145138.GE3792@leverpostej> (raw)
In-Reply-To: <ffd0a3c5-5d89-4bbd-9995-c545bccaa8f6@redhat.com>
On Mon, Apr 24, 2017 at 10:52:08AM -0700, Laura Abbott wrote:
> On 04/24/2017 08:51 AM, Mark Rutland wrote:
> > On Mon, Apr 24, 2017 at 09:28:48PM +0800, zhong jiang wrote:
> >> /*
> >> * Walk a vmap address to the struct page it maps.
> >> */
> >> @@ -244,6 +280,9 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)
> >> */
> >> VIRTUAL_BUG_ON(!is_vmalloc_or_module_addr(vmalloc_addr));
> >>
> >> + if (is_kernel_image_addr(vmalloc_addr))
> >> + return kernel_image_to_page(vmalloc_addr, pgd);
> >
> > It's not clear to me that this is the right place for this to live.
> >
> > It might be best to code the kernel image logic directly in kcore (and
> > kmem), assuming everyone's OK with that approach.
> >
>
> That will fix kcore and kmem but this will show up in other places too.
True.
> We've gone through and made sure that virt_addr_valid returns
> true if and only if virt_to_page returns a valid address. I don't know
> if we can make as strong a claim about is_vmalloc_addr and
> vmalloc_to_page in all cases but is_vmalloc_addr should not return true
> for the kernel image. That would at least let kcore fall back to
> kern_addr_valid which should correctly handle the kernel image.
That would largely be my preference.
My fear is that other users of is_vmalloc_addr() are doing the right
thing for the kernel image today (e.g. not doing virt_to_phys()),
because they see it as a vmalloc addr.
So we might have to audit all of those.
> The suggestion to move the kernel image out of VMALLOC_START/VMALLOC_END
> seems like the best approach although I haven't tried a prototype
> at all.
Given that (AFAICT) we're the only architecture that puts the kernel in
the vmalloc area, I agree that this is likely to be the simplest correct
approach. The interaction with KASLR is somewhat unfortunate.
Thanks,
Mark.
next prev parent reply other threads:[~2017-04-25 14:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-24 9:22 [PATCH] arm64: fix the overlap between the kernel image and vmalloc address zhongjiang
2017-04-24 10:44 ` Mark Rutland
2017-04-24 13:28 ` zhong jiang
2017-04-24 15:51 ` Mark Rutland
2017-04-24 17:52 ` Laura Abbott
2017-04-24 17:56 ` Ard Biesheuvel
2017-04-25 8:13 ` zhong jiang
2017-04-25 15:02 ` Mark Rutland
2017-04-25 15:18 ` Ard Biesheuvel
2017-04-25 14:51 ` Mark Rutland [this message]
2017-04-25 14:11 ` zhong jiang
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=20170425145138.GE3792@leverpostej \
--to=mark.rutland@arm.com \
--cc=linux-arm-kernel@lists.infradead.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).