Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2244319ybt; Tue, 16 Jun 2020 00:25:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygZcKQd4eKRgndA4XIueteS7eXMTs7zIyR1YGEOcZl+YU0fu+FVx3Y57Rqlg6iT1LgpQCl X-Received: by 2002:a05:6402:54d:: with SMTP id i13mr1346265edx.330.1592292337094; Tue, 16 Jun 2020 00:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592292337; cv=none; d=google.com; s=arc-20160816; b=kudYDC5yukx4CEkJT2kvS6E13TZSxPCCQ5zwAR3zghPhc8JlezxFYbxlX3T195sIFs Jb/CNY3C9a1ljLQQaYXy42XO9VEXi+lVVPzSoKbhGVtrDWNQjtSnfZMxUzc9+5dOgjPe ByeecqM9eOM/VufvgCNZCnqt+0ZJ5MBYINBXn6JZfZKJCvwk8Xm6QBXekZRsHsLE7N9K Ze7Sh5L5g9+4bJW9rCLh31yNIYnrKp0uU1X9l+B9Bcw1qp7w4mWUBhX80eu9qV2maW1v bie2LqSb4s+j5eH1OPwMMIzX+PhbPezXKPvPYA0YuHiLsuVqNyAO5mINZfvOe1pXpvHL tTuw== 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=WR5BGO5d1INk+EhaJqECkF+PqDtQyJL/q88ubKwQvWo=; b=DHJgJC92ArFSNaI651bNSCN3/dOUwjJk/TZCGhBpMFweTIvhVlubN6fBcnbrIxR107 wrqdhxKUHQthpUfLWroNvJg8Pr7JCRsheWqWbinpGhKw0VV6oqpxv+k8brI8qQpUfERe v5sdMkUq6I07v+Kw0aboT+sIy5ubWSQHbwsn4bIMv/mncryyhiXpoPJTvGBAPpSvS7R8 1WwMxTFFiOs2qg8PACy9ZIo2ff6DqMuJGeOYXCjF7JqejNHCjwiuVWg9xhB2JAAs0/Eq DJtzbK/xK1W9SfYg6RDu+tsVSZO9MIcj+kR4j0BdQHH2KK/4JQjTHx/c3dR3d1SnMsyT 7DSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si10110843ejh.543.2020.06.16.00.25.13; Tue, 16 Jun 2020 00:25:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726569AbgFPHXW (ORCPT + 99 others); Tue, 16 Jun 2020 03:23:22 -0400 Received: from verein.lst.de ([213.95.11.211]:36722 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725768AbgFPHXW (ORCPT ); Tue, 16 Jun 2020 03:23:22 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 0F9A368AFE; Tue, 16 Jun 2020 09:23:19 +0200 (CEST) Date: Tue, 16 Jun 2020 09:23:18 +0200 From: Christoph Hellwig To: Dexuan Cui Cc: vkuznets , Christoph Hellwig , Stephen Hemminger , Andy Lutomirski , Peter Zijlstra , Andy Lutomirski , Michael Kelley , Ju-Hyoung Lee , "x86@kernel.org" , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , KY Srinivasan , Tom Lendacky Subject: Re: hv_hypercall_pg page permissios Message-ID: <20200616072318.GA17600@lst.de> References: <20200407073830.GA29279@lst.de> <87y2ooiv5k.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 15, 2020 at 07:49:41PM +0000, Dexuan Cui wrote: > I did this experiment: > 1. export vmalloc_exec and ptdump_walk_pgd_level_checkwx. > 2. write a test module that calls them. > 3. It turns out that every call of vmalloc_exec() triggers such a warning. > > vmalloc_exec() uses PAGE_KERNEL_EXEC, which is defined as > (__PP|__RW| 0|___A| 0|___D| 0|___G) > > It looks the logic in note_page() is: for_each_RW_page, if the NX bit is unset, > then report the page as an insecure W+X mapping. IMO this explains the > warning? It does. But it also means every other user of PAGE_KERNEL_EXEC should trigger this, of which there are a few (kexec, tboot, hibernate, early xen pv mapping, early SEV identity mapping) We really shouldn't create mappings like this by default. Either we need to flip PAGE_KERNEL_EXEC itself based on the needs of the above users, or add another define to overload vmalloc_exec as there is no other user of that for x86.