From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51196C433E0 for ; Thu, 18 Jun 2020 06:43:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D33620FC3 for ; Thu, 18 Jun 2020 06:43:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ooI5Spr2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728023AbgFRGn2 (ORCPT ); Thu, 18 Jun 2020 02:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727115AbgFRGnY (ORCPT ); Thu, 18 Jun 2020 02:43:24 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47DBDC0613ED; Wed, 17 Jun 2020 23:43:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=MnNXAxpQLHOaMqStk9KRD+g+da8mFc/xMCqgIsVzzoQ=; b=ooI5Spr2GNPFCJmAN9ct2PlKo3 PUVMAre3WdizzapatnskE0YvKMD/jl2E7D+48mPdj+8fgkE4nGsxHaDaxqwan6OrJNH9ZPbxZTrnK QbIBO13f86P3cdfNeTDkIczaP3MqoUkk12Q1bPokFEFzHbqF3/7sH/Y74RUNKylgasA5feZSUl9hG BMXBEfBepXcl78GRzj+VXBmRLuP7UwADD7LUoESb74CXc9aWqylL2hnstmfu0ncNUOoW87x1SurcH C5ap3uehlHPOuXkcx8JOWZv/btorO2yH8icOIe1Go+6NtcWbF4cjHBqej24X2KT6iU4VQEy+kgODF QGzC3ncQ==; Received: from 195-192-102-148.dyn.cablelink.at ([195.192.102.148] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jloGU-0007vK-Cb; Thu, 18 Jun 2020 06:43:10 +0000 From: Christoph Hellwig To: Andrew Morton Cc: Dexuan Cui , Vitaly Kuznetsov , Peter Zijlstra , Catalin Marinas , Will Deacon , Jessica Yu , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-mm@kvack.org Subject: fix a hyperv W^X violation and remove vmalloc_exec Date: Thu, 18 Jun 2020 08:43:04 +0200 Message-Id: <20200618064307.32739-1-hch@lst.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, Dexuan reported a W^X violation due to the fact that the hyper hypercall page due switching it to be allocated using vmalloc_exec. The problem is that PAGE_KERNEL_EXEC as used by vmalloc_exec actually sets writable permissions in the pte. This series fixes the issue by switching to the low-level __vmalloc_node_range interface that allows specifing more detailed permissions instead. It then also open codes the other two callers and removes the somewhat confusing vmalloc_exec interface. Peter noted that the hyper hypercall page allocation also has another long standing issue in that it shouldn't use the full vmalloc but just the module space. This issue is so far theoretical as the allocation is done early in the boot process. I plan to fix it with another bigger series for 5.9.