[lkml]   [2018]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: x86/mm: Found insecure W+X mapping at address (ptrval)/0xc00a0000
Dear Thomas,

On 10/05/18 11:27, Thomas Gleixner wrote:
> On Thu, 4 Oct 2018, Joerg Roedel wrote:
>> On Wed, Oct 03, 2018 at 11:22:55PM +0200, Borislav Petkov wrote:
>>> 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.
>> I also triggered this when working in the PTI-x32 code. It always
>> happens on a 32-bit PAE kernel for me.
>> Tracking it down I ended up in (iirc) arch/x86/mm/pageattr.c
>> function static_protections():
>> /*
>> * The BIOS area between 640k and 1Mb needs to be executable for
>> * PCI BIOS based config access (CONFIG_PCI_GOBIOS) support.
>> */
>> if (pcibios_enabled && within(pfn, BIOS_BEGIN >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT))
>> pgprot_val(forbidden) |= _PAGE_NX;
>> #endif
>> I think that is the reason we are seeing this in that configuration.
> Uurgh. Yes.
> If pcibios is enabled and used, need to look at the gory details of that
> first, then the W+X check has to exclude that region. We can't do much
> about that.

That would also explain, why it only happens with the SeaBIOS payload,
which sets up legacy BIOS calls. Using GRUB directly as payload, no BIOS
calls are set up.

Reading the Kconfig description of the PCI access mode, the BIOS should
only be used last.

> choice
> prompt "PCI access mode"
> depends on X86_32 && PCI
> default PCI_GOANY
> ---help---
> On PCI systems, the BIOS can be used to detect the PCI devices and
> determine their configuration. However, some old PCI motherboards
> have BIOS bugs and may crash if this is done. Also, some embedded
> PCI-based systems don't have any BIOS at all. Linux can also try to
> detect the PCI hardware directly without using the BIOS.
> With this option, you can specify how Linux should detect the
> PCI devices. If you choose "BIOS", the BIOS will be used,
> if you choose "Direct", the BIOS won't be used, and if you
> choose "MMConfig", then PCI Express MMCONFIG will be used.
> If you choose "Any", the kernel will try MMCONFIG, then the
> direct access method and falls back to the BIOS if that doesn't
> work. If unsure, go with the default, which is "Any".

Kind regards,


[unhandled content-type:application/pkcs7-signature]
 \ /
  Last update: 2018-10-05 11:40    [W:0.113 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site