[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181003212255.GB28361@zn.tnic>
Date: Wed, 3 Oct 2018 23:22:55 +0200
From: Borislav Petkov <bp@...en8.de>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Paul Menzel <pmenzel@...gen.mpg.de>, linux-mm@...ck.org,
x86@...nel.org, lkml <linux-kernel@...r.kernel.org>
Subject: Re: x86/mm: Found insecure W+X mapping at address (ptrval)/0xc00a0000
On Fri, Sep 28, 2018 at 04:55:19PM +0200, Thomas Gleixner wrote:
> Sorry for the delay and thanks for the data. A quick diff did not reveal
> anything obvious. I'll have a closer look and we probably need more (other)
> information to nail that down.
Just a brain dump of what I've found out so far.
Commenting out the init_mem_mapping() call below:
void __init init_mem_mapping(void)
{
unsigned long end;
...
/* the ISA range is always mapped regardless of memory holes */
// init_memory_mapping(0, ISA_END_ADDRESS);
changes the address the warning reports to:
[ 4.392870] x86/mm: Found insecure W+X mapping at address 0xc0000000/0xc0000000
but the machine boots fine otherwise.
Which begs the question: why do we direct-map the ISA range at
PAGE_OFFSET at all? Do we have to have virtual mappings of it at all? I
thought ISA devices don't need that but this is long before my time...
Then, the warning say too:
[ 4.399804] x86/mm: Checked W+X mappings: FAILED, 252 W+X pages found.
and there really are 252 pages (I counted) which are W+X:
---[ Kernel Mapping ]---
0xc0000000-0xc0001000 4K RW x pte
0xc0001000-0xc0099000 608K RW x pte
0xc0099000-0xc009a000 4K ro NX pte
0xc009a000-0xc009b000 4K ro x pte
0xc009b000-0xc009d000 8K RW NX pte
0xc009d000-0xc00a0000 12K RW x pte
0xc00a0000-0xc00a2000 8K RW x pte
0xc00a2000-0xc00b8000 88K RW x pte
0xc00b8000-0xc00c0000 32K RW x pte
0xc00c0000-0xc00f3000 204K RW x pte
0xc00f3000-0xc00fc000 36K RW x pte
0xc00fc000-0xc00fd000 4K RW x pte
0xc00fd000-0xc0100000 12K RW x pte
...
but I can't find where those guys appear from. Will be adding more debug
printks to track it down.
Anyway, just a dump of the current state...
Thx.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
Powered by blists - more mailing lists