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 X-Spam-Level: X-Spam-Status: No, score=-22.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06861C433E6 for ; Sun, 28 Feb 2021 06:54:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5A6B64E55 for ; Sun, 28 Feb 2021 06:54:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230401AbhB1Gxv (ORCPT ); Sun, 28 Feb 2021 01:53:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:53308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbhB1Gxn (ORCPT ); Sun, 28 Feb 2021 01:53:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 02FF064E09; Sun, 28 Feb 2021 06:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614495182; bh=1rorF2txUowcwRru9bDVATKhWuoedaZfSgA7FMdIVEs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BrBVUuc/ve3BczQCJ2GJN3I5TAcPvuUewrAkTPUhxYaDVQqmvERnPfYCNJWAMTSyT 1DsMiAAEgK0TlHcgFQU7GbyEJzRrZZovNrMCEpZFNYob5FASRsJY9fND4qchKh5hgJ f8pYdN7+5Yw1qWhrGWKw4ju7nFSTL5tB20R1q7fM1P+dfuz+aVthcSJ0ks/4LQ6u6v JmqppISwkpc4ACb7j66S7WoSDYHUiHGusKsL4V761x9klUOj22gRYAdloDVDkcKYUC 8I2xBWwe/0mNW27fLGq1yJOA0ziLtCBeUE5bdGpY+R9TYuRm543+WclRrlCUhoPg6A wazh/CQIflbNw== Date: Sat, 27 Feb 2021 23:52:54 -0700 From: Nathan Chancellor To: Masahiro Yamada Cc: X86 ML , Thomas Gleixner , Borislav Petkov , "H . Peter Anvin" , Peter Zijlstra , Fangrui Song , clang-built-linux , "H . J . Lu" , Andy Lutomirski , Arnd Bergmann , Brian Gerst , "Chang S. Bae" , Chao Yu , "Darrick J. Wong" , Dmitry Safonov <0x7f454c46@gmail.com>, Dominik Brodowski , Gabriel Krisman Bertazi , Ingo Molnar , Jaroslav Kysela , Jason Gunthorpe , Jethro Beekman , Kees Cook , Miklos Szeredi , Nick Desaulniers , Sasha Levin , Sean Christopherson , Takashi Iwai , ALSA Development Mailing List , Linux FS-devel Mailing List , Linux Kernel Mailing List , linux-xfs Subject: Re: [PATCH RFC] x86: remove toolchain check for X32 ABI capability Message-ID: <20210228065254.GA30798@24bbad8f3778> References: <20210227183910.221873-1-masahiroy@kernel.org> <20210228064936.zixrhxlthyy6fmid@24bbad8f3778> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210228064936.zixrhxlthyy6fmid@24bbad8f3778> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 27, 2021 at 11:49:36PM -0700, Nathan Chancellor wrote: > On Sun, Feb 28, 2021 at 12:15:16PM +0900, Masahiro Yamada wrote: > > On Sun, Feb 28, 2021 at 3:41 AM Masahiro Yamada wrote: > > > > > > This commit reverts 0bf6276392e9 ("x32: Warn and disable rather than > > > error if binutils too old"). > > > > > > The help text in arch/x86/Kconfig says enabling the X32 ABI support > > > needs binutils 2.22 or later. This is met because the minimal binutils > > > version is 2.23 according to Documentation/process/changes.rst. > > > > > > I would not say I am not familiar with toolchain configuration, but > > > > I mean: > > I would not say I am familiar ... > > That is why I added RFC. > > > > I appreciate comments from people who are familiar > > with toolchains (binutils, llvm). > > > > If this change is not safe, > > we can move this check to Kconfig at least. > > Hi Masahiro, > > As Fangrui pointed out, there are two outstanding issues with x32 with > LLVM=1, both seemingly related to LLVM=1. ^ llvm-objcopy Sigh, note to self, don't write emails while tired... Cheers, Nathan > > https://github.com/ClangBuiltLinux/linux/issues/514 > https://github.com/ClangBuiltLinux/linux/issues/1141 > > Additionally, there appears to be one from Arnd as well but that one has > received no triage yet. > > https://github.com/ClangBuiltLinux/linux/issues/1205 > > I intend to test this patch as well as a few others at some point in the > coming week although I am having to play sysadmin due to moving servers > so I might not be able to get to it until later in the week. > > Cheers, > Nathan > > > > I checked the configure.tgt code in binutils. The elf32_x86_64 > > > emulation mode seems to be included when it is configured for the > > > x86_64-*-linux-* target. > > > > > > I also tried lld and llvm-objcopy, and succeeded in building x32 VDSO. > > > > > > I removed the compile-time check in arch/x86/Makefile, in the hope of > > > elf32_x86_64 being always supported. > > > > > > With this, CONFIG_X86_X32 and CONFIG_X86_X32_ABI will be equivalent. > > > Rename the former to the latter. > > > > > > Signed-off-by: Masahiro Yamada > > > --- > > > > > > arch/x86/Kconfig | 8 ++------ > > > arch/x86/Makefile | 16 ---------------- > > > arch/x86/include/asm/syscall_wrapper.h | 6 +++--- > > > arch/x86/include/asm/vdso.h | 2 +- > > > arch/x86/kernel/process_64.c | 2 +- > > > fs/fuse/file.c | 2 +- > > > fs/xfs/xfs_ioctl32.c | 2 +- > > > sound/core/control_compat.c | 16 ++++++++-------- > > > sound/core/pcm_compat.c | 20 ++++++++++---------- > > > 9 files changed, 27 insertions(+), 47 deletions(-) > > > > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > > index 2792879d398e..7272cba2744c 100644 > > > --- a/arch/x86/Kconfig > > > +++ b/arch/x86/Kconfig > > > @@ -2865,7 +2865,7 @@ config IA32_AOUT > > > help > > > Support old a.out binaries in the 32bit emulation. > > > > > > -config X86_X32 > > > +config X86_X32_ABI > > > bool "x32 ABI for 64-bit mode" > > > depends on X86_64 > > > help > > > @@ -2874,10 +2874,6 @@ config X86_X32 > > > full 64-bit register file and wide data path while leaving > > > pointers at 32 bits for smaller memory footprint. > > > > > > - You will need a recent binutils (2.22 or later) with > > > - elf32_x86_64 support enabled to compile a kernel with this > > > - option set. > > > - > > > config COMPAT_32 > > > def_bool y > > > depends on IA32_EMULATION || X86_32 > > > @@ -2886,7 +2882,7 @@ config COMPAT_32 > > > > > > config COMPAT > > > def_bool y > > > - depends on IA32_EMULATION || X86_X32 > > > + depends on IA32_EMULATION || X86_X32_ABI > > > > > > if COMPAT > > > config COMPAT_FOR_U64_ALIGNMENT > > > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > > > index 2d6d5a28c3bf..e163549f5be7 100644 > > > --- a/arch/x86/Makefile > > > +++ b/arch/x86/Makefile > > > @@ -125,22 +125,6 @@ else > > > KBUILD_CFLAGS += -mcmodel=kernel > > > endif > > > > > > -ifdef CONFIG_X86_X32 > > > - x32_ld_ok := $(call try-run,\ > > > - /bin/echo -e '1: .quad 1b' | \ > > > - $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \ > > > - $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \ > > > - $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n) > > > - ifeq ($(x32_ld_ok),y) > > > - CONFIG_X86_X32_ABI := y > > > - KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI > > > - KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI > > > - else > > > - $(warning CONFIG_X86_X32 enabled but no binutils support) > > > - endif > > > -endif > > > -export CONFIG_X86_X32_ABI > > > - > > > # > > > # If the function graph tracer is used with mcount instead of fentry, > > > # '-maccumulate-outgoing-args' is needed to prevent a GCC bug > > > diff --git a/arch/x86/include/asm/syscall_wrapper.h b/arch/x86/include/asm/syscall_wrapper.h > > > index a84333adeef2..69bf87c41a0b 100644 > > > --- a/arch/x86/include/asm/syscall_wrapper.h > > > +++ b/arch/x86/include/asm/syscall_wrapper.h > > > @@ -158,7 +158,7 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs); > > > #endif /* CONFIG_IA32_EMULATION */ > > > > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > /* > > > * For the x32 ABI, we need to create a stub for compat_sys_*() which is aware > > > * of the x86-64-style parameter ordering of x32 syscalls. The syscalls common > > > @@ -176,12 +176,12 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs); > > > > > > #define __X32_COMPAT_SYS_NI(name) \ > > > __SYS_NI(x32, compat_sys_##name) > > > -#else /* CONFIG_X86_X32 */ > > > +#else /* CONFIG_X86_X32_ABI */ > > > #define __X32_COMPAT_SYS_STUB0(name) > > > #define __X32_COMPAT_SYS_STUBx(x, name, ...) > > > #define __X32_COMPAT_COND_SYSCALL(name) > > > #define __X32_COMPAT_SYS_NI(name) > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > > > > > > > #ifdef CONFIG_COMPAT > > > diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h > > > index 98aa103eb4ab..2963a2f5dbc4 100644 > > > --- a/arch/x86/include/asm/vdso.h > > > +++ b/arch/x86/include/asm/vdso.h > > > @@ -37,7 +37,7 @@ struct vdso_image { > > > extern const struct vdso_image vdso_image_64; > > > #endif > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > extern const struct vdso_image vdso_image_x32; > > > #endif > > > > > > diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c > > > index d08307df69ad..a93b6f4296fc 100644 > > > --- a/arch/x86/kernel/process_64.c > > > +++ b/arch/x86/kernel/process_64.c > > > @@ -656,7 +656,7 @@ void set_personality_64bit(void) > > > > > > static void __set_personality_x32(void) > > > { > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > if (current->mm) > > > current->mm->context.flags = 0; > > > > > > diff --git a/fs/fuse/file.c b/fs/fuse/file.c > > > index 8cccecb55fb8..c53c620d1a7a 100644 > > > --- a/fs/fuse/file.c > > > +++ b/fs/fuse/file.c > > > @@ -2797,7 +2797,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, > > > #else > > > if (flags & FUSE_IOCTL_COMPAT) { > > > inarg.flags |= FUSE_IOCTL_32BIT; > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > if (in_x32_syscall()) > > > inarg.flags |= FUSE_IOCTL_COMPAT_X32; > > > #endif > > > diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c > > > index 33c09ec8e6c0..e8038bc966e7 100644 > > > --- a/fs/xfs/xfs_ioctl32.c > > > +++ b/fs/xfs/xfs_ioctl32.c > > > @@ -233,7 +233,7 @@ xfs_compat_ioc_fsbulkstat( > > > inumbers_fmt_pf inumbers_func = xfs_fsinumbers_fmt_compat; > > > bulkstat_one_fmt_pf bs_one_func = xfs_fsbulkstat_one_fmt_compat; > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > if (in_x32_syscall()) { > > > /* > > > * ... but on x32 the input xfs_fsop_bulkreq has pointers > > > diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c > > > index 1d708aab9c98..5d1b94bda2cd 100644 > > > --- a/sound/core/control_compat.c > > > +++ b/sound/core/control_compat.c > > > @@ -153,7 +153,7 @@ struct snd_ctl_elem_value32 { > > > unsigned char reserved[128]; > > > }; > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > /* x32 has a different alignment for 64bit values from ia32 */ > > > struct snd_ctl_elem_value_x32 { > > > struct snd_ctl_elem_id id; > > > @@ -165,7 +165,7 @@ struct snd_ctl_elem_value_x32 { > > > } value; > > > unsigned char reserved[128]; > > > }; > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > > > > /* get the value type and count of the control */ > > > static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id, > > > @@ -350,7 +350,7 @@ static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file, > > > return ctl_elem_write_user(file, data32, &data32->value); > > > } > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > static int snd_ctl_elem_read_user_x32(struct snd_card *card, > > > struct snd_ctl_elem_value_x32 __user *data32) > > > { > > > @@ -362,7 +362,7 @@ static int snd_ctl_elem_write_user_x32(struct snd_ctl_file *file, > > > { > > > return ctl_elem_write_user(file, data32, &data32->value); > > > } > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > > > > /* add or replace a user control */ > > > static int snd_ctl_elem_add_compat(struct snd_ctl_file *file, > > > @@ -421,10 +421,10 @@ enum { > > > SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct snd_ctl_elem_value32), > > > SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct snd_ctl_elem_info32), > > > SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct snd_ctl_elem_info32), > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > SNDRV_CTL_IOCTL_ELEM_READ_X32 = _IOWR('U', 0x12, struct snd_ctl_elem_value_x32), > > > SNDRV_CTL_IOCTL_ELEM_WRITE_X32 = _IOWR('U', 0x13, struct snd_ctl_elem_value_x32), > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > }; > > > > > > static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) > > > @@ -463,12 +463,12 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, uns > > > return snd_ctl_elem_add_compat(ctl, argp, 0); > > > case SNDRV_CTL_IOCTL_ELEM_REPLACE32: > > > return snd_ctl_elem_add_compat(ctl, argp, 1); > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > case SNDRV_CTL_IOCTL_ELEM_READ_X32: > > > return snd_ctl_elem_read_user_x32(ctl->card, argp); > > > case SNDRV_CTL_IOCTL_ELEM_WRITE_X32: > > > return snd_ctl_elem_write_user_x32(ctl, argp); > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > } > > > > > > down_read(&snd_ioctl_rwsem); > > > diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c > > > index 590a46a9e78d..937f5117a81f 100644 > > > --- a/sound/core/pcm_compat.c > > > +++ b/sound/core/pcm_compat.c > > > @@ -147,13 +147,13 @@ static int snd_pcm_ioctl_channel_info_compat(struct snd_pcm_substream *substream > > > return err; > > > } > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > /* X32 ABI has the same struct as x86-64 for snd_pcm_channel_info */ > > > static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream, > > > struct snd_pcm_channel_info __user *src); > > > #define snd_pcm_ioctl_channel_info_x32(s, p) \ > > > snd_pcm_channel_info_user(s, p) > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > > > > struct compat_snd_pcm_status64 { > > > snd_pcm_state_t state; > > > @@ -373,7 +373,7 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream, > > > return err; > > > } > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > /* X32 ABI has 64bit timespec and 64bit alignment */ > > > struct snd_pcm_mmap_status_x32 { > > > snd_pcm_state_t state; > > > @@ -464,7 +464,7 @@ static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream, > > > > > > return 0; > > > } > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > > > > /* > > > */ > > > @@ -484,10 +484,10 @@ enum { > > > SNDRV_PCM_IOCTL_READN_FRAMES32 = _IOR('A', 0x53, struct snd_xfern32), > > > SNDRV_PCM_IOCTL_STATUS_COMPAT64 = _IOR('A', 0x20, struct compat_snd_pcm_status64), > > > SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64 = _IOWR('A', 0x24, struct compat_snd_pcm_status64), > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > SNDRV_PCM_IOCTL_CHANNEL_INFO_X32 = _IOR('A', 0x32, struct snd_pcm_channel_info), > > > SNDRV_PCM_IOCTL_SYNC_PTR_X32 = _IOWR('A', 0x23, struct snd_pcm_sync_ptr_x32), > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > }; > > > > > > static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) > > > @@ -531,10 +531,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l > > > case __SNDRV_PCM_IOCTL_SYNC_PTR32: > > > return snd_pcm_common_ioctl(file, substream, cmd, argp); > > > case __SNDRV_PCM_IOCTL_SYNC_PTR64: > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > if (in_x32_syscall()) > > > return snd_pcm_ioctl_sync_ptr_x32(substream, argp); > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > return snd_pcm_common_ioctl(file, substream, cmd, argp); > > > case SNDRV_PCM_IOCTL_HW_REFINE32: > > > return snd_pcm_ioctl_hw_params_compat(substream, 1, argp); > > > @@ -566,10 +566,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l > > > return snd_pcm_status_user_compat64(substream, argp, false); > > > case SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64: > > > return snd_pcm_status_user_compat64(substream, argp, true); > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > case SNDRV_PCM_IOCTL_CHANNEL_INFO_X32: > > > return snd_pcm_ioctl_channel_info_x32(substream, argp); > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > } > > > > > > return -ENOIOCTLCMD; > > > -- > > > 2.27.0 > > > > > > -- > > > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > > > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > > > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210227183910.221873-1-masahiroy%40kernel.org. > > > > > > > > -- > > Best Regards > > Masahiro Yamada 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 X-Spam-Level: X-Spam-Status: No, score=-20.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9ED18C433E0 for ; Mon, 1 Mar 2021 13:48:56 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A8D7B64DBA for ; Mon, 1 Mar 2021 13:48:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A8D7B64DBA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1EA7916BD; Mon, 1 Mar 2021 14:48:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1EA7916BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1614606534; bh=1rorF2txUowcwRru9bDVATKhWuoedaZfSgA7FMdIVEs=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=M8YkaQqePF2qQ8UB/QyYFOUy9Lc2G66IMiAwT1bn67FiogeoJhUncOd+lq4BE0NiC nFSQ4SmtTEmltWL/xpbX1AjYrz8AziOu6PQBDb3jaYCzyFG7fUVY7ejoHILn4XEy8W gsWfHoBM3TxtlbRHkiN5G88EC/VLMClCleP2Ihx4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 617CCF8053B; Mon, 1 Mar 2021 14:43:51 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B499EF8025B; Sun, 28 Feb 2021 07:53:10 +0100 (CET) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E9C41F8010A for ; Sun, 28 Feb 2021 07:53:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E9C41F8010A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BrBVUuc/" Received: by mail.kernel.org (Postfix) with ESMTPSA id 02FF064E09; Sun, 28 Feb 2021 06:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614495182; bh=1rorF2txUowcwRru9bDVATKhWuoedaZfSgA7FMdIVEs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BrBVUuc/ve3BczQCJ2GJN3I5TAcPvuUewrAkTPUhxYaDVQqmvERnPfYCNJWAMTSyT 1DsMiAAEgK0TlHcgFQU7GbyEJzRrZZovNrMCEpZFNYob5FASRsJY9fND4qchKh5hgJ f8pYdN7+5Yw1qWhrGWKw4ju7nFSTL5tB20R1q7fM1P+dfuz+aVthcSJ0ks/4LQ6u6v JmqppISwkpc4ACb7j66S7WoSDYHUiHGusKsL4V761x9klUOj22gRYAdloDVDkcKYUC 8I2xBWwe/0mNW27fLGq1yJOA0ziLtCBeUE5bdGpY+R9TYuRm543+WclRrlCUhoPg6A wazh/CQIflbNw== Date: Sat, 27 Feb 2021 23:52:54 -0700 From: Nathan Chancellor To: Masahiro Yamada Subject: Re: [PATCH RFC] x86: remove toolchain check for X32 ABI capability Message-ID: <20210228065254.GA30798@24bbad8f3778> References: <20210227183910.221873-1-masahiroy@kernel.org> <20210228064936.zixrhxlthyy6fmid@24bbad8f3778> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210228064936.zixrhxlthyy6fmid@24bbad8f3778> User-Agent: Mutt/1.10.1 (2018-07-13) X-Mailman-Approved-At: Mon, 01 Mar 2021 14:43:22 +0100 Cc: ALSA Development Mailing List , Peter Zijlstra , "Darrick J. Wong" , Dmitry Safonov <0x7f454c46@gmail.com>, Dominik Brodowski , "H . Peter Anvin" , Gabriel Krisman Bertazi , Sasha Levin , Fangrui Song , clang-built-linux , X86 ML , Jethro Beekman , Jason Gunthorpe , Ingo Molnar , "H . J . Lu" , Kees Cook , Arnd Bergmann , Brian Gerst , "Chang S. Bae" , Chao Yu , Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Sean Christopherson , Miklos Szeredi , Nick Desaulniers , Takashi Iwai , Linux Kernel Mailing List , linux-xfs , Linux FS-devel Mailing List X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Sat, Feb 27, 2021 at 11:49:36PM -0700, Nathan Chancellor wrote: > On Sun, Feb 28, 2021 at 12:15:16PM +0900, Masahiro Yamada wrote: > > On Sun, Feb 28, 2021 at 3:41 AM Masahiro Yamada wrote: > > > > > > This commit reverts 0bf6276392e9 ("x32: Warn and disable rather than > > > error if binutils too old"). > > > > > > The help text in arch/x86/Kconfig says enabling the X32 ABI support > > > needs binutils 2.22 or later. This is met because the minimal binutils > > > version is 2.23 according to Documentation/process/changes.rst. > > > > > > I would not say I am not familiar with toolchain configuration, but > > > > I mean: > > I would not say I am familiar ... > > That is why I added RFC. > > > > I appreciate comments from people who are familiar > > with toolchains (binutils, llvm). > > > > If this change is not safe, > > we can move this check to Kconfig at least. > > Hi Masahiro, > > As Fangrui pointed out, there are two outstanding issues with x32 with > LLVM=1, both seemingly related to LLVM=1. ^ llvm-objcopy Sigh, note to self, don't write emails while tired... Cheers, Nathan > > https://github.com/ClangBuiltLinux/linux/issues/514 > https://github.com/ClangBuiltLinux/linux/issues/1141 > > Additionally, there appears to be one from Arnd as well but that one has > received no triage yet. > > https://github.com/ClangBuiltLinux/linux/issues/1205 > > I intend to test this patch as well as a few others at some point in the > coming week although I am having to play sysadmin due to moving servers > so I might not be able to get to it until later in the week. > > Cheers, > Nathan > > > > I checked the configure.tgt code in binutils. The elf32_x86_64 > > > emulation mode seems to be included when it is configured for the > > > x86_64-*-linux-* target. > > > > > > I also tried lld and llvm-objcopy, and succeeded in building x32 VDSO. > > > > > > I removed the compile-time check in arch/x86/Makefile, in the hope of > > > elf32_x86_64 being always supported. > > > > > > With this, CONFIG_X86_X32 and CONFIG_X86_X32_ABI will be equivalent. > > > Rename the former to the latter. > > > > > > Signed-off-by: Masahiro Yamada > > > --- > > > > > > arch/x86/Kconfig | 8 ++------ > > > arch/x86/Makefile | 16 ---------------- > > > arch/x86/include/asm/syscall_wrapper.h | 6 +++--- > > > arch/x86/include/asm/vdso.h | 2 +- > > > arch/x86/kernel/process_64.c | 2 +- > > > fs/fuse/file.c | 2 +- > > > fs/xfs/xfs_ioctl32.c | 2 +- > > > sound/core/control_compat.c | 16 ++++++++-------- > > > sound/core/pcm_compat.c | 20 ++++++++++---------- > > > 9 files changed, 27 insertions(+), 47 deletions(-) > > > > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > > index 2792879d398e..7272cba2744c 100644 > > > --- a/arch/x86/Kconfig > > > +++ b/arch/x86/Kconfig > > > @@ -2865,7 +2865,7 @@ config IA32_AOUT > > > help > > > Support old a.out binaries in the 32bit emulation. > > > > > > -config X86_X32 > > > +config X86_X32_ABI > > > bool "x32 ABI for 64-bit mode" > > > depends on X86_64 > > > help > > > @@ -2874,10 +2874,6 @@ config X86_X32 > > > full 64-bit register file and wide data path while leaving > > > pointers at 32 bits for smaller memory footprint. > > > > > > - You will need a recent binutils (2.22 or later) with > > > - elf32_x86_64 support enabled to compile a kernel with this > > > - option set. > > > - > > > config COMPAT_32 > > > def_bool y > > > depends on IA32_EMULATION || X86_32 > > > @@ -2886,7 +2882,7 @@ config COMPAT_32 > > > > > > config COMPAT > > > def_bool y > > > - depends on IA32_EMULATION || X86_X32 > > > + depends on IA32_EMULATION || X86_X32_ABI > > > > > > if COMPAT > > > config COMPAT_FOR_U64_ALIGNMENT > > > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > > > index 2d6d5a28c3bf..e163549f5be7 100644 > > > --- a/arch/x86/Makefile > > > +++ b/arch/x86/Makefile > > > @@ -125,22 +125,6 @@ else > > > KBUILD_CFLAGS += -mcmodel=kernel > > > endif > > > > > > -ifdef CONFIG_X86_X32 > > > - x32_ld_ok := $(call try-run,\ > > > - /bin/echo -e '1: .quad 1b' | \ > > > - $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \ > > > - $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \ > > > - $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n) > > > - ifeq ($(x32_ld_ok),y) > > > - CONFIG_X86_X32_ABI := y > > > - KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI > > > - KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI > > > - else > > > - $(warning CONFIG_X86_X32 enabled but no binutils support) > > > - endif > > > -endif > > > -export CONFIG_X86_X32_ABI > > > - > > > # > > > # If the function graph tracer is used with mcount instead of fentry, > > > # '-maccumulate-outgoing-args' is needed to prevent a GCC bug > > > diff --git a/arch/x86/include/asm/syscall_wrapper.h b/arch/x86/include/asm/syscall_wrapper.h > > > index a84333adeef2..69bf87c41a0b 100644 > > > --- a/arch/x86/include/asm/syscall_wrapper.h > > > +++ b/arch/x86/include/asm/syscall_wrapper.h > > > @@ -158,7 +158,7 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs); > > > #endif /* CONFIG_IA32_EMULATION */ > > > > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > /* > > > * For the x32 ABI, we need to create a stub for compat_sys_*() which is aware > > > * of the x86-64-style parameter ordering of x32 syscalls. The syscalls common > > > @@ -176,12 +176,12 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs); > > > > > > #define __X32_COMPAT_SYS_NI(name) \ > > > __SYS_NI(x32, compat_sys_##name) > > > -#else /* CONFIG_X86_X32 */ > > > +#else /* CONFIG_X86_X32_ABI */ > > > #define __X32_COMPAT_SYS_STUB0(name) > > > #define __X32_COMPAT_SYS_STUBx(x, name, ...) > > > #define __X32_COMPAT_COND_SYSCALL(name) > > > #define __X32_COMPAT_SYS_NI(name) > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > > > > > > > #ifdef CONFIG_COMPAT > > > diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h > > > index 98aa103eb4ab..2963a2f5dbc4 100644 > > > --- a/arch/x86/include/asm/vdso.h > > > +++ b/arch/x86/include/asm/vdso.h > > > @@ -37,7 +37,7 @@ struct vdso_image { > > > extern const struct vdso_image vdso_image_64; > > > #endif > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > extern const struct vdso_image vdso_image_x32; > > > #endif > > > > > > diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c > > > index d08307df69ad..a93b6f4296fc 100644 > > > --- a/arch/x86/kernel/process_64.c > > > +++ b/arch/x86/kernel/process_64.c > > > @@ -656,7 +656,7 @@ void set_personality_64bit(void) > > > > > > static void __set_personality_x32(void) > > > { > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > if (current->mm) > > > current->mm->context.flags = 0; > > > > > > diff --git a/fs/fuse/file.c b/fs/fuse/file.c > > > index 8cccecb55fb8..c53c620d1a7a 100644 > > > --- a/fs/fuse/file.c > > > +++ b/fs/fuse/file.c > > > @@ -2797,7 +2797,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, > > > #else > > > if (flags & FUSE_IOCTL_COMPAT) { > > > inarg.flags |= FUSE_IOCTL_32BIT; > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > if (in_x32_syscall()) > > > inarg.flags |= FUSE_IOCTL_COMPAT_X32; > > > #endif > > > diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c > > > index 33c09ec8e6c0..e8038bc966e7 100644 > > > --- a/fs/xfs/xfs_ioctl32.c > > > +++ b/fs/xfs/xfs_ioctl32.c > > > @@ -233,7 +233,7 @@ xfs_compat_ioc_fsbulkstat( > > > inumbers_fmt_pf inumbers_func = xfs_fsinumbers_fmt_compat; > > > bulkstat_one_fmt_pf bs_one_func = xfs_fsbulkstat_one_fmt_compat; > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > if (in_x32_syscall()) { > > > /* > > > * ... but on x32 the input xfs_fsop_bulkreq has pointers > > > diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c > > > index 1d708aab9c98..5d1b94bda2cd 100644 > > > --- a/sound/core/control_compat.c > > > +++ b/sound/core/control_compat.c > > > @@ -153,7 +153,7 @@ struct snd_ctl_elem_value32 { > > > unsigned char reserved[128]; > > > }; > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > /* x32 has a different alignment for 64bit values from ia32 */ > > > struct snd_ctl_elem_value_x32 { > > > struct snd_ctl_elem_id id; > > > @@ -165,7 +165,7 @@ struct snd_ctl_elem_value_x32 { > > > } value; > > > unsigned char reserved[128]; > > > }; > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > > > > /* get the value type and count of the control */ > > > static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id, > > > @@ -350,7 +350,7 @@ static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file, > > > return ctl_elem_write_user(file, data32, &data32->value); > > > } > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > static int snd_ctl_elem_read_user_x32(struct snd_card *card, > > > struct snd_ctl_elem_value_x32 __user *data32) > > > { > > > @@ -362,7 +362,7 @@ static int snd_ctl_elem_write_user_x32(struct snd_ctl_file *file, > > > { > > > return ctl_elem_write_user(file, data32, &data32->value); > > > } > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > > > > /* add or replace a user control */ > > > static int snd_ctl_elem_add_compat(struct snd_ctl_file *file, > > > @@ -421,10 +421,10 @@ enum { > > > SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct snd_ctl_elem_value32), > > > SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct snd_ctl_elem_info32), > > > SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct snd_ctl_elem_info32), > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > SNDRV_CTL_IOCTL_ELEM_READ_X32 = _IOWR('U', 0x12, struct snd_ctl_elem_value_x32), > > > SNDRV_CTL_IOCTL_ELEM_WRITE_X32 = _IOWR('U', 0x13, struct snd_ctl_elem_value_x32), > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > }; > > > > > > static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) > > > @@ -463,12 +463,12 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, uns > > > return snd_ctl_elem_add_compat(ctl, argp, 0); > > > case SNDRV_CTL_IOCTL_ELEM_REPLACE32: > > > return snd_ctl_elem_add_compat(ctl, argp, 1); > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > case SNDRV_CTL_IOCTL_ELEM_READ_X32: > > > return snd_ctl_elem_read_user_x32(ctl->card, argp); > > > case SNDRV_CTL_IOCTL_ELEM_WRITE_X32: > > > return snd_ctl_elem_write_user_x32(ctl, argp); > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > } > > > > > > down_read(&snd_ioctl_rwsem); > > > diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c > > > index 590a46a9e78d..937f5117a81f 100644 > > > --- a/sound/core/pcm_compat.c > > > +++ b/sound/core/pcm_compat.c > > > @@ -147,13 +147,13 @@ static int snd_pcm_ioctl_channel_info_compat(struct snd_pcm_substream *substream > > > return err; > > > } > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > /* X32 ABI has the same struct as x86-64 for snd_pcm_channel_info */ > > > static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream, > > > struct snd_pcm_channel_info __user *src); > > > #define snd_pcm_ioctl_channel_info_x32(s, p) \ > > > snd_pcm_channel_info_user(s, p) > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > > > > struct compat_snd_pcm_status64 { > > > snd_pcm_state_t state; > > > @@ -373,7 +373,7 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream, > > > return err; > > > } > > > > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > /* X32 ABI has 64bit timespec and 64bit alignment */ > > > struct snd_pcm_mmap_status_x32 { > > > snd_pcm_state_t state; > > > @@ -464,7 +464,7 @@ static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream, > > > > > > return 0; > > > } > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > > > > /* > > > */ > > > @@ -484,10 +484,10 @@ enum { > > > SNDRV_PCM_IOCTL_READN_FRAMES32 = _IOR('A', 0x53, struct snd_xfern32), > > > SNDRV_PCM_IOCTL_STATUS_COMPAT64 = _IOR('A', 0x20, struct compat_snd_pcm_status64), > > > SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64 = _IOWR('A', 0x24, struct compat_snd_pcm_status64), > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > SNDRV_PCM_IOCTL_CHANNEL_INFO_X32 = _IOR('A', 0x32, struct snd_pcm_channel_info), > > > SNDRV_PCM_IOCTL_SYNC_PTR_X32 = _IOWR('A', 0x23, struct snd_pcm_sync_ptr_x32), > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > }; > > > > > > static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) > > > @@ -531,10 +531,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l > > > case __SNDRV_PCM_IOCTL_SYNC_PTR32: > > > return snd_pcm_common_ioctl(file, substream, cmd, argp); > > > case __SNDRV_PCM_IOCTL_SYNC_PTR64: > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > if (in_x32_syscall()) > > > return snd_pcm_ioctl_sync_ptr_x32(substream, argp); > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > return snd_pcm_common_ioctl(file, substream, cmd, argp); > > > case SNDRV_PCM_IOCTL_HW_REFINE32: > > > return snd_pcm_ioctl_hw_params_compat(substream, 1, argp); > > > @@ -566,10 +566,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l > > > return snd_pcm_status_user_compat64(substream, argp, false); > > > case SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64: > > > return snd_pcm_status_user_compat64(substream, argp, true); > > > -#ifdef CONFIG_X86_X32 > > > +#ifdef CONFIG_X86_X32_ABI > > > case SNDRV_PCM_IOCTL_CHANNEL_INFO_X32: > > > return snd_pcm_ioctl_channel_info_x32(substream, argp); > > > -#endif /* CONFIG_X86_X32 */ > > > +#endif /* CONFIG_X86_X32_ABI */ > > > } > > > > > > return -ENOIOCTLCMD; > > > -- > > > 2.27.0 > > > > > > -- > > > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > > > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > > > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210227183910.221873-1-masahiroy%40kernel.org. > > > > > > > > -- > > Best Regards > > Masahiro Yamada