From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751090AbeAPVTU (ORCPT + 1 other); Tue, 16 Jan 2018 16:19:20 -0500 Received: from foss.arm.com ([217.140.101.70]:33126 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750772AbeAPVTT (ORCPT ); Tue, 16 Jan 2018 16:19:19 -0500 Date: Tue, 16 Jan 2018 21:19:13 +0000 Message-ID: <86r2qpec32.wl-marc.zyngier@arm.com> From: Marc Zyngier To: Nicolin Chen Cc: mark.rutland@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, oleg@redhat.com, cdall@linaro.org, tbaicar@codeaurora.org, julien.thierry@arm.com, Dave.Martin@arm.com, robin.murphy@arm.com, james.morse@arm.com, ard.biesheuvel@linaro.org, xiexiuqi@huawei.com, mingo@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC v1] arm64: Handle traps from accessing CNTVCT/CNTFRQ for CONFIG_COMPAT In-Reply-To: <20180116203218.GA6318@Asurada-Nvidia> References: <1515645816-14063-1-git-send-email-nicoleotsuka@gmail.com> <20180116203218.GA6318@Asurada-Nvidia> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: ARM Ltd MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, 16 Jan 2018 20:32:19 +0000, Nicolin Chen wrote: > > Hello Marc, > > On Thu, Jan 11, 2018 at 08:51:37AM +0000, Marc Zyngier wrote: > > > [ I also added cntfrq here for safety as theoretically it could > > > trigger the trap as well. However, my another test case (with > > > mrc insturction) doesn't seem to trigger a trap. So I would > > > drop it in the next version if someone can confirm it's not > > > required. Thanks -- Nicolin ] > > > > See my previous series on this very subject[1] as well as Will's reply. > > Thanks for the background. > > > > - for (hook = sys64_hooks; hook->handler; hook++) > > > + for (; hook && hook->handler; hook++) > > > if ((hook->esr_mask & esr) == hook->esr_val) { > > > hook->handler(esr, regs); > > > return; > > > > > > > Also, this code is fairly broken in its handling of conditional > > instructions. > > I understand that it should take care of the condition field as > a general instruction handler. Just for curiosity: If we confine > the topic to read access of CNTVCT/CNTFRQ, what'd be the penalty > by ignoring the condition field and executing it anyway? Do you mean, apart from severely corrupting userspace execution? That's a rhetorical question, right? M. -- Jazz is not dead, it just smell funny.