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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 6FE2FC433DF for ; Thu, 2 Jul 2020 10:20:16 +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 3A409206DD for ; Thu, 2 Jul 2020 10:20:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="x9bMsAfE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A409206DD Authentication-Results: mail.kernel.org; dmarc=none (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=l6OdG5vBuFa/SRPN7hZBsKlVxfE+GrxsNaVt0kKZgz0=; b=x9bMsAfEzAUUVDjYylrLwejYe EtqpCuH6rzSrVNJRvyPxupk2ZU6Q33PnWi43ARwg/b/1571HgRGOdAxfcJmN8+hRC9DmiamhBxHCN 9kX77dRHiqnL46Ynx1dqXeidK2zCI7n4UKlLNeSEVv6LKliKXdz+elzSwXx1b0x//An4x7aHShQH6 y9M7aBPu1tpPwBnsQK83pCFhbry57DRAglrlKyhrUij02wrTNw9Q1qjCJ5NEWhK/uJ130UmFMldtY GWkdyNttviAisoRJUCzDhuzVOyEF2o9E4xGDKDubtVV6h9kQlvzz72PDo/HhJ+cFsIuwpTThp4OsL g3lP/uBQQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqwIj-00014K-HI; Thu, 02 Jul 2020 10:18:41 +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 1jqwIU-0000z2-Qx for linux-arm-kernel@lists.infradead.org; Thu, 02 Jul 2020 10:18:38 +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 E240D1FB; Thu, 2 Jul 2020 03:18:24 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.12.193]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9EA193F71E; Thu, 2 Jul 2020 03:18:22 -0700 (PDT) Date: Thu, 2 Jul 2020 11:18:19 +0100 From: Mark Rutland To: Marc Zyngier Subject: Re: [PATCH 1/3] arm64: Introduce a way to disable the 32bit vdso Message-ID: <20200702101819.GB15391@C02TD0UTHF1T.local> References: <20200701161824.1346732-1-maz@kernel.org> <20200701161824.1346732-2-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200701161824.1346732-2-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200702_061826_958564_AD680DA5 X-CRM114-Status: GOOD ( 22.64 ) 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: kernel-team@android.com, Catalin Marinas , Daniel Lezcano , linux-kernel@vger.kernel.org, Thomas Gleixner , Vincenzo Frascino , Will Deacon , 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 Wed, Jul 01, 2020 at 05:18:22PM +0100, Marc Zyngier wrote: > We have a class of errata (grouped under the ARM64_WORKAROUND_1418040 > banner) that force the trapping of counter access from 32bit EL0. > > We would normally disable the whole vdso for such defect, except that > it would disable it for 64bit userspace as well, which is a shame. > > Instead, add a new vdso_clock_mode, which signals that the vdso > isn't usable for compat tasks. This gets checked in the new > vdso_clocksource_ok() helper, now provided for the 32bit vdso. > > Signed-off-by: Marc Zyngier As-is this looks sound to me. It's not entirely clear to me how this will compose with VDSO_CLOCKMODE_TIMENS, but given this series is fixing an existing brokenness I think this has higher priority. Minor comment below, but regardless: Acked-by: Mark Rutland > --- > arch/arm64/include/asm/vdso/clocksource.h | 7 +++++-- > arch/arm64/include/asm/vdso/compat_gettimeofday.h | 8 +++++++- > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/include/asm/vdso/clocksource.h b/arch/arm64/include/asm/vdso/clocksource.h > index df6ea65c1dec..b054d9febfb5 100644 > --- a/arch/arm64/include/asm/vdso/clocksource.h > +++ b/arch/arm64/include/asm/vdso/clocksource.h > @@ -2,7 +2,10 @@ > #ifndef __ASM_VDSOCLOCKSOURCE_H > #define __ASM_VDSOCLOCKSOURCE_H > > -#define VDSO_ARCH_CLOCKMODES \ > - VDSO_CLOCKMODE_ARCHTIMER > +#define VDSO_ARCH_CLOCKMODES \ > + /* vdso clocksource for both 32 and 64bit tasks */ \ > + VDSO_CLOCKMODE_ARCHTIMER, \ > + /* vdso clocksource for 64bit tasks only */ \ > + VDSO_CLOCKMODE_ARCHTIMER_NOCOMPAT > > #endif > diff --git a/arch/arm64/include/asm/vdso/compat_gettimeofday.h b/arch/arm64/include/asm/vdso/compat_gettimeofday.h > index b6907ae78e53..9a625e8947ff 100644 > --- a/arch/arm64/include/asm/vdso/compat_gettimeofday.h > +++ b/arch/arm64/include/asm/vdso/compat_gettimeofday.h > @@ -111,7 +111,7 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) > * update. Return something. Core will do another round and then > * see the mode change and fallback to the syscall. > */ > - if (clock_mode == VDSO_CLOCKMODE_NONE) > + if (clock_mode != VDSO_CLOCKMODE_ARCHTIMER) > return 0; > > /* > @@ -152,6 +152,12 @@ static __always_inline const struct vdso_data *__arch_get_vdso_data(void) > return ret; > } > > +static inline bool vdso_clocksource_ok(const struct vdso_data *vd) > +{ > + return vd->clock_mode == VDSO_CLOCKMODE_ARCHTIMER; > +} > +#define vdso_clocksource_ok vdso_clocksource_ok Existing issue, but it's a shame this doesn't take the clock mode directly, then we wouldn't have to duplicate the conditions (as above, inverted). Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel