Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp361466imm; Mon, 1 Oct 2018 11:04:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV61mJk0hFbr5RLeUigH8vMXG34tkWP/LnDkvJm01RfpokCbwYzaCFaC8xWuhf7wOab7YZRbQ X-Received: by 2002:a17:902:9a07:: with SMTP id v7-v6mr12704608plp.14.1538417095629; Mon, 01 Oct 2018 11:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538417095; cv=none; d=google.com; s=arc-20160816; b=a6ukraQqSd11T143ZMrjmV5HzrlhPmGAE/SiJ5jLadWyu+RSlGmYciZUa1cI+73vVU zIwm45A07yjl7SMYnAm5zkFc2otl0EkMteKe96gaFiGykRkzOn9HufpDTq5S3uxQAPjw hbtF5DrgOD1o48dy+ZZwuWfRBDT5fSEQxVLpKq5Z/iKTm7Zbp85TbRxFreWtLSOKdxSt tzH6iAKfV+sg+mFsGpv7Z5AWixAbt7JGFzXS1x1uT+/LZ19imxZVt3dBjXL3Zpa+tBkK Zf0RNHLGRs1yMl4gwsUOG8nFwf94EDpWQox+mhhpbC+cfaC4vo+zILqFZqbRTaYiD7Sx FXUg== 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 :dkim-signature; bh=kiIGQCmGtALrXwsBG8zSqpjHC9E+lsH1ZMYz/Tcb/9o=; b=TB1oDzdRp+zXRgcwuFc3at7BQPsn4TqruGvzlWtwIupO80RZnK7btT7mnbcQSFrjLU h0NUtTGpVG9/EDKHAJ3YaR3fC5TAmC+b3YcXMwcsyBe7h9prSmdLU77Uxw7za0x8lR0x +HfZLl6ITALQU1NS0Uutua837kcdpmoLf6XIAY5NeGvD0/N7V4l6UEdnEft5jIR3neDr qeBTImGfq088h59xqoXljXvPuXULNRseTL7QpB4LAcyN/oKaIrjOxNVqJmV4EEUwTbnV DJSRCfBz2MX8CCmn2ab+z11ycQS/RndsZES/Nxr24X/VN9GiqIvU7ikw5rwtMcREIMu1 j0sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=KSUBKvLx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b13-v6si14808700plm.275.2018.10.01.11.04.34; Mon, 01 Oct 2018 11:04:55 -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; dkim=pass header.i=@android.com header.s=20161025 header.b=KSUBKvLx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726794AbeJBAnA (ORCPT + 99 others); Mon, 1 Oct 2018 20:43:00 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35734 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726143AbeJBAnA (ORCPT ); Mon, 1 Oct 2018 20:43:00 -0400 Received: by mail-pf1-f196.google.com with SMTP id p12-v6so9814732pfh.2 for ; Mon, 01 Oct 2018 11:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kiIGQCmGtALrXwsBG8zSqpjHC9E+lsH1ZMYz/Tcb/9o=; b=KSUBKvLxsj68k0Si0J4ZR79pL0sEeAxw19tZFkj8bmO8cwrgukdO7fSTH0Trjfamzu nzdqvr78u9mIb+cE4sexVRirTM1ono+O/YnveR57mLO6kDMF1pKH8kDl+M8z8R7kMc9N 3+YEBCTxd19rMX0rMJygiJcoFysYtHoWDx+YYQR7k+agXXNxPhb2/IvLIoA6oWnxx7LN hbXAoKA0T9DbY9sCKOfU7gqDaM097KeBKMspLn7pjde8AA6ZIb6svxzG/YPSJCAAcYxy BYSi/7sZSoniP5oJr2VSSnCNBGE+UNrQt51mv9s4fa4xHStZ/TmvEC2xVWSP7z9p2tay DXgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kiIGQCmGtALrXwsBG8zSqpjHC9E+lsH1ZMYz/Tcb/9o=; b=XjeYDGbAgahH0JqNVVFaXtjKYBrqavJ946wI+wOvZ92PeP1nGoKUXgxx/aHY8go44Q cDfNauIItmPOpBA9Guvn6gEpFCsNZQBN+wPVAjQen8CabQqPbeG97ehKeftOYrmG5Qfo NkwblT38rTub0D3ZncNZ3CWn8Ij4VzMwu3y0TX9siwGFYltZROXkTSZivCSTZDM+CSCf V4r8WdzP4ae5z3MrowNqSvXmVV92Y8Vj9tHtoizAKtQ9q/E5jJvUhi/KD4ZUx9cNf5fl bLOiWOGdlFYMDoMYYzuTiauTmGgmVkrLjYuh0w0FMsOsQ0bFwWdHJMHDKeSuL0Yu/sEu xRpQ== X-Gm-Message-State: ABuFfohfa2GcBCdDM5+WtxrbY2MgPeRZyvZaJEUFR/klDwiB1u40UAmM h8M6UR1jwHsHUxFbtTYSmcbR1pqE8Sg= X-Received: by 2002:a17:902:ac1:: with SMTP id 59-v6mr12949742plp.18.1538417041389; Mon, 01 Oct 2018 11:04:01 -0700 (PDT) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1612:b4fb:6752:f21f:3502]) by smtp.gmail.com with ESMTPSA id d186-v6sm24469261pfg.173.2018.10.01.11.04.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Oct 2018 11:04:00 -0700 (PDT) From: Mark Salyzyn To: linux-kernel@vger.kernel.org Cc: Kevin Brodsky , Mark Salyzyn , James Morse , Russell King , Catalin Marinas , Will Deacon , Andy Lutomirski , Dmitry Safonov , John Stultz , Mark Rutland , Laura Abbott , Kees Cook , Ard Biesheuvel , Andy Gross , Andrew Pinski , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Jeremy Linton , android-kernel@android.com, Dave Martin , "Eric W. Biederman" Subject: RESEND [PATCH 1/6] arm64: compat: Use vDSO sigreturn trampolines if available Date: Mon, 1 Oct 2018 10:58:38 -0700 Message-Id: <20181001175845.168430-19-salyzyn@android.com> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20181001175845.168430-1-salyzyn@android.com> References: <20181001175845.168430-1-salyzyn@android.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 From: Kevin Brodsky If the compat vDSO is enabled, it replaces the sigreturn page. Therefore, we use the sigreturn trampolines the vDSO provides instead. Signed-off-by: Kevin Brodsky Signed-off-by: Mark Salyzyn Tested-by: Mark Salyzyn Cc: James Morse Cc: Russell King Cc: Catalin Marinas Cc: Will Deacon Cc: Andy Lutomirski Cc: Dmitry Safonov Cc: John Stultz Cc: Mark Rutland Cc: Laura Abbott Cc: Kees Cook Cc: Ard Biesheuvel Cc: Andy Gross Cc: Andrew Pinski Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: Jeremy Linton Cc: android-kernel@android.com --- arch/arm64/include/asm/vdso.h | 3 +++ arch/arm64/kernel/signal32.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/arch/arm64/include/asm/vdso.h b/arch/arm64/include/asm/vdso.h index 839ce0031bd5..f2a952338f1e 100644 --- a/arch/arm64/include/asm/vdso.h +++ b/arch/arm64/include/asm/vdso.h @@ -28,6 +28,9 @@ #ifndef __ASSEMBLY__ #include +#ifdef CONFIG_VDSO32 +#include +#endif #define VDSO_SYMBOL(base, name) \ ({ \ diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index 6b421666b5b8..c3d9a74e3945 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,19 @@ 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_VDSO32 + void *vdso_base = current->mm->context.vdso; + void *trampoline = + (ka->sa.sa_flags & SA_SIGINFO + ? (thumb + ? VDSO_SYMBOL(vdso_base, compat_rt_sigreturn_thumb) + : VDSO_SYMBOL(vdso_base, compat_rt_sigreturn_arm)) + : (thumb + ? VDSO_SYMBOL(vdso_base, compat_sigreturn_thumb) + : VDSO_SYMBOL(vdso_base, compat_sigreturn_arm))); + + retcode = ptr_to_compat(trampoline) + thumb; +#else void *sigreturn_base = current->mm->context.vdso; unsigned int idx = thumb << 1; @@ -359,6 +373,7 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka, idx += 3; retcode = ptr_to_compat(sigreturn_base) + (idx << 2) + thumb; +#endif } regs->regs[0] = usig; -- 2.19.0.605.g01d371f741-goog