linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH kernel] powerpc/stack_protector: Fix external modules building
@ 2019-01-10  5:42 Alexey Kardashevskiy
  2019-01-11  3:08 ` Masahiro Yamada
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Kardashevskiy @ 2019-01-10  5:42 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Alexey Kardashevskiy, linux-kernel, Masahiro Yamada

c3ff2a519 "powerpc/32: add stack protector support" addes stack protector
support so now powerpc's "prepare" target depends on prepare0 (via
stack_protector_prepare target).

It works fine until we try build an external module where it fails with:
Run: 'make -j128 SYSSRC=/home/aik/p/kernel SYSOUT=/home/aik/pbuild/kernel-le-pseries/ ARCH=powerpc'
make[1]: Entering directory '/home/aik/p/kernel'
make[2]: Entering directory '/home/aik/pbuild/kernel-le-pseries'
make[2]: *** No rule to make target 'prepare0', needed by 'stack_protector_prepare'.  Stop.

The reason for that is that the main Linux Makefile defines "prepare0"
only if KBUILD_EXTMOD=="".

This hacks powerpc's Makefile to make external modules build again.

Fixes: c3ff2a519 "powerpc/32: add stack protector support"
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---


It has been suggested that there is a better way of fixing this hence RFC.


---
 arch/powerpc/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 488c9ed..0492f62 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -419,7 +419,11 @@ archheaders:
 ifdef CONFIG_STACKPROTECTOR
 prepare: stack_protector_prepare
 
+ifeq ($(KBUILD_EXTMOD),)
 stack_protector_prepare: prepare0
+else
+stack_protector_prepare:
+endif
 ifdef CONFIG_PPC64
 	$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h))
 else
-- 
2.17.1


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

* Re: [RFC PATCH kernel] powerpc/stack_protector: Fix external modules building
  2019-01-10  5:42 [RFC PATCH kernel] powerpc/stack_protector: Fix external modules building Alexey Kardashevskiy
@ 2019-01-11  3:08 ` Masahiro Yamada
  2019-01-11  4:09   ` Alexey Kardashevskiy
  2019-01-11  5:25   ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Masahiro Yamada @ 2019-01-11  3:08 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: linuxppc-dev, Linux Kernel Mailing List

On Thu, Jan 10, 2019 at 2:44 PM Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>
> c3ff2a519 "powerpc/32: add stack protector support" addes stack protector
> support so now powerpc's "prepare" target depends on prepare0 (via
> stack_protector_prepare target).
>
> It works fine until we try build an external module where it fails with:
> Run: 'make -j128 SYSSRC=/home/aik/p/kernel SYSOUT=/home/aik/pbuild/kernel-le-pseries/ ARCH=powerpc'
> make[1]: Entering directory '/home/aik/p/kernel'
> make[2]: Entering directory '/home/aik/pbuild/kernel-le-pseries'
> make[2]: *** No rule to make target 'prepare0', needed by 'stack_protector_prepare'.  Stop.
>
> The reason for that is that the main Linux Makefile defines "prepare0"
> only if KBUILD_EXTMOD=="".
>
> This hacks powerpc's Makefile to make external modules build again.
>
> Fixes: c3ff2a519 "powerpc/32: add stack protector support"
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>
>
> It has been suggested that there is a better way of fixing this hence RFC.
>
>
> ---
>  arch/powerpc/Makefile | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 488c9ed..0492f62 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -419,7 +419,11 @@ archheaders:
>  ifdef CONFIG_STACKPROTECTOR
>  prepare: stack_protector_prepare
>
> +ifeq ($(KBUILD_EXTMOD),)
>  stack_protector_prepare: prepare0
> +else
> +stack_protector_prepare:
> +endif


Honestly, I think this is ugly.

Do you want me to send an alternative solution?




>  ifdef CONFIG_PPC64
>         $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h))
>  else
> --
> 2.17.1
>


-- 
Best Regards
Masahiro Yamada

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

* Re: [RFC PATCH kernel] powerpc/stack_protector: Fix external modules building
  2019-01-11  3:08 ` Masahiro Yamada
