From: Thomas Gleixner <tglx@linutronix.de>
To: Paul Menzel <pmenzel@molgen.mpg.de>
Cc: linux-mm@kvack.org, x86@kernel.org
Subject: Re: x86/mm: Found insecure W+X mapping at address (ptrval)/0xc00a0000
Date: Fri, 21 Sep 2018 00:51:52 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1809210045220.1434@nanos.tec.linutronix.de> (raw)
In-Reply-To: <0922cc1b-ed51-06e9-df81-57fd5aa8e7de@molgen.mpg.de>
Paul,
On Thu, 20 Sep 2018, Paul Menzel wrote:
> As always, thank you for the quick response.
Thank you for providing the info!
> Am 19.09.2018 um 10:09 schrieb Thomas Gleixner:
> > On Wed, 19 Sep 2018, Paul Menzel wrote:
> > >
> > > With Linux 4.19-rc4+ and `CONFIG_DEBUG_WX=y`, I see the message below on
> > > the ASRock E350M1.
> > >
> > > > [ 1.813378] Freeing unused kernel image memory: 1112K
> > > > [ 1.818662] Write protecting the kernel text: 8708k
> > > > [ 1.818987] Write protecting the kernel read-only data: 2864k
> > > > [ 1.818989] NX-protecting the kernel data: 5628k
> > > > [ 1.819265] ------------[ cut here ]------------
> > > > [ 1.819272] x86/mm: Found insecure W+X mapping at address
> > > > (ptrval)/0xc00a0000
> > >
> > > I do not notice any problems with the system, but maybe something can be
> > > done
> > > to get rid of these.
> >
> > Can you please enable CONFIG_X86_PTDUMP and provide the output of the files
> > in /sys/kernel/debug/page_tables/ ?
>
> By accident, I noticed that this issue does not happen with GRUB as coreboot
> payload, and only with SeaBIOS. (I only tested on the ASRock E350M1.) A
> coreboot developer said, that SeaBIOS does not do mapping though.
Interesting, but I can't spot what causes that.
Can you please apply the patch below, and provide full dmesg of a seabios
and a grub boot along with the page table files for each?
Thanks,
tglx
8<------------------
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index faca978ebf9d..2190d40d99a5 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -794,6 +794,7 @@ void free_kernel_image_pages(void *begin, void *end)
unsigned long len_pages = (end_ul - begin_ul) >> PAGE_SHIFT;
+ pr_info("Freeing init [mem %#010lx-%#010lx]\n", begin_ul, end_ul - 1);
free_init_pages("unused kernel image", begin_ul, end_ul);
/*
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 979e0a02cbe1..651447261798 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -915,6 +915,7 @@ static void mark_nxdata_nx(void)
*/
unsigned long size = (((unsigned long)__init_end + HPAGE_SIZE) & HPAGE_MASK) - start;
+ pr_info("NX data: 0x%08lx - 0x%08lx\n", start, start + size - 1);
if (__supported_pte_mask & _PAGE_NX)
printk(KERN_INFO "NX-protecting the kernel data: %luk\n", size >> 10);
set_pages_nx(virt_to_page(start), size >> PAGE_SHIFT);
@@ -925,6 +926,7 @@ void mark_rodata_ro(void)
unsigned long start = PFN_ALIGN(_text);
unsigned long size = PFN_ALIGN(_etext) - start;
+ pr_info("RO text: 0x%08lx - 0x%08lx\n", start, start + size - 1);
set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
printk(KERN_INFO "Write protecting the kernel text: %luk\n",
size >> 10);
@@ -942,6 +944,7 @@ void mark_rodata_ro(void)
start += size;
size = (unsigned long)__end_rodata - start;
+ pr_info("RO data: 0x%08lx - 0x%08lx\n", start, start + size - 1);
set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
size >> 10);
next prev parent reply other threads:[~2018-09-20 22:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-19 6:55 Paul Menzel
2018-09-19 8:09 ` Thomas Gleixner
2018-09-20 7:07 ` Paul Menzel
2018-09-20 22:51 ` Thomas Gleixner [this message]
2018-09-24 21:47 ` Paul Menzel
2018-09-28 14:55 ` Thomas Gleixner
2018-10-03 21:22 ` Borislav Petkov
2018-10-04 3:11 ` Paul Menzel
2018-10-04 7:48 ` Borislav Petkov
2018-10-04 8:03 ` Joerg Roedel
2018-10-04 8:14 ` Borislav Petkov
2018-10-04 8:40 ` Paul Menzel
2018-10-04 8:49 ` Borislav Petkov
2018-10-04 8:59 ` Paul Menzel
2018-10-04 10:54 ` Borislav Petkov
2018-10-04 11:00 ` Paul Menzel
2018-10-04 11:12 ` Borislav Petkov
2018-10-04 8:43 ` Joerg Roedel
2018-10-04 8:48 ` Borislav Petkov
2018-10-05 9:27 ` Thomas Gleixner
2018-10-05 9:39 ` Paul Menzel
2018-10-08 19:37 ` Thomas Gleixner
2018-10-08 20:08 ` Bjorn Helgaas
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=alpine.DEB.2.21.1809210045220.1434@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=linux-mm@kvack.org \
--cc=pmenzel@molgen.mpg.de \
--cc=x86@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