Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp194560imm; Wed, 3 Oct 2018 14:23:15 -0700 (PDT) X-Google-Smtp-Source: ACcGV60psZR9Bp8jcrNFORiSSY232RN+nlaZMinNFo+eXpQ1i/seOrUBCqUwDKm765yh/EXU0njG X-Received: by 2002:a63:6507:: with SMTP id z7-v6mr2934007pgb.200.1538601795348; Wed, 03 Oct 2018 14:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538601795; cv=none; d=google.com; s=arc-20160816; b=mZ1d+PAVx/SjAdiyKjj7f2GRholo+mITY/SS6vntVY+5gh3fLaw4n3WOjTa8UQVwhc yMDBR8ugIgXXsfSl0x9QW5k2hgds5bLO0Ndt4s20i7gUcARD3qFqtBNrvDqWBaI0C+xX DPBKL3oGWZekZ1zZICxynAZZD2G9irR34PTbeGBs0GIEM6oHOvU9HMM98EET93SwHrcq 6gBu8odnjpl6kWJHTRxjHGp9SqfwOSFZ0UWpxkw6y47D8VduSj84SOtFI1tzYrJtr7Xg +kPNJ1tU9D1TKcxDhZftrmJEBWT+RbIWaxfI5IVQ2Klr8VhoX5gy9zZsKvMhily2WxEE XNlg== 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=znVW+v69u1F/LMnDiTWBl4TwpPkGdK3Aj6Qwb8rXVsk=; b=QkipUPymb6ggByPDIwV3BOmUDOToR8QJZdKnuIQkIuSGC4kEJWrD0ayqr7YUFq5EfH Azn31HIrYn+iCn+9Y0yRwpITdCbPilpq1YK7aisfC7CAsPVAPHBc2aWmI2NEMOhAfixh dTFUxnGYswz1YCnA4Au5Thi5roCn0yUm42ETDkJlPMLw2pwyBL8eKbOUYD28dP/SNwlI +jZCEjQTmz99ZYiGSEl7P7Hv9dvxodXt4LvhQm6cf8GfvYYYbabQTnhAwQwr/NG4CbVc ctjh3FM2CcSixX4iaIdf3shmBWlkQz5q6mRGOb+uy22y9Y8k30vF5P7noC5SR9uBQL2k l2Fg== 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 v6-v6si2463536pgb.333.2018.10.03.14.23.00; Wed, 03 Oct 2018 14:23:15 -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 S1726730AbeJDENC (ORCPT + 99 others); Thu, 4 Oct 2018 00:13:02 -0400 Received: from mail.skyhub.de ([5.9.137.197]:39032 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbeJDENC (ORCPT ); Thu, 4 Oct 2018 00:13:02 -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 yJ-7csAtK4wV; Wed, 3 Oct 2018 23:22:55 +0200 (CEST) Received: from zn.tnic (p200300EC2BC64F00329C23FFFEA6A903.dip0.t-ipconnect.de [IPv6:2003:ec:2bc6:4f00: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 63F531EC053F; Wed, 3 Oct 2018 23:22:55 +0200 (CEST) Date: Wed, 3 Oct 2018 23:22:55 +0200 From: Borislav Petkov To: Thomas Gleixner Cc: 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: <20181003212255.GB28361@zn.tnic> References: <0922cc1b-ed51-06e9-df81-57fd5aa8e7de@molgen.mpg.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 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.