From patchwork Wed Sep 25 13:09:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 174356 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp611406ill; Wed, 25 Sep 2019 06:09:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyal06heK5Us/Wu4IK96kCb/b0Uul+Ut5hnCERk6yJoxs0CEb1rOuMIQwqKRLpkpIjnIkLi X-Received: by 2002:a17:906:e288:: with SMTP id gg8mr3964842ejb.24.1569416974541; Wed, 25 Sep 2019 06:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569416974; cv=none; d=google.com; s=arc-20160816; b=H614yxWhIPZJ9a+AOO38NPBJwfmTb7lZ1iRiFpRlUA9834tCtjy5bjjaSOxsQrP91O GUDu8Pkz0rClqlkmlIXITEzif/uA0BZwX7ECheC9wD+Uu05amKo2ybZKg/X1DeoTj5d9 J4+UXHwNwxliOD148syDssZlas5+3ppk38HkNOaom5h73dqOdfDJrH4kCmsH3XepqAwA btjbq/rgykPPMWl6rIUxjhSyhynRe4l/oHoglQ3Re4ol9iWk7mF+bKahXDLR3rfm96Yu f0eHGqgA1gTTh649UTuo67dlkIKIgSLVbIh6lUY9UpmpRc67SLpMrTCtlwuN8oC0NUQh xwMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=TA3vxTC/UGf4Kd3K90Lk7PSKP3remZcnJjVCKR0QlbA=; b=ZwXq/m+1HiHp320oLSBuwAULesnAGA6821n41jCJdbaUG2g4JcvfbNa4o/m85t1TG/ cl1Qk62wdTzZiT2LXhboECPHhAv1CfPXiXBWdRwBlo1CYL76HfVCRN5yHR+2F/1MLqEi U/ElzV/BiXnYmr3kBIGoHTEVXFxWVukHRxlP2LWD/7boJ69NLLgqBxWgEQ7eUSv0c53B oVXt0mMOqBKIePP8M39QjEu2bNtoKY83LNLA3onigTEo+lJChDvZICYh86QWwaWsjuI9 3nq/VT346VrwR8XoZChOhnTectnG68CHrVOFczd2i5tdt08sowjZO3Xr1YqYvP4fQc+6 Bhdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b35si3325379edb.204.2019.09.25.06.09.34; Wed, 25 Sep 2019 06:09:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391493AbfIYNJd (ORCPT + 26 others); Wed, 25 Sep 2019 09:09:33 -0400 Received: from foss.arm.com ([217.140.110.172]:49008 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388199AbfIYNJd (ORCPT ); Wed, 25 Sep 2019 09:09:33 -0400 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 42D981570; Wed, 25 Sep 2019 06:09:32 -0700 (PDT) Received: from arrakis.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 23B543F59C; Wed, 25 Sep 2019 06:09:31 -0700 (PDT) From: Catalin Marinas To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, ard.biesheuvel@linaro.org, ndesaulniers@google.com, Will Deacon , Vincenzo Frascino , Thomas Gleixner Subject: [PATCH] arm64: Allow disabling of the compat vDSO Date: Wed, 25 Sep 2019 14:09:26 +0100 Message-Id: <20190925130926.50674-1-catalin.marinas@arm.com> X-Mailer: git-send-email 2.23.0.rc0 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The compat vDSO building requires a cross-compiler than produces AArch32 binaries, defined via CONFIG_CROSS_COMPILE_COMPAT_VDSO or the CROSS_COMPILE_COMPAT environment variable. If none of these is defined, building the kernel always prints a warning as there is no way to deselect the compat vDSO. Add an arm64 Kconfig entry to allow the deselection of the compat vDSO. In addition, make it an EXPERT option, default n, until other issues with the compat vDSO are solved (64-bit only kernel headers included in user-space vDSO code, CC_IS_CLANG irrelevant to CROSS_COMPILE_COMPAT). Fixes: bfe801ebe84f ("arm64: vdso: Enable vDSO compat support") Cc: Will Deacon Cc: Vincenzo Frascino Cc: Thomas Gleixner Signed-off-by: Catalin Marinas --- It looks like you can't really win with the current compat vDSO logic. You either don't have a compat cross-compiler and you get a Makefile warning or you have one and a get a compiler warning (or failure) because of the 64-bit kernel headers included in 32-bit user-space code. "depends on BROKEN" for ARM64_COMPAT_VDSO also work for me instead of EXPERT. I'll leave it up to Will to decide but I'd like at least this patch in -rc2 (even better if everything else is fixed before the final 5.4). Suggestions for future improvements of the compat vDSO handling: - replace the CROSS_COMPILE_COMPAT prefix with a full COMPATCC; maybe check that it indeed produces 32-bit code - check whether COMPATCC is clang or not rather than CC_IS_CLANG, which only checks the native compiler - clean up the headers includes; vDSO should not include kernel-only headers that may even contain code patched at run-time arch/arm64/Kconfig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) Reviewed-by: Nick Desaulniers diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 866e05882799..83a9a78085c6 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -110,7 +110,6 @@ config ARM64 select GENERIC_STRNLEN_USER select GENERIC_TIME_VSYSCALL select GENERIC_GETTIMEOFDAY - select GENERIC_COMPAT_VDSO if (!CPU_BIG_ENDIAN && COMPAT) select HANDLE_DOMAIN_IRQ select HARDIRQS_SW_RESEND select HAVE_PCI @@ -1185,6 +1184,15 @@ config KUSER_HELPERS Say N here only if you are absolutely certain that you do not need these helpers; otherwise, the safe option is to say Y. +config ARM64_COMPAT_VDSO + bool "Enable the 32-bit vDSO" if EXPERT + depends on !CPU_BIG_ENDIAN + select GENERIC_COMPAT_VDSO + help + Enable the vDSO support for 32-bit applications. You would + need to set the 32-bit cross-compiler prefix in + CONFIG_CROSS_COMPILE_COMPAT_VDSO or the CROSS_COMPILE_COMPAT + environment variable. menuconfig ARMV8_DEPRECATED bool "Emulate deprecated/obsolete ARMv8 instructions"