From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B273FE7719A for ; Sat, 11 Jan 2025 15:28:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C8B386B0083; Sat, 11 Jan 2025 10:28:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C3B686B0085; Sat, 11 Jan 2025 10:28:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B01F46B0088; Sat, 11 Jan 2025 10:28:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8DEE46B0083 for ; Sat, 11 Jan 2025 10:28:34 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 334E21C8428 for ; Sat, 11 Jan 2025 15:28:34 +0000 (UTC) X-FDA: 82995552948.09.12C9F42 Received: from minute.unseen.parts (minute.unseen.parts [139.162.151.61]) by imf06.hostedemail.com (Postfix) with ESMTP id 2F1FA180006 for ; Sat, 11 Jan 2025 15:28:31 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=unseen.parts header.s=sig header.b=kdbW+UTT; dmarc=none; spf=pass (imf06.hostedemail.com: domain of ink@unseen.parts designates 139.162.151.61 as permitted sender) smtp.mailfrom=ink@unseen.parts ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736609312; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zOrDauVS+hbkVPh0+UTcX6Mhkdkb3swMAa9sOE8DgIs=; b=fXZPu9ZIcZkkcBeJ56v19Jkol0trvFKXIqcv9oYVrCDhXT7hhTXa9An+BogUTlzqPd0qUj shNIcDi5qv5zeWvk3i6lDzSuPqnXGrGUx1lOLz5LtdSoxNMekT8OuRwkNx26eVbpmt8AMI iA3k4CmlcSPx5+f8zAKeYE087vHsnTw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736609312; a=rsa-sha256; cv=none; b=CJFECeRg6uAQ+zV/NCOQcxvwek77nlswk7iKIXoUTD/dJokLiXQj5qtb4QxEAGTMsH4jyT BN6dVXRoezoUeOGcasfz9hc1nvC8Jl6g6GnUJYEXbQhOJCp5+evLYDU6w9+iH9o0gsOPEL 6/ir300VMWje7LESVG2Rtq/DUTIuhas= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=unseen.parts header.s=sig header.b=kdbW+UTT; dmarc=none; spf=pass (imf06.hostedemail.com: domain of ink@unseen.parts designates 139.162.151.61 as permitted sender) smtp.mailfrom=ink@unseen.parts DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=unseen.parts; s=sig; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=zOrDauVS+hbkVPh0+UTcX6Mhkdkb3swMAa9sOE8DgIs=; b=kdbW+UTTT7P8L00nGt1qaCNFY8 az4qaKFEx3Qpp3Hr6WnNRVNsTHT4pYehH8H/hrZRuG6C0TiMKznaTJn4bAEiZh2VKKD4haNnZQdbD hIUVzd38wXVerjNkcIMHXJpU+Ne9XSxq600sMfZEzYTyCIcIN1KG1ioBpMWhZ2GASgDdBQ5sp/l8Z OIC/DY9tGSF2RXgQ3Ce6f2fQ8/5VCSftnhEPqW1U/1hnIhWpH7/QuZrZ0kkYCtQLrkC7OL79tJNQr aO2afQ/a5KbXpRiTfJZH91e4LQ9plXaiRR3gtuy1kFPbsCNl648UG9r6F3ky8mVBhRzHeXhCUFZ0V BnIKPKhQ==; Received: from minute.unseen.parts ([139.162.151.61]:35754 helo=minute) by minute.unseen.parts with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1tWdP6-0005Em-1T; Sat, 11 Jan 2025 16:28:00 +0100 Date: Sat, 11 Jan 2025 16:27:57 +0100 From: Ivan Kokshaysky To: "Eric W. Biederman" Cc: John Paul Adrian Glaubitz , Arnd Bergmann , Richard Henderson , Matt Turner , Kees Cook , "Paul E. McKenney" , linux-alpha@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michael Cree , Sam James , "Maciej W. Rozycki" , Geert Uytterhoeven , Michael Karcher , Chris Hofstaedtler , util-linux@vger.kernel.org, linux-mips@vger.kernel.org, loongarch@lists.linux.dev Subject: Re: [PATCH] alpha/elf: Fix misc/setarch test of util-linux by removing 32bit support Message-ID: References: <20250103140148.370368-1-glaubitz@physik.fu-berlin.de> <24f03227-1b55-4e50-b6e9-7ac74fda2602@app.fastmail.com> <678ee681-12c3-4e79-a04b-495daf343846@app.fastmail.com> <82d33a2d-dffe-4268-a175-4536b3f9c07f@app.fastmail.com> <87jzb2tdb7.fsf_-_@email.froward.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87jzb2tdb7.fsf_-_@email.froward.int.ebiederm.org> X-Stat-Signature: o164rcrnwsytcyqg3stfazpf6wbztwrb X-Rspamd-Queue-Id: 2F1FA180006 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1736609311-429028 X-HE-Meta: U2FsdGVkX18p0y0KyPrBM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eDUR8PIdTBDtv9f7vilmi8sN0MECQWtOzw4kSbFppilJJdjVTnaEfoUDH6NjmXBE8TjwcTeUR1E4yVMMB40bPFycHR+pmktvZmUT+G5vsCEv+pLp1azE/XpdPWEmCz3iF9cGDAfRocMeNbW18vu9i6JpwZEH/5kS/3mS63hpkBhAWL5Hi65klFe9zwI4sMWVl6Lv/AdqxvpH3LdwUdwc7CLttLyFq2YZJ+7T+miAx8Zou1Ne7sH+yNlo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, Jan 10, 2025 at 06:16:28PM -0600, Eric W. Biederman wrote: > > Richard Henderson writes[1]: > > > There was a Spec benchmark (I forget which) which was memory bound and ran > > twice as fast with 32-bit pointers. > > > > I copied the idea from DEC to the ELF abi, but never did all the other work > > to allow the toolchain to take advantage. > > > > Amusingly, a later Spec changed the benchmark data sets to not fit into a > > 32-bit address space, specifically because of this. > > > > I expect one could delete the ELF bit and personality and no one would > > notice. Not even the 10 remaining Alpha users. > > In [2] it was pointed out that parts of setarch weren't working > properly on alpha because it has it's own SET_PERSONALITY > implementation. In the discussion that followed Richard Henderson > pointed out that the 32bit pointer support for alpha was never > completed. > > Fix this by removing alpha's 32bit pointer support. > > As a bit of paranoia refuse to execute any alpha binaries that hafe > the EF_ALPHA_32BIT flag set. Just to fail explicitly in case someone > somewhere has binaries that trying to use alpha's 32bit pointer > support. In general I agree, but then someone ought to remove the "--taso" option from GNU ld, which produces such binaries. Ivan. > [1] https://lkml.kernel.org/r/CAFXwXrkgu=4Qn-v1PjnOR4SG0oUb9LSa0g6QXpBq4ttm52pJOQ@mail.gmail.com > [2] https://lkml.kernel.org/r/20250103140148.370368-1-glaubitz@physik.fu-berlin.de > Signed-off-by: "Eric W. Biederman" > --- > arch/alpha/include/asm/elf.h | 6 +----- > arch/alpha/include/asm/pgtable.h | 2 +- > arch/alpha/include/asm/processor.h | 8 ++------ > arch/alpha/kernel/osf_sys.c | 11 ++--------- > 4 files changed, 6 insertions(+), 21 deletions(-) > > diff --git a/arch/alpha/include/asm/elf.h b/arch/alpha/include/asm/elf.h > index 4d7c46f50382..50c82187e60e 100644 > --- a/arch/alpha/include/asm/elf.h > +++ b/arch/alpha/include/asm/elf.h > @@ -74,7 +74,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; > /* > * This is used to ensure we don't load something for the wrong architecture. > */ > -#define elf_check_arch(x) ((x)->e_machine == EM_ALPHA) > +#define elf_check_arch(x) (((x)->e_machine == EM_ALPHA) && !((x)->e_flags & EF_ALPHA_32BIT)) > > /* > * These are used to set parameters in the core dumps. > @@ -137,10 +137,6 @@ extern int dump_elf_task(elf_greg_t *dest, struct task_struct *task); > : amask (AMASK_CIX) ? "ev6" : "ev67"); \ > }) > > -#define SET_PERSONALITY(EX) \ > - set_personality(((EX).e_flags & EF_ALPHA_32BIT) \ > - ? PER_LINUX_32BIT : PER_LINUX) > - > extern int alpha_l1i_cacheshape; > extern int alpha_l1d_cacheshape; > extern int alpha_l2_cacheshape; > diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h > index 635f0a5f5bbd..02e8817a8921 100644 > --- a/arch/alpha/include/asm/pgtable.h > +++ b/arch/alpha/include/asm/pgtable.h > @@ -360,7 +360,7 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte) > > extern void paging_init(void); > > -/* We have our own get_unmapped_area to cope with ADDR_LIMIT_32BIT. */ > +/* We have our own get_unmapped_area */ > #define HAVE_ARCH_UNMAPPED_AREA > > #endif /* _ALPHA_PGTABLE_H */ > diff --git a/arch/alpha/include/asm/processor.h b/arch/alpha/include/asm/processor.h > index 55bb1c09fd39..5dce5518a211 100644 > --- a/arch/alpha/include/asm/processor.h > +++ b/arch/alpha/include/asm/processor.h > @@ -8,23 +8,19 @@ > #ifndef __ASM_ALPHA_PROCESSOR_H > #define __ASM_ALPHA_PROCESSOR_H > > -#include /* for ADDR_LIMIT_32BIT */ > - > /* > * We have a 42-bit user address space: 4TB user VM... > */ > #define TASK_SIZE (0x40000000000UL) > > -#define STACK_TOP \ > - (current->personality & ADDR_LIMIT_32BIT ? 0x80000000 : 0x00120000000UL) > +#define STACK_TOP (0x00120000000UL) > > #define STACK_TOP_MAX 0x00120000000UL > > /* This decides where the kernel will search for a free chunk of vm > * space during mmap's. > */ > -#define TASK_UNMAPPED_BASE \ > - ((current->personality & ADDR_LIMIT_32BIT) ? 0x40000000 : TASK_SIZE / 2) > +#define TASK_UNMAPPED_BASE (TASK_SIZE / 2) > > /* This is dead. Everything has been moved to thread_info. */ > struct thread_struct { }; > diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c > index 86185021f75a..a08e8edef1a4 100644 > --- a/arch/alpha/kernel/osf_sys.c > +++ b/arch/alpha/kernel/osf_sys.c > @@ -1210,8 +1210,7 @@ SYSCALL_DEFINE1(old_adjtimex, struct timex32 __user *, txc_p) > return ret; > } > > -/* Get an address range which is currently unmapped. Similar to the > - generic version except that we know how to honor ADDR_LIMIT_32BIT. */ > +/* Get an address range which is currently unmapped. */ > > static unsigned long > arch_get_unmapped_area_1(unsigned long addr, unsigned long len, > @@ -1230,13 +1229,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, > unsigned long len, unsigned long pgoff, > unsigned long flags, vm_flags_t vm_flags) > { > - unsigned long limit; > - > - /* "32 bit" actually means 31 bit, since pointers sign extend. */ > - if (current->personality & ADDR_LIMIT_32BIT) > - limit = 0x80000000; > - else > - limit = TASK_SIZE; > + unsigned long limit = TASK_SIZE; > > if (len > limit) > return -ENOMEM; > -- > 2.41.0 > >