From patchwork Wed Jul 1 16:18:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 11636829 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A92A912 for ; Wed, 1 Jul 2020 16:20:12 +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 E830C20781 for ; Wed, 1 Jul 2020 16:20:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qYfq1+cA"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="nNb5HwLX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E830C20781 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=9WMEZHQRW3eARi8eIWgHJh/fZdQLvV7sYa9/5ckSyYc=; b=qYfq1+cA5eny1E+9HeVjOQ5Bus AnGzTbe0S7NETdqh4hUNw+QsqYbb//nBNFjMABP6rPVyeA8ZXb2mEfzqffFI0xWd0gTeO8uzU4jle PU3EqsZeWerS51PlH/exy3Niuskoo3dUj/UXmibkWWylG4Rbu9KR2sSro0QJMiV/EPfX/0Qp0jiL+ efsqdktpJAf29EwypFmWPmd1fXj/NHrqweIFRwph3TkOC3qHmvzzXgnDKTI37HoFGOIEPN2AEBkZQ d9Y1gROC8kdwINCGnZUTjDB992WpvlI6st9mUBjBdHi1Y8z4UcAr96I0A5XZ7PKTX6D1rzk44dH3V 0ajaoCGQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqfRT-0004o8-5i; Wed, 01 Jul 2020 16:18:35 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqfRQ-0004mh-FO for linux-arm-kernel@lists.infradead.org; Wed, 01 Jul 2020 16:18:33 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 35BC0207BB; Wed, 1 Jul 2020 16:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593620311; bh=+kg5n5iBRN1rz+NautQXbGnzXr0XI+MwbTAXtj/Q2no=; h=From:To:Cc:Subject:Date:From; b=nNb5HwLX5irb5b+xXWqNzGCwM33f3ij2fcNA9Doyc3lMc2mSaEuzmDurDZyg5pGNw qtTb8ldfZipMDzZAPk2whBdPQLQf/qeTv+mAoc5hh5DlRIA2s1GSUJnenvC6iMhLrA XhPSaJR/kkCtf8psvGp5PYMX0C45lyv9jQnZ8Iyk= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jqfRN-0087Zf-N9; Wed, 01 Jul 2020 17:18:29 +0100 From: Marc Zyngier To: Will Deacon , Catalin Marinas Subject: [PATCH 0/3] arm64: Allow the compat vdso to be disabled at runtime Date: Wed, 1 Jul 2020 17:18:21 +0100 Message-Id: <20200701161824.1346732-1-maz@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, daniel.lezcano@linaro.org, vincenzo.frascino@arm.com, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200701_121832_623638_AB0EAEF3 X-CRM114-Status: GOOD ( 14.60 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [198.145.29.99 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: Mark Rutland , Daniel Lezcano , linux-kernel@vger.kernel.org, Thomas Gleixner , Vincenzo Frascino , kernel-team@android.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The relatively recent introduction of the compat vdso on arm64 has overlooked its interactions with some of the interesting errata workarounds, such as ARM64_ERRATUM_1418040 (and its older 1188873 incarnation). This erratum requires the 64bit kernel to trap 32bit accesses to the virtual counter and emulate it. When the workaround was introduced, the compat vdso simply wasn't a thing. Now that the patches have landed in mainline, we trap the CVTVCT accesses from the vdso. This can end-up in a nasty loop in the vdso, where the sequence number changes on each trap, never stabilising, and leaving userspace in a bit of a funny state (which is why we disable the vdso in most similar cases). This erratum mentionned above is a bit special in the sense that in only requires to trap AArch32 accesses, and 64bit tasks can be left alone. Consequently, the vdso is never disabled and AArch32 tasks are affected. Obviously, we really want to retain the 64bit vdso in this case. To that effect, this series offers a way to disable the 32bit view of the vdso without impacting its 64bit counterpart, by providing a "no-compat" vdso clock_mode, and plugging this feature into the 1418040 detection code. I haven't put any Cc stable for now, but I believe we need to do something for older kernels. Marc Zyngier (3): arm64: Introduce a way to disable the 32bit vdso arm64: arch_timer: Allow an workaround descriptor to provide vdso_clock_mode arm64: timers: Disable the compat vdso for cores affected by ARM64_WORKAROUND_1418040 arch/arm64/include/asm/arch_timer.h | 3 +++ arch/arm64/include/asm/vdso/clocksource.h | 7 +++++-- arch/arm64/include/asm/vdso/compat_gettimeofday.h | 8 +++++++- drivers/clocksource/arm_arch_timer.c | 11 +++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-)