Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp677914imm; Thu, 4 Oct 2018 01:15:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV6363uR/ws6W0+EQd1btbpp/EXR4KQjMaeVeJvSY7I63YZgKfdkLMFhiWd3KahQU2BWowiCa X-Received: by 2002:a17:902:700a:: with SMTP id y10-v6mr5358933plk.328.1538640914493; Thu, 04 Oct 2018 01:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538640914; cv=none; d=google.com; s=arc-20160816; b=phNcMzV6/w8VH+nL2A5bChKodPjKUmUNbm1n+s1A+o4q4S36YlYZnFe0fY/UXCbTjt NXpSzl3J6dJ15SQKbr5skbJM/cVhwJcrPW82gbWICI484zVu7yHRGSvA52amvAu5vE9i M3/1ufxlLb8c1rBnq7XtPXyi4w6tkbq/XOpfYIOjnUuRopOlmjt6ammnfQhfal//JyDe ymASS2Es6JM80nFLxh71sxUb+4M9mahJ/9qOZDusMOfNGwg1hab2l78FpmvjJsZ4Bd46 RFIzFZNWO6R3UZwYDKZbXZfCE8GAjNMMbbzcxiKMs+3tyhP5cRCahozOAiKq+JK/82QA rfvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ShnNc5WjEUYvth1gEmXRKFwRvg2RSJDJ20Gg8mhTym4=; b=LNg0IEI9WRHDMfjznoiNfAFoOUl1aF1jWDcHkZKhDTvSpWyhP0WHeqDqGnS14i2CQZ DfWz2kNYGrIYePGM+5t5A/HUUYoeJlQcn8oPsoHrlUypPX5y77MsxR7nS8uHcBJkRCxy V+1kVIOahCwBlLNYKW43xDy3YT4dUeidKQmvasDCPJHmdxx4GgGL2dpbXi8uxQRmYIv9 rN193e7HxAdDOLFSlypsRm3HPuFwii2illD/Pox6pWralBblG8UxB9+CzzgEAgQ6lBKc GZdFuRBtl9RalvB4UPCraAe7PP22hJEpVaDI6NQiU3imS2iSdFnh4VsQ3WGbnz4AXU1x N0TQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12-v6si4237778pls.367.2018.10.04.01.14.58; Thu, 04 Oct 2018 01:15:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbeJDPGt (ORCPT + 99 others); Thu, 4 Oct 2018 11:06:49 -0400 Received: from mail.skyhub.de ([5.9.137.197]:58090 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726852AbeJDPGt (ORCPT ); Thu, 4 Oct 2018 11:06:49 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 2G3EmKlytJxs; Thu, 4 Oct 2018 10:14:44 +0200 (CEST) Received: from zn.tnic (p200300EC2BCA7500329C23FFFEA6A903.dip0.t-ipconnect.de [IPv6:2003:ec:2bca:7500:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 6D42D1EC02D1; Thu, 4 Oct 2018 10:14:44 +0200 (CEST) Date: Thu, 4 Oct 2018 10:14:38 +0200 From: Borislav Petkov To: Joerg Roedel Cc: Thomas Gleixner , Paul Menzel , linux-mm@kvack.org, x86@kernel.org, lkml Subject: Re: x86/mm: Found insecure W+X mapping at address (ptrval)/0xc00a0000 Message-ID: <20181004081429.GB1864@zn.tnic> References: <0922cc1b-ed51-06e9-df81-57fd5aa8e7de@molgen.mpg.de> <20181003212255.GB28361@zn.tnic> <20181004080321.GA3630@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181004080321.GA3630@8bytes.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 04, 2018 at 10:03:21AM +0200, Joerg Roedel wrote: > 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. > */ > #ifdef CONFIG_PCI_BIOS > 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. So looking at this, BIOS_BEGIN and BIOS_END is the same range as the ISA range: #define ISA_START_ADDRESS 0x000a0000 #define ISA_END_ADDRESS 0x00100000 #define BIOS_BEGIN 0x000a0000 #define BIOS_END 0x00100000 and I did try marking the ISA range RO in mark_rodata_ro() but the machine wouldn't boot after. So I'm guessing BIOS needs to write there some crap. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.