Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4041136imm; Mon, 18 Jun 2018 08:13:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKPPrcIpStt87PHs7hWP4Abf6A+2Nqt884wQzT6TYvhLEY3thzA2vBHA5YeEFJ1y57/FAsx X-Received: by 2002:a65:6645:: with SMTP id z5-v6mr273451pgv.71.1529334790339; Mon, 18 Jun 2018 08:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529334790; cv=none; d=google.com; s=arc-20160816; b=hLozbTjH0vSUypMBafULzw6c94FwNK2q1G0WxRhjlwNCIkWq8PWzptEuohETMQrDEI /a9MrEu59eIoZAFFxDY8hMVhpa4fxjwiauQNpR4cQ3Blpt39t2/uQgM1R9GpvdptDmER BEswU8dQTZzaJr0kKfu0+W/BsoKAizm4VHmPwrx70d/v7pESMK7Mmn4o5gvK+godfFSo OkMxyCWCOGYNiU2k4EssMiMJ6K+yjfiBjrjDZX6h3gha3DnTuBQkLpgY7vvqRNKFSzne POfG8Pz8E52qzWwmfP9Q7B1PXduuR018+4/5LaBKXnTVZpxiZhlRWzaYbL0nrTuTbRut gBbg== 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=j63H2XWAfgc4+hZRNrwJ9sRmE0jBwvbE9xZcldKpKjY=; b=fCKIF+dofXc2bAd0zaNH8Sko6Ta8PCK7mEgTQmGMwHfNlbhykMOFnW/y47+jIWN+hS sAcPPVxr09Ri3KqewqGYgJ2lGaqA+Hha1c95JhZ9ZunBnlaYrDSR28IYJRUw1NUNIkoP LF9Kl5QBrq3St14gsT0FPTMIxm/WrmS08deKnQBhor6S1Ueg0yW4T75n3WApGQ022UrA 70vSMy3rNjFTBvt0tBbAtbSmmR/h0+rnUjr662KFWufmueXk8C9fOFv3R55KvRQ6N2Rp RI8waQlhQRcJRBbDG07PKtfBIz/MnRP6aQvk6Z3ZTGDyEM0OmUJqILpfX2t/Yr1ZC91h 4Bmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=ucIjn0++; 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 a29-v6si12231722pgn.423.2018.06.18.08.12.56; Mon, 18 Jun 2018 08:13:10 -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=ucIjn0++; 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 S935591AbeFRPLF (ORCPT + 99 others); Mon, 18 Jun 2018 11:11:05 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33198 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935443AbeFRPJq (ORCPT ); Mon, 18 Jun 2018 11:09:46 -0400 Received: by mail-pf0-f195.google.com with SMTP id b17-v6so8329958pfi.0 for ; Mon, 18 Jun 2018 08:09:46 -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=j63H2XWAfgc4+hZRNrwJ9sRmE0jBwvbE9xZcldKpKjY=; b=ucIjn0++CH4OhaJHuDa+OZmC0pCQ06dC+GAEZUn44AVJf0BAQ4xX5W9+Z5Nk4PPcKr 2q7g6DV+CThuuuVAcBtFP9OfiGZepMrfMRVDTOwx1l8QVNjks6Oji4VNlPrLN+HabGtT JQJFdigpH8CG9JkDKHG2mLbd270KF6mqtnUh7PBly1jE75WxxUVO6qZe6ab9SyqrQUzY Vww9J0R+IsauWXMT5rzL7WInwAF4nq6q3RU5eUxE8bjORlF6FrkJTNxzIM5LiJnjIeDY ik/BoYzZfOzmDGk8PMYuV7TMXtOBM3nMhpS9Xqv0owxr3OfObVbAyfpeibPeOp6W/NKM epFQ== 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=j63H2XWAfgc4+hZRNrwJ9sRmE0jBwvbE9xZcldKpKjY=; b=o5DX6BNp0F/5+jmYG+SojmqRBfZ7P188txlIgEDBlhgRCrk4DfICKv6AqP+QXE+el7 +9RMV6b02RInmAGRvSf9cKRLSIwCIVHK2alghCLaJJfiIMD3KlM/1FDzt5T7XwZL3nCk NKLON/tMIfergpjGPMdmMK3csa1/yW+9oRLySAqLMnzbxN8QI6mYRGfB0F9tcK7O/hFN MUGYyYYADLfNChM+SDg5jtGUQWlBOqDIpaEKajsgaMyaPmTBmJdmkGpS0upXR8hBRxGK fx84wSx8H8lyphcbfc/TxdTnw3PwJUqbPuZeurmswzJ89nYzZzy9ygu9Mh3OAetMOxVY BuCA== X-Gm-Message-State: APt69E1ySdT8m2UmjSdgwHaWoDQP3zmnNPdSX4A5mfZR0JDn5VX/2X5p x5V8bwLG3GbHa2EZqnHr3+N5Sj3+ick= X-Received: by 2002:a63:a05d:: with SMTP id u29-v6mr11230935pgn.80.1529334585815; Mon, 18 Jun 2018 08:09:45 -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.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 08:09:45 -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 , Andrew Morton , Yury Norov , Dave Martin , Ben Hutchings Subject: RESEND [PATCH 2/6] arm64: elf: Set AT_SYSINFO_EHDR in compat processes Date: Mon, 18 Jun 2018 08:06:05 -0700 Message-Id: <20180618150613.10322-20-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, 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 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/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.18.0.rc1.244.gcf134e6275-goog