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=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 6311EC43381 for ; Tue, 9 Mar 2021 05:53:48 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E12656527C for ; Tue, 9 Mar 2021 05:53:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E12656527C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UNqJHyP6ApYubKeedl8A9ucKJA+dl8AEDAlthAkpSGA=; b=Jj3dxZq39/9TO+FyuceANxzcv K3wad+LJTnrgJn9uHJ/UfoLAtSVaxfwnTgb9ox1MNnbQnxwGRk/I98CZUwkGlhVSjofKIhMPBZ3QV voJmEiRlk375n7RTgFAGhn8FQwjlAqI9TPTC+SuaKbQgHD4qHo3Ik8TQseJygn11KCNwTBHKHSWlq 2s2+iBhh4+pVTl9vikK5eSesIOxCb5TwKj1WWL8OJTfgtF2XuMaXzGad6w5bL1CIcG+8DMaipV9Iy SIVZhXcWkxtN+GgVU2il55E3xFlxTMel42lF1aox+Q0x/ImQvL88HdZZW2muynhDaixN/M0LQD5uI C7Y01FBcg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJVHm-003qDf-A0; Tue, 09 Mar 2021 05:52:02 +0000 Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJVHh-003qDK-OK for linux-arm-kernel@lists.infradead.org; Tue, 09 Mar 2021 05:51:59 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 93969D6E; Mon, 8 Mar 2021 21:51:53 -0800 (PST) Received: from [10.163.66.57] (unknown [10.163.66.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 33DF93F70D; Mon, 8 Mar 2021 21:51:50 -0800 (PST) Subject: Re: [PATCH v2 2/3] arm64: mm: use XN table mapping attributes for the linear region To: Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Cc: maz@kernel.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, qperret@google.com, kernel-team@android.com References: <20210308181535.16230-1-ardb@kernel.org> <20210308181535.16230-3-ardb@kernel.org> From: Anshuman Khandual Message-ID: <6439069f-4ac1-970f-794f-fa24edceb76f@arm.com> Date: Tue, 9 Mar 2021 11:22:22 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210308181535.16230-3-ardb@kernel.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210309_055158_220896_5CAAF89A X-CRM114-Status: GOOD ( 15.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 3/8/21 11:45 PM, Ard Biesheuvel wrote: > The way the arm64 kernel virtual address space is constructed guarantees > that swapper PGD entries are never shared between the linear region on > the one hand, and the vmalloc region on the other, which is where all > kernel text, module text and BPF text mappings reside. > > This means that mappings in the linear region (which never require > executable permissions) never share any table entries at any level with > mappings that do require executable permissions, and so we can set the > table-level PXN attributes for all table entries that are created while > setting up mappings in the linear region. Since swapper's PGD level page > table is mapped r/o itself, this adds another layer of robustness to the > way the kernel manages its own page tables. While at it, set the UXN > attribute as well for all kernel mappings created at boot. What happens when FEAT_HPDS is implemented and also being enabled ? Would there be any adverse affect here or at least break the assumption that the linear mapping page table entries are safer than before ? Hence, it might be still better to check FEAT_HPDS feature enablement here, even it it is not being used right now. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel