Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp355587pxx; Mon, 26 Oct 2020 10:03:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFKSZw2zEAU8whUEsmD89pB52+8V6LRuMC8dRwUlt1Fd9OoQ/66yNiIEdN5e+9ok+Gg0uO X-Received: by 2002:a17:906:5e4f:: with SMTP id b15mr16990452eju.353.1603731794865; Mon, 26 Oct 2020 10:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603731794; cv=none; d=google.com; s=arc-20160816; b=I38SvweCwZUekhjmtvyBiLsSQx1JSnqzNLMl2nn3IT2LnnxA00cLpF7rQkT0vGqfkQ fyhzp0TFKfmgqyVVMvDfY/ZcgOUVGPfv6+i9tQCM7dB3M+DhYhxN6AFoDf0FUOAnkq8l aiOJw2TGcHQIA7awMdlPSLJJ8en4ZQzDdVgbHyoFfcQHw9LN7iagmL+qHMAcQM+Xnw+q 98VkIWR5R3geWZYgRvcVnN23EcURkpjax39Y3Dk3C6/4/QUJFCbFzki2BD/KlmRSmkmo 2eKexXNNujcNwcxyn5ZpvU/ZYNsLwFFVOzOO6sivIg7KPkGTPCBxD+7Oj1P3UtRG++fC 4pEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=aWja56kiyleHUM5SBKQ0/ST78s6JhvG0FAk3yFd43Q0=; b=ungkeVOpvB5LJjzW9ivwFJde/1euyOQGAakBh/p74jaZitMoPMssGBHaIgyVml9ExV 0gu1WbVg7IkMNfQuDx1nxR8MA2qvWrVByCQ+4UgBdFkIrlDWIo1/gD9Snq3bsKKJJ4ve 2SX2vHS5lZwOQsQ6YgOrWieA2BryHgq+SLv13nzkyqn9/da6aKyd+W7BkzZnxhtB9543 3iUiC7jvs89eqjkX0MEBjJ4mNqAI0d4rT07fpgtx9Ft1t+1Qj4F4Tnd/8HvSa3c97n4m Vl3g4fiV3mOuilCv9YPxzIvfCw81rMN0PgZnwviJkjI73uRdelWkjEETHey/O832l0b5 PVDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1mHkQ6ws; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=8UdOZwM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si7789433ejp.422.2020.10.26.10.02.50; Mon, 26 Oct 2020 10:03:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1mHkQ6ws; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=8UdOZwM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1775767AbgJZMx2 (ORCPT + 99 others); Mon, 26 Oct 2020 08:53:28 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:39802 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1775644AbgJZMwh (ORCPT ); Mon, 26 Oct 2020 08:52:37 -0400 Date: Mon, 26 Oct 2020 12:52:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603716754; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aWja56kiyleHUM5SBKQ0/ST78s6JhvG0FAk3yFd43Q0=; b=1mHkQ6wsDG/VsYhtCjQXOkzh8alb4qGrZ+UE8zKM/14hbWedPwoVZdoKIc/q/hZkh+tOrw vm88HOwVIv96Zxw9tvALsCzhhQLzdyqlqtdnVKXGiiE/3D1iRjdsUdErRHwXlBHydal36V RShMuL7+b5CjgqzLJA9O/mirPWAMp+SauXMnY0+Wv/wfjodAeNgfg3q/rK+c6gC2nopbHj vibufq7gf5+htE10OZIqHvYGpQw6qFh6Z5k9IOazzbkNm5wlZf35vK8wwvQjT+zT63JrxH /e9HG50te50BAOCLOFsKcHvfqqVULCFTRCvVxhpfn17r5oV6z7YcLbxwXKHGoA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603716754; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aWja56kiyleHUM5SBKQ0/ST78s6JhvG0FAk3yFd43Q0=; b=8UdOZwM3GxM7IFbCbM8m19D5OKN9pV2+8JNBUmujVmJ9PD3CgxWmWpPgR0RySc9n1k9PwB RBJwRar7aPN0vlDA== From: "tip-bot2 for Gabriel Krisman Bertazi" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cleanups] x86/elf: Use e_machine to check for x32/ia32 in setup_additional_pages() Cc: Gabriel Krisman Bertazi , Thomas Gleixner , x86 , LKML In-Reply-To: <20201004032536.1229030-9-krisman@collabora.com> References: <20201004032536.1229030-9-krisman@collabora.com> MIME-Version: 1.0 Message-ID: <160371675357.397.304357916170024051.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/cleanups branch of tip: Commit-ID: 3316ec8ccd34e19690a12e65801d605d25155031 Gitweb: https://git.kernel.org/tip/3316ec8ccd34e19690a12e65801d605d25155031 Author: Gabriel Krisman Bertazi AuthorDate: Sat, 03 Oct 2020 23:25:34 -04:00 Committer: Thomas Gleixner CommitterDate: Mon, 26 Oct 2020 13:46:47 +01:00 x86/elf: Use e_machine to check for x32/ia32 in setup_additional_pages() Since TIF_X32 is going away, avoid using it to find the ELF type when choosing which additional pages to set up. According to SysV AMD64 ABI Draft, an AMD64 ELF object using ILP32 must have ELFCLASS32 with (E_MACHINE == EM_X86_64), so use that ELF field to differentiate a x32 object from a IA32 object when executing setup_additional_pages() in compat mode. Signed-off-by: Gabriel Krisman Bertazi Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20201004032536.1229030-9-krisman@collabora.com --- arch/x86/entry/vdso/vma.c | 4 ++-- arch/x86/include/asm/elf.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index 9185cb1..50e5d3a 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -413,10 +413,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) #ifdef CONFIG_COMPAT int compat_arch_setup_additional_pages(struct linux_binprm *bprm, - int uses_interp) + int uses_interp, bool x32) { #ifdef CONFIG_X86_X32_ABI - if (test_thread_flag(TIF_X32)) { + if (x32) { if (!vdso64_enabled) return 0; return map_vdso_randomized(&vdso_image_x32); diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h index 109697a..44a9b99 100644 --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h @@ -383,8 +383,10 @@ struct linux_binprm; extern int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp); extern int compat_arch_setup_additional_pages(struct linux_binprm *bprm, - int uses_interp); -#define compat_arch_setup_additional_pages compat_arch_setup_additional_pages + int uses_interp, bool x32); +#define COMPAT_ARCH_SETUP_ADDITIONAL_PAGES(bprm, ex, interpreter) \ + compat_arch_setup_additional_pages(bprm, interpreter, \ + (ex->e_machine == EM_X86_64)) /* Do not change the values. See get_align_mask() */ enum align_flags {