Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp361837imm; Mon, 1 Oct 2018 11:05:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV62E8Bva1ZlypqZHM5fdD6RheIfG7nZ7FuJTlI4yvWTU43kx32/KpljxHyBEPnOqnqmrLaar X-Received: by 2002:a17:902:5e3:: with SMTP id f90-v6mr12841988plf.222.1538417111392; Mon, 01 Oct 2018 11:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538417111; cv=none; d=google.com; s=arc-20160816; b=JHvr4eDfzCS2YGCegjob/s2Xn7k4HcDwTVO6OZUcNlUlAs6t79/liqKCSyrzplaguw /qL5BDTjymMIiSRcXINwMyaG9vw/jYcoqaGNh6FunDu5a8rmBXHiegxAJVbF0SkUZoCw 1QaJb26pyAJJfppFQj8TQT+PhOWwBzkkx6AVcg6xO64SRDxH7ChVoiTGZ8QcqVi/aAXX KBIhHmBTIuuNcsGiMVUzap9lp2Iv3GOMGukKfxSh+lQHxoj4OR7ipQtWUYD2vQySCF5z eOCXZQsnRja9/u4qy58DbiusPuzxnEgir/lDP7o7kzEpdAZq8zH3XHhvWV6EF4wcb57i 3ccA== 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=a082AL/4Oj65cVJFcdJAwbuKyRvNhbo+1Hg117kQxIY=; b=PxnSY9P3szJqmE5rvA3+EgxGhlxO1u3KnDaW1Tp3Ord05DhwFZ77kd1glAFLzL/Hns 3jP0ly7LB3O9UUdzTruwxAb/PaCRQIZqCfYkAcNGcc8diu691sjZlxeje7hy5YZOR7By /wx78EIrkwxMXddjEzIr8hpKa4aDlWj0Bng9o5Gx/3lH5mdb1+yzHmRinwLGkGY52NJe /g9XG0qPUbGQ0CNc3PI31EdM4VugVqmoFLUjwLiWp94RiOf7w1Crp4VqpEX/kUje0Dmj xP0FY6g1UGCS/SOZ6pErYZKuoMdzNOrER0IPQGnBPtv811RUlnSOnIDniQyJturGDsjA GqoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b="i/RbAs4i"; 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 z7-v6si12515679plk.215.2018.10.01.11.04.49; Mon, 01 Oct 2018 11:05:11 -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="i/RbAs4i"; 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 S1726835AbeJBAnF (ORCPT + 99 others); Mon, 1 Oct 2018 20:43:05 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:37168 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726138AbeJBAnE (ORCPT ); Mon, 1 Oct 2018 20:43:04 -0400 Received: by mail-pf1-f194.google.com with SMTP id j23-v6so455355pfi.4 for ; Mon, 01 Oct 2018 11:04:06 -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=a082AL/4Oj65cVJFcdJAwbuKyRvNhbo+1Hg117kQxIY=; b=i/RbAs4izAdc8l6xtU2dFlH7VxCmErKV/xX/K1VzpZVyWk9JWxuGM0W40qGHVufztV SrKvBz49Ps+yH4ERe38Tzoy+6czv+p16TEUGlR8nEHBiECbcyvWsofsPHOnxOb97DrON 1t06AWfcy08CuFXSioU1S0pmUNjdYMZeS2xYvcmTvqKJ/6c2NHVpeyls2klSVX7+CZOl tU/TquASqsX2EyTjJKi8RrgtgPT253ad79p0O9HiQkoDuylMZf1OH2bZFttVbyUTvsk3 KKXTPZ4TYv9VtYdPf9WKd5STOTJCOpTvsNhbCOAYRORYvUqdu7hdNf01VuZoYRL2YqtI SzNg== 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=a082AL/4Oj65cVJFcdJAwbuKyRvNhbo+1Hg117kQxIY=; b=WqKL9tjFL48p0aA1vSqxeBvIU62mZ52zuehhOA3Al/p+re7KbNfZLA9jfXLTj9Mnzj p8bct/Lni41SNjWqFPDM35fsdA8ZWrhifkvHBGKFUOAEWq35e+GWx0Y81SW2dZoGysSM fBXwKCt2UpcY6Cgv3JO2TAhEy7/qYp8va+eOEtyQ4eCpSSWC/kk9SgzBjeVcPqML1Hdj xhW79h2cRiSqwJLXF8smt2UZs4MlGj9KEEvknJWa6zm5pR9tiRc3epgmVcGfWY7l9mb1 p1E0+kXMIBEetBOTJsmjupVlGFWk9fMSbNNAgY6Ej37VC0n7+oiFX1Yj7fFAJFrCOUjU Aj3Q== X-Gm-Message-State: ABuFfoiPbNzbZfnxfgAjtIx6b9+L2Ptd3huLTi4l8NuS3YRw76X/CnzL pJFu9Z6khajdMvD1Wq8158T0FwVeH64= X-Received: by 2002:a63:3747:: with SMTP id g7-v6mr11311032pgn.59.1538417046158; Mon, 01 Oct 2018 11:04:06 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Oct 2018 11:04:05 -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, Ben Hutchings , Dave Martin Subject: RESEND [PATCH 2/6] arm64: elf: Set AT_SYSINFO_EHDR in compat processes Date: Mon, 1 Oct 2018 10:58:39 -0700 Message-Id: <20181001175845.168430-20-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, we need to set AT_SYSINFO_EHDR in the auxiliary vector of compat processes to the address of the vDSO code page, so that the dynamic linker can find it (just like the regular vDSO). Note that we cast context.vdso to Elf64_Off, instead of elf_addr_t, because elf_addr_t is Elf32_Off in compat_binfmt_elf.c, and casting context.vdso to u32 would trigger a pointer narrowing warning. 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/elf.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 433b9554c6a1..bf4672a0491b 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -147,10 +147,10 @@ typedef struct user_fpsimd_state elf_fpregset_t; }) /* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ -#define ARCH_DLINFO \ +#define _SET_AUX_ENT_VDSO \ do { \ NEW_AUX_ENT(AT_SYSINFO_EHDR, \ - (elf_addr_t)current->mm->context.vdso); \ + (Elf64_Off)current->mm->context.vdso); \ \ /* \ * Should always be nonzero unless there's a kernel bug. \ @@ -162,6 +162,7 @@ do { \ else \ NEW_AUX_ENT(AT_IGNORE, 0); \ } while (0) +#define ARCH_DLINFO _SET_AUX_ENT_VDSO #define ARCH_HAS_SETUP_ADDITIONAL_PAGES struct linux_binprm; @@ -209,7 +210,11 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; ({ \ set_thread_flag(TIF_32BIT); \ }) +#ifdef CONFIG_VDSO32 +#define COMPAT_ARCH_DLINFO _SET_AUX_ENT_VDSO +#else #define COMPAT_ARCH_DLINFO +#endif extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp); #define compat_arch_setup_additional_pages \ -- 2.19.0.605.g01d371f741-goog