@ 2019-01-11  4:09   ` Alexey Kardashevskiy
  2019-01-11  5:25   ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Alexey Kardashevskiy @ 2019-01-11  4:09 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linuxppc-dev, Linux Kernel Mailing List



On 11/01/2019 14:08, Masahiro Yamada wrote:
> On Thu, Jan 10, 2019 at 2:44 PM Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>>
>> c3ff2a519 "powerpc/32: add stack protector support" addes stack protector
>> support so now powerpc's "prepare" target depends on prepare0 (via
>> stack_protector_prepare target).
>>
>> It works fine until we try build an external module where it fails with:
>> Run: 'make -j128 SYSSRC=/home/aik/p/kernel SYSOUT=/home/aik/pbuild/kernel-le-pseries/ ARCH=powerpc'
>> make[1]: Entering directory '/home/aik/p/kernel'
>> make[2]: Entering directory '/home/aik/pbuild/kernel-le-pseries'
>> make[2]: *** No rule to make target 'prepare0', needed by 'stack_protector_prepare'.  Stop.
>>
>> The reason for that is that the main Linux Makefile defines "prepare0"
>> only if KBUILD_EXTMOD=="".
>>
>> This hacks powerpc's Makefile to make external modules build again.
>>
>> Fixes: c3ff2a519 "powerpc/32: add stack protector support"
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>>
>>
>> It has been suggested that there is a better way of fixing this hence RFC.
>>
>>
>> ---
>>  arch/powerpc/Makefile | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
>> index 488c9ed..0492f62 100644
>> --- a/arch/powerpc/Makefile
>> +++ b/arch/powerpc/Makefile
>> @@ -419,7 +419,11 @@ archheaders:
>>  ifdef CONFIG_STACKPROTECTOR
>>  prepare: stack_protector_prepare
>>
>> +ifeq ($(KBUILD_EXTMOD),)
>>  stack_protector_prepare: prepare0
>> +else
>> +stack_protector_prepare:
>> +endif
> 
> 
> Honestly, I think this is ugly.
> 
> Do you want me to send an alternative solution?

YES! Thanks :)

> 
> 
> 
> 
>>  ifdef CONFIG_PPC64
>>         $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h))
>>  else
>> --
>> 2.17.1
>>
> 
> 

-- 
Alexey

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

* Re: [RFC PATCH kernel] powerpc/stack_protector: Fix external modules building
  2019-01-11  3:08 ` Masahiro Yamada
  2019-01-11  4:09   ` Alexey Kardashevskiy
@ 2019-01-11  5:25   ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2019-01-11  5:25 UTC (permalink / raw)
  To: Masahiro Yamada, Alexey Kardashevskiy
  Cc: linuxppc-dev, Linux Kernel Mailing List

Masahiro Yamada <yamada.masahiro@socionext.com> writes:
> On Thu, Jan 10, 2019 at 2:44 PM Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
...
>> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
>> index 488c9ed..0492f62 100644
>> --- a/arch/powerpc/Makefile
>> +++ b/arch/powerpc/Makefile
>> @@ -419,7 +419,11 @@ archheaders:
>>  ifdef CONFIG_STACKPROTECTOR
>>  prepare: stack_protector_prepare
>>
>> +ifeq ($(KBUILD_EXTMOD),)
>>  stack_protector_prepare: prepare0
>> +else
>> +stack_protector_prepare:
>> +endif
>
>
> Honestly, I think this is ugly.

Yes I would call it a hack :)

> Do you want me to send an alternative solution?

I don't grok how external modules are built well enough to work out what
the right solution is. So if you can come up with something better that
would be awesome.

cheers

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

end of thread, other threads:[~2019-01-11  5:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10  5:42 [RFC PATCH kernel] powerpc/stack_protector: Fix external modules building Alexey Kardashevskiy
2019-01-11  3:08 ` Masahiro Yamada
2019-01-11  4:09   ` Alexey Kardashevskiy
2019-01-11  5:25   ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).