Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4038792imm; Mon, 18 Jun 2018 08:11:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK3DYf4yiBGPl6+m2HTcrMZ+t3hQqh3Vf0s4hPOZAnskEV5ZfW473v0E0P+qZO48sfUG8i0 X-Received: by 2002:a17:902:9a4b:: with SMTP id x11-v6mr14380009plv.176.1529334669639; Mon, 18 Jun 2018 08:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529334669; cv=none; d=google.com; s=arc-20160816; b=ajSm/zHqhr83PEkNfcI1E4aJUYeouhecCEKYiZLVnQ7NO8pvgMtzbsMgBhdMl2iacU qdHs0n7ahzSlP3gWZj+5LKuPCRBSIacRpsFWlzRSy7NE2jIj6FP5BjHkAnsTa2YW6L+P R/Vv83ee4zsSnmDeu9I1jiWk+P7uuKb8hZlsaXD0RhcN+B30Ek+R9RNUun5Epprzb8yi Ne46xTKSxXrC9Oes8SukeR/9k5HbDM3UEaPeua7m/bSE1vBTs2255GEFxQxWCBHwTS/+ 08RaznCoKtzSWHZHv0xFt8i/HS/B111f2UgGjaJPs68QRfl9ov6bDfKM+Mqul5j082SF ezoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=4NAG7hzXUC7y7frdcTzxZYfU3GpX9HZN0SD1UZIE0Yk=; b=NMxKFJqD+KnoZxcyEY8xIa1J1Fb6ApSxR6ah0/HQly6GQHl2ikJ6vfDXnuC8IdmrVa 9PJD5rOHgwdgvP3CAoadbOtQIFwRNLZRZUKAoeccGd7BGu6of641YVEzwzb99ERNKN3K g9v0R9WdM8SCiGBm1wNqbjQE6S/DxolJOJyiPKiK+MW0cjr1FieYGyxMvQeYWk9zgqLd VSFA55D6XpnsdoUuaZPdQMmLJ1HyaK00h2/f0F1j9IgM7ZFh0po7ahSIvbFifLPDoc57 w3/AD6qRRBQbLp69StGOfOJFkJs1eZ1/bSx2lJWK1mTnN5psT05r2aTj9QR5bUIUXlNk Uvmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=DsDlZHYA; 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 e8-v6si12582948pgu.231.2018.06.18.08.10.55; Mon, 18 Jun 2018 08:11:09 -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=DsDlZHYA; 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 S935793AbeFRPJr (ORCPT + 99 others); Mon, 18 Jun 2018 11:09:47 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34800 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935310AbeFRPJm (ORCPT ); Mon, 18 Jun 2018 11:09:42 -0400 Received: by mail-pg0-f68.google.com with SMTP id q4-v6so7674371pgr.1 for ; Mon, 18 Jun 2018 08:09:41 -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; bh=4NAG7hzXUC7y7frdcTzxZYfU3GpX9HZN0SD1UZIE0Yk=; b=DsDlZHYArPoA1Pb7vK4oDE4O7fCqck8USieAMKDXuZ19a5AiHBpRRokXov9D2cQY6z EcOZAMuCDSPekBGWcUEntS/kny7qHg6BYTWxTF/pB0k25uMktOiD1886pGFl/h/i00Ti UqnG8RvAomok/SObRLDslxGFRHmPb0hODWdpNkOVHCoK9m7XO9ZiKj2lwjTXtqB7P6Wg q9AUFOm3W6eEk1IQA1/jonD8EG+LOu9R6pHWgR/QArhPg4r568ldvIS5CfWyYYziZwBX JIF/wb/hs7e2wCyS93eLhDcns8dJyjjTHGqjCc3LxVPRXkKhwiQ7U5X0TlkSVm7UUTsr B3Jw== 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; bh=4NAG7hzXUC7y7frdcTzxZYfU3GpX9HZN0SD1UZIE0Yk=; b=QWmqGunke81lT9MdAOmAgAbNJhfy9sCwCy4MrHr4FwRf1/01L3bn+5kh7gWcBpIVgz 8GWbJnLElIvGdcteoRrjb0gmQrM5/v1BJCRPWPT/X875zq64y/QYvDg9k7AqTDRoPGcE nvBZF98QQa1r3uQBzDOxcckogL09ANszyjzL3iM/DATcKGTM/VU9FPlJIiUw/4gGw2lV mkL+TqhDfRKSFf+Qbr354rnddqqwPprsdFNaU1ygPn2PhivAi0snBRgsePZ48kbehFDk Q0Cqt1x5IkC5h2JeqZ0ZGB/Z9k+FRh+d+labQyHxkkZRXOlusPMekYXDh8cRfQJy2qWQ wxMA== X-Gm-Message-State: APt69E1A59GiV8+gJdn+bzfe37N2TinKZLCtX0pS24/d6Tv0LYJ63kEE MRYujtkSNc6IWnJ8B4+ZSSJAmDhy6tk= X-Received: by 2002:a62:484d:: with SMTP id v74-v6mr14091182pfa.256.1529334581231; Mon, 18 Jun 2018 08:09:41 -0700 (PDT) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1611:6077:8eec:bc7e:d0f4]) by smtp.gmail.com with ESMTPSA id i7-v6sm54830660pfa.34.2018.06.18.08.09.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 08:09:40 -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 , Dave Martin , "Eric W. Biederman" Subject: RESEND [PATCH 1/6] arm64: compat: Use vDSO sigreturn trampolines if available Date: Mon, 18 Jun 2018 08:06:04 -0700 Message-Id: <20180618150613.10322-19-salyzyn@android.com> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180618150613.10322-1-salyzyn@android.com> References: <20180618150613.10322-1-salyzyn@android.com> 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 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 --- 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 096c88731c56..5ee07da53fd1 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; @@ -347,6 +348,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; @@ -354,6 +368,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.18.0.rc1.244.gcf134e6275-goog