Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp823064ybi; Thu, 30 May 2019 07:18:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcJgOCQ1ExTTsvFOGCGUsXMs5kFIjUZEvEgamXhRnbSvmXDMkAjuoZmUvBXzUL8p2Yji1+ X-Received: by 2002:a62:4c5:: with SMTP id 188mr3961786pfe.19.1559225920336; Thu, 30 May 2019 07:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559225920; cv=none; d=google.com; s=arc-20160816; b=zp+1mlKo2ZMMA8IVIB4x9ICScAwJXdq+nRFt1G2tV20hn0o7uKTH0wlEjIeqJPMCoc DOpmh0EN9XkENL3e80edxgGwll8Y+dzxyUYChS4WDMlHtTt/O3lXrN+0jihLGt6ime3U j+YdX8EkTrgejMFU6COJF2/QVCfMnT/6DQd43QiDEI7GW7JKgcEUZdKdjLiSAwbflTD0 sGuB++IiWfJb2/X0igK367Dj0nmbfb7tWe5EN+P5yitXdU6wIC4bP9cLTZLLkN6lqF8K dtpzt3rZ2L5RaGNZ4Mexith6t5sEftuezlev4qkt1qo4iOEn0vgazjoXcLUo0knximbl 7cbA== 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=r1jph+JUHouk0lmhyip4i2YvYQslgMeM8L3iiA1giSc=; b=VqYhTLGUipJGkfWYWSe6gr5S7VwznFOfo4izOBXUQbBWpeU3yYCD952SRATvReFjhY 2XYgq05jzZNsyI3ORrR0/hnIXjwaGmA3lH1yVei2VTtBdQvFqcOhBt6g2LQBSjIut8oO SD89O16+kbVr2mbWcwyQ7UWR/S0DNdNwf1p/Ofb2xoXeALnEwRFNdmMZhFCyQpfUmTBo /v69SYLDDxWdBD2YCjOOiTKEXakzo9TKG0ft6qFdcu45myZG51tQnVtLkab9lfzfv02b 1ZaYwnY7MeYqk+U/JQ0FjBwS7SwyNVq4Td6ZBJtX3H2RRCAPmuMjzR8oEqQVgfGoReGa wArw== 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 a22si2282499pjo.18.2019.05.30.07.18.21; Thu, 30 May 2019 07:18:40 -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 S1727535AbfE3OQe (ORCPT + 99 others); Thu, 30 May 2019 10:16:34 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:36814 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727510AbfE3OQc (ORCPT ); Thu, 30 May 2019 10:16:32 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 800D1165C; Thu, 30 May 2019 07:16:32 -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 6877E3F59C; Thu, 30 May 2019 07:16:29 -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 Subject: [PATCH v6 14/19] arm64: compat: Get sigreturn trampolines from vDSO Date: Thu, 30 May 2019 15:15:26 +0100 Message-Id: <20190530141531.43462-15-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530141531.43462-1-vincenzo.frascino@arm.com> References: <20190530141531.43462-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 --- 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