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=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 5C462C56201 for ; Thu, 19 Nov 2020 18:52:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 7432A24655 for ; Thu, 19 Nov 2020 18:52:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OEVhhmm6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7432A24655 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=12u4QoulTRcVGhnm9Qnk3CArVcj2yGdBXp7cTQEeoJU=; b=OEVhhmm6fCs8SH5Op3+YzsmSU KM0OYgOZyaxYMzEBfehosneToUfnBdesjJoaJdH1cYs6vKfGyLARb2SEvlWLX5OTv8NbNHlpI+ucM IoMtqolLsSvPHZNNxdwFFYydueP6MT17DZvIAGzbwNelxqlzIJASbAUQ/IRxGnNNfGQEu8erzB1Zu tj+hIhCeXLb5fPpi36vwveG/gyYTJCbqxlN4OYWy5UQaz1mUqzGbavuAr+q49le60OFBjN4NgfMiP aBi9ldsXGVNq7gkErhsWXPUPpuDvlx4Gh9wvYkKjGSca6bq9BNRQXEGmBJpzWs1Y5Ve2RNfblWtQ+ 18umW+VEA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfp2X-0001x6-HH; Thu, 19 Nov 2020 18:52:17 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfp2U-0001wX-Kh for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2020 18:52:15 +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 5163B1396; Thu, 19 Nov 2020 10:52:10 -0800 (PST) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9DC273F70D; Thu, 19 Nov 2020 10:52:09 -0800 (PST) Date: Thu, 19 Nov 2020 18:52:05 +0000 From: Dave Martin To: Vladimir Murzin Subject: Re: [PATCH 1/2] arm64: Support execute-only permissions with Enhanced PAN Message-ID: <20201119185205.GO6882@arm.com> References: <20201119133953.15585-1-vladimir.murzin@arm.com> <20201119133953.15585-2-vladimir.murzin@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201119133953.15585-2-vladimir.murzin@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201119_135214_924954_40456AA0 X-CRM114-Status: GOOD ( 20.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: catalin.marinas@arm.com, keescook@chromium.org, linux-arm-kernel@lists.infradead.org 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 Thu, Nov 19, 2020 at 01:39:52PM +0000, Vladimir Murzin wrote: > Enhanced Privileged Access Never (EPAN) allows Privileged Access Never > to be used with Execute-only mappings. > > Absence of such support was a reason for 24cecc377463 ("arm64: Revert > support for execute-only user mappings"). Thus now it can be revisited > and re-enabled. > > Cc: Kees Cook > Cc: Catalin Marinas > Signed-off-by: Vladimir Murzin > --- > arch/arm64/Kconfig | 17 +++++++++++++++++ > arch/arm64/include/asm/cpucaps.h | 5 +++-- > arch/arm64/include/asm/pgtable-prot.h | 5 +++-- > arch/arm64/include/asm/pgtable.h | 14 +++++++++++++- > arch/arm64/include/asm/sysreg.h | 1 + > arch/arm64/kernel/cpufeature.c | 21 +++++++++++++++++++++ > arch/arm64/mm/fault.c | 3 +++ > 7 files changed, 61 insertions(+), 5 deletions(-) > [...] > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > index 1ee9400..b93222e 100644 > --- a/arch/arm64/mm/fault.c > +++ b/arch/arm64/mm/fault.c > @@ -467,6 +467,9 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, > if (faulthandler_disabled() || !mm) > goto no_context; > > + if (cpus_have_const_cap(ARM64_HAS_EPAN)) > + vm_flags &= ~VM_EXEC; > + IIUC, this would be telling __do_page_fault() that the access would have succeeded with any kind of permissions except for write access, which doesn't seem right. Also, isn't vm_flags just overwritten by the code after the hunk? The logic in __do_page_fault() looks like might not have been written with the assumption that there might be more than a single set bit in vm_flags. But I'm not familiar with this code, and might be totally misunderstanding what's going on here... > if (user_mode(regs)) > mm_flags |= FAULT_FLAG_USER; [...] Cheers ---Dave _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel