Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp476880ybi; Fri, 21 Jun 2019 02:55:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSNg1hLBIJ19UK8e3I74wrbn2ToiuSiorQ31vCFlJocf/ivXt/UwFfh1TLzhioJsN06b4n X-Received: by 2002:a63:289:: with SMTP id 131mr11362206pgc.211.1561110950962; Fri, 21 Jun 2019 02:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561110950; cv=none; d=google.com; s=arc-20160816; b=HZqFTN7EgLOOM3/CdPeb73FVbt3BbfDYJKZx8Ze6VogYMQTBF9ZB9X/ILbYcF1QVUc vFXo60Ope/dNkgab1zMAfMg0h5goNLVGJJGkzXWAPqrydnUFWLOUeJhBDy1ufXgE6yHv TEgIJB4mLyzA7z+ezsKmcYrNXlvGq8waoYmAFlrleg/BkCk1zlyXxVaj4mbBsjisCYGv bVHxFK5SQu/wQqs8FRxg4pAX6uZw4Y5Gm/AxT02e2BCxzaLV40FFLtb+Qtj7/yjZeRj2 S8Iew/Il3FbL8k+uEMGytViMc36K2Z0v2Ol9tUJ0skSBUE9LPdhVP6Yw2ChLQtytFgQy j0GQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=r/5EuGKs2A0mWXdRWazGFN6nzbIMcawihCqGaduNA9A=; b=kUfA79jDQPAdsKmEDhSy9tAEgoIyctlVqcR1ak7mOUy8B8/rdqtpTC2Qo25EwcwOiC /6llx1rtdt2eaVx+JTTDevAUsDvZv7rUkOtC1YhPCX3X40ELOFIZaz2VSmas7T4biIDf 02Aeg6QWIwae39/G1TwkvfsYJcdpPWx+jB9jBdNcrcB2v4RB7GDpDxRgqkbE0wowCluI 314IqVvbNjGrCbyKczTTfHC0RafX1QkhIXgukgmwmvpv1yDKtq0RgCO0mvRQ6+WUk6LE MojqJrE5fDYqIYD4n3CYFJPGTvDi71w9tjAmZ3t/nAtHHtcDAfq5akkLGtqC7Mlq+psx 2w+g== 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 g2si2239629plg.336.2019.06.21.02.55.35; Fri, 21 Jun 2019 02:55:50 -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 S1727060AbfFUJxu (ORCPT + 99 others); Fri, 21 Jun 2019 05:53:50 -0400 Received: from foss.arm.com ([217.140.110.172]:55574 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726972AbfFUJxr (ORCPT ); Fri, 21 Jun 2019 05:53:47 -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 466981478; Fri, 21 Jun 2019 02:53:46 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B0C973F246; Fri, 21 Jun 2019 02:53:43 -0700 (PDT) From: Vincenzo Frascino To: linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Ralf Baechle , Paul Burton , Daniel Lezcano , Thomas Gleixner , Mark Salyzyn , Peter Collingbourne , Shuah Khan , Dmitry Safonov <0x7f454c46@gmail.com>, Rasmus Villemoes , Huw Davies , Shijith Thotton , Andre Przywara Subject: [PATCH v7 14/25] arm64: compat: Get sigreturn trampolines from vDSO Date: Fri, 21 Jun 2019 10:52:41 +0100 Message-Id: <20190621095252.32307-15-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190621095252.32307-1-vincenzo.frascino@arm.com> References: <20190621095252.32307-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the compat vDSO is enabled, the sigreturn trampolines are not anymore available through [sigpage] but through [vdso]. Add the relevant code the enable the feature. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Vincenzo Frascino Tested-by: Shijith Thotton Tested-by: Andre Przywara --- arch/arm64/include/asm/vdso.h | 3 +++ arch/arm64/kernel/signal32.c | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/arch/arm64/include/asm/vdso.h b/arch/arm64/include/asm/vdso.h index 839ce0031bd5..9b197e5ea759 100644 --- a/arch/arm64/include/asm/vdso.h +++ b/arch/arm64/include/asm/vdso.h @@ -28,6 +28,9 @@ #ifndef __ASSEMBLY__ #include +#ifdef CONFIG_COMPAT_VDSO +#include +#endif #define VDSO_SYMBOL(base, name) \ ({ \ diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index 74e06d8c7c2b..4fca2e1937b2 100644 --- a/arch/arm64/kernel/signal32.c +++ b/arch/arm64/kernel/signal32.c @@ -29,6 +29,7 @@ #include #include #include +#include struct compat_vfp_sigframe { compat_ulong_t magic; @@ -352,6 +353,30 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka, retcode = ptr_to_compat(ka->sa.sa_restorer); } else { /* Set up sigreturn pointer */ +#ifdef CONFIG_COMPAT_VDSO + void *vdso_base = current->mm->context.vdso; + void *vdso_trampoline; + + if (ka->sa.sa_flags & SA_SIGINFO) { + if (thumb) { + vdso_trampoline = VDSO_SYMBOL(vdso_base, + compat_rt_sigreturn_thumb); + } else { + vdso_trampoline = VDSO_SYMBOL(vdso_base, + compat_rt_sigreturn_arm); + } + } else { + if (thumb) { + vdso_trampoline = VDSO_SYMBOL(vdso_base, + compat_sigreturn_thumb); + } else { + vdso_trampoline = VDSO_SYMBOL(vdso_base, + compat_sigreturn_arm); + } + } + + retcode = ptr_to_compat(vdso_trampoline) + thumb; +#else unsigned int idx = thumb << 1; if (ka->sa.sa_flags & SA_SIGINFO) @@ -359,6 +384,7 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka, retcode = (unsigned long)current->mm->context.vdso + (idx << 2) + thumb; +#endif } regs->regs[0] = usig; -- 2.21.0