Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] arm: vdso: pass --be8 to linker if necessary
@ 2019-05-29 18:23 Jason A. Donenfeld
  2019-05-31  2:01 ` Masahiro Yamada
  2019-06-13 17:03 ` Jason A. Donenfeld
  0 siblings, 2 replies; 6+ messages in thread
From: Jason A. Donenfeld @ 2019-05-29 18:23 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: Masahiro Yamada, Jason A. Donenfeld, Russell King, Arnd Bergmann,
	Ard Biesheuvel

The commit fe00e50b2db8 ("ARM: 8858/1: vdso: use $(LD) instead of $(CC)
to link VDSO") removed the passing of CFLAGS, since ld doesn't take
those directly. However, prior, big-endian ARM was relying on gcc to
translate its -mbe8 option into ld's --be8 option. Lacking this, ld
generated be32 code, making the VDSO generate SIGILL when called by
userspace.

This commit passes --be8 if CONFIG_CPU_ENDIAN_BE8 is enabled.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm/vdso/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index fadf554d9391..1f5ec9741e6d 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -10,9 +10,10 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
 ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector
 ccflags-y += -DDISABLE_BRANCH_PROFILING
 
-ldflags-y = -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
+ldflags-$(CONFIG_CPU_ENDIAN_BE8) := --be8
+ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
 	    -z max-page-size=4096 -z common-page-size=4096 \
-	    -nostdlib -shared \
+	    -nostdlib -shared $(ldflags-y) \
 	    $(call ld-option, --hash-style=sysv) \
 	    $(call ld-option, --build-id) \
 	    -T
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm: vdso: pass --be8 to linker if necessary
  2019-05-29 18:23 [PATCH] arm: vdso: pass --be8 to linker if necessary Jason A. Donenfeld
@ 2019-05-31  2:01 ` Masahiro Yamada
  2019-05-31  8:17   ` Jason A. Donenfeld
  2019-05-31  8:37   ` Russell King - ARM Linux admin
  2019-06-13 17:03 ` Jason A. Donenfeld
  1 sibling, 2 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-05-31  2:01 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: Russell King, Arnd Bergmann, Linux Kernel Mailing List,
	linux-arm-kernel, Ard Biesheuvel

Hi Jason,

Thanks for catching this.

On Thu, May 30, 2019 at 3:26 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> The commit fe00e50b2db8 ("ARM: 8858/1: vdso: use $(LD) instead of $(CC)
> to link VDSO") removed the passing of CFLAGS, since ld doesn't take
> those directly. However, prior, big-endian ARM was relying on gcc to
> translate its -mbe8 option into ld's --be8 option. Lacking this, ld


'git grep -- -mbe8' has no hit.

Is it a toolchain internal flag?



> generated be32 code, making the VDSO generate SIGILL when called by
> userspace.
>
> This commit passes --be8 if CONFIG_CPU_ENDIAN_BE8 is enabled.
>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Russell King <rmk+kernel@armlinux.org.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  arch/arm/vdso/Makefile | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
> index fadf554d9391..1f5ec9741e6d 100644
> --- a/arch/arm/vdso/Makefile
> +++ b/arch/arm/vdso/Makefile
> @@ -10,9 +10,10 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
>  ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector
>  ccflags-y += -DDISABLE_BRANCH_PROFILING
>
> -ldflags-y = -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
> +ldflags-$(CONFIG_CPU_ENDIAN_BE8) := --be8
> +ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
>             -z max-page-size=4096 -z common-page-size=4096 \
> -           -nostdlib -shared \
> +           -nostdlib -shared $(ldflags-y) \
>             $(call ld-option, --hash-style=sysv) \
>             $(call ld-option, --build-id) \
>             -T
> --
> 2.21.0
>


--
Best Regards
Masahiro Yamada

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm: vdso: pass --be8 to linker if necessary
  2019-05-31  2:01 ` Masahiro Yamada
@ 2019-05-31  8:17   ` Jason A. Donenfeld
  2019-06-18 14:56     ` Masahiro Yamada
  2019-05-31  8:37   ` Russell King - ARM Linux admin
  1 sibling, 1 reply; 6+ messages in thread
From: Jason A. Donenfeld @ 2019-05-31  8:17 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Russell King, Arnd Bergmann, Linux Kernel Mailing List,
	linux-arm-kernel, Ard Biesheuvel

Hey Masahiro,

I'm not sure exactly. I did just notice another place --be8 is being added:

ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
LDFLAGS_vmlinux += --be8
KBUILD_LDFLAGS_MODULE   += --be8
endif

I suppose it's possible that this is kbuild related where one of those
isn't winding up in the right place. I did see that the commit that
this patch addresses uses "=" instead of the more usual ":=" or "+="
for whatever reason.

Jason

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm: vdso: pass --be8 to linker if necessary
  2019-05-31  2:01 ` Masahiro Yamada
  2019-05-31  8:17   ` Jason A. Donenfeld
@ 2019-05-31  8:37   ` Russell King - ARM Linux admin
  1 sibling, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux admin @ 2019-05-31  8:37 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Jason A. Donenfeld, Arnd Bergmann, Linux Kernel Mailing List,
	linux-arm-kernel, Ard Biesheuvel

On Fri, May 31, 2019 at 11:01:23AM +0900, Masahiro Yamada wrote:
> Hi Jason,
> 
> Thanks for catching this.
> 
> On Thu, May 30, 2019 at 3:26 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> >
> > The commit fe00e50b2db8 ("ARM: 8858/1: vdso: use $(LD) instead of $(CC)
> > to link VDSO") removed the passing of CFLAGS, since ld doesn't take
> > those directly. However, prior, big-endian ARM was relying on gcc to
> > translate its -mbe8 option into ld's --be8 option. Lacking this, ld
> 
> 
> 'git grep -- -mbe8' has no hit.

It isn't -mbe8, it is --be8

$ arm-linux-gcc --target-help
...
  --be8                       Output BE8 format image

> 
> Is it a toolchain internal flag?
> 
> 
> 
> > generated be32 code, making the VDSO generate SIGILL when called by
> > userspace.
> >
> > This commit passes --be8 if CONFIG_CPU_ENDIAN_BE8 is enabled.
> >
> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> > Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> > Cc: Russell King <rmk+kernel@armlinux.org.uk>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> >  arch/arm/vdso/Makefile | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
> > index fadf554d9391..1f5ec9741e6d 100644
> > --- a/arch/arm/vdso/Makefile
> > +++ b/arch/arm/vdso/Makefile
> > @@ -10,9 +10,10 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
> >  ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector
> >  ccflags-y += -DDISABLE_BRANCH_PROFILING
> >
> > -ldflags-y = -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
> > +ldflags-$(CONFIG_CPU_ENDIAN_BE8) := --be8
> > +ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
> >             -z max-page-size=4096 -z common-page-size=4096 \
> > -           -nostdlib -shared \
> > +           -nostdlib -shared $(ldflags-y) \
> >             $(call ld-option, --hash-style=sysv) \
> >             $(call ld-option, --build-id) \
> >             -T
> > --
> > 2.21.0
> >
> 
> 
> --
> Best Regards
> Masahiro Yamada
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm: vdso: pass --be8 to linker if necessary
  2019-05-29 18:23 [PATCH] arm: vdso: pass --be8 to linker if necessary Jason A. Donenfeld
  2019-05-31  2:01 ` Masahiro Yamada
@ 2019-06-13 17:03 ` Jason A. Donenfeld
  1 sibling, 0 replies; 6+ messages in thread
From: Jason A. Donenfeld @ 2019-06-13 17:03 UTC (permalink / raw)
  To: linux-arm-kernel, LKML
  Cc: Masahiro Yamada, Russell King, Arnd Bergmann, Ard Biesheuvel

Hey Masahiro,

Considering ARM big endian userland is pretty badly broken without
this, we should probably have this merged in the next rc or rather
soon. Was there additional information you needed? Would you prefer
Russell queues up my patch or did you want to make further build
system changes?

Jason

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arm: vdso: pass --be8 to linker if necessary
  2019-05-31  8:17   ` Jason A. Donenfeld
@ 2019-06-18 14:56     ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-06-18 14:56 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: Russell King, Arnd Bergmann, Linux Kernel Mailing List,
	linux-arm-kernel, Ard Biesheuvel

Hi.

On Fri, May 31, 2019 at 5:20 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> Hey Masahiro,
>
> I'm not sure exactly. I did just notice another place --be8 is being added:

That is not my question.

I just asked about your commit log:
"big-endian ARM was relying on gcc to translate
its -mbe8 option into ld's --be8 option"

I grepped '-mbe8', but I did not see it anywhere
in the source tree.

So, I just wondered where it came from.


> ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
> LDFLAGS_vmlinux += --be8
> KBUILD_LDFLAGS_MODULE   += --be8
> endif
>
> I suppose it's possible that this is kbuild related where one of those
> isn't winding up in the right place. I did see that the commit that
> this patch addresses uses "=" instead of the more usual ":=" or "+="
> for whatever reason.
>
> Jason

Perhaps, the following will be cleaner:

ldflags-$(CONFIG_CPU_ENDIAN_BE8) += --be8
ldflags-y += -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
            -z max-page-size=4096 -z common-page-size=4096 \
            -nostdlib -shared \
            $(call ld-option, --hash-style=sysv) \
            $(call ld-option, --build-id) \
            -T


I think this fix-up should be applied by Russell.
Please note he does not pick up patches directly from ML.
To ask him to pick up patches, you need to put
patches into his patch tracker.
(patches@arm.linux.org.uk)


-- 
Best Regards
Masahiro Yamada

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 18:23 [PATCH] arm: vdso: pass --be8 to linker if necessary Jason A. Donenfeld
2019-05-31  2:01 ` Masahiro Yamada
2019-05-31  8:17   ` Jason A. Donenfeld
2019-06-18 14:56     ` Masahiro Yamada
2019-05-31  8:37   ` Russell King - ARM Linux admin
2019-06-13 17:03 ` Jason A. Donenfeld

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org infradead-linux-arm-kernel@archiver.kernel.org
	public-inbox-index linux-arm-kernel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox