diff mbox series

kbuild: mark prepare0 as PHONY to fix external module build

Message ID 1547536740-1572-1-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit e00d8880481497474792d28c14479a9fb6752046
Headers show
Series kbuild: mark prepare0 as PHONY to fix external module build | expand

Commit Message

Masahiro Yamada Jan. 15, 2019, 7:19 a.m. UTC
Commit c3ff2a5193fa ("powerpc/32: add stack protector support")
caused kernel panic on PowerPC if an external module is used with
CONFIG_STACKPROTECTOR because the 'prepare' target was not executed
for the external module build.

Commit e07db28eea38 ("kbuild: fix single target build for external
module") turned it into a build error because the 'prepare' target is
now executed but the 'prepare0' target is missing for the external
module build.

External module on arm/arm64 with CONFIG_STACKPROTECTOR_PER_TASK is
also broken in the same way.

Move 'PHONY += prepare0' to the common place. Make is fine with missing
rule for phony targets.

I minimize the change so it can be easily backported to 4.20.x

To fix v4.20 for external modules of PowerPC, please backport
e07db28eea38 ("kbuild: fix single target build for external module"),
and then this commit.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=201891
Fixes: e07db28eea38 ("kbuild: fix single target build for external module")
Fixes: c3ff2a5193fa ("powerpc/32: add stack protector support")
Fixes: 189af4657186 ("ARM: smp: add support for per-task stack canaries")
Fixes: 0a1213fa7432 ("arm64: enable per-task stack canaries")
Cc: linux-stable <stable@vger.kernel.org> # v4.20
Reported-by: Samuel Holland <samuel@sholland.org>
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.7.4

Comments

Mathieu Malaterre Jan. 15, 2019, 10:33 a.m. UTC | #1
On Tue, Jan 15, 2019 at 8:22 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>

> Commit c3ff2a5193fa ("powerpc/32: add stack protector support")

> caused kernel panic on PowerPC if an external module is used with

> CONFIG_STACKPROTECTOR because the 'prepare' target was not executed

> for the external module build.

>

> Commit e07db28eea38 ("kbuild: fix single target build for external

> module") turned it into a build error because the 'prepare' target is

> now executed but the 'prepare0' target is missing for the external

> module build.

>

> External module on arm/arm64 with CONFIG_STACKPROTECTOR_PER_TASK is

> also broken in the same way.

>

> Move 'PHONY += prepare0' to the common place. Make is fine with missing

> rule for phony targets.

>

> I minimize the change so it can be easily backported to 4.20.x

>

> To fix v4.20 for external modules of PowerPC, please backport

> e07db28eea38 ("kbuild: fix single target build for external module"),

> and then this commit.

>

> Link: https://bugzilla.kernel.org/show_bug.cgi?id=201891

> Fixes: e07db28eea38 ("kbuild: fix single target build for external module")

> Fixes: c3ff2a5193fa ("powerpc/32: add stack protector support")

> Fixes: 189af4657186 ("ARM: smp: add support for per-task stack canaries")

> Fixes: 0a1213fa7432 ("arm64: enable per-task stack canaries")

> Cc: linux-stable <stable@vger.kernel.org> # v4.20

> Reported-by: Samuel Holland <samuel@sholland.org>

> Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

> ---

>

>  Makefile | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/Makefile b/Makefile

> index 499b968..789b332 100644

> --- a/Makefile

> +++ b/Makefile

> @@ -955,6 +955,7 @@ ifdef CONFIG_STACK_VALIDATION

>    endif

>  endif

>

> +PHONY += prepare0

>

>  ifeq ($(KBUILD_EXTMOD),)

>  core-y         += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/

> @@ -1061,8 +1062,7 @@ scripts: scripts_basic scripts_dtc

>  # archprepare is used in arch Makefiles and when processed asm symlink,

>  # version.h and scripts_basic is processed / created.

>

> -# Listed in dependency order


The above comment may need to be tweaked a bit

> -PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3

> +PHONY += prepare archprepare prepare1 prepare2 prepare3

>

>  # prepare3 is used to check if we are building in a separate output directory,

>  # and if so do:

> --

> 2.7.4

>
Masahiro Yamada Jan. 15, 2019, 2:58 p.m. UTC | #2
On Tue, Jan 15, 2019 at 7:35 PM Mathieu Malaterre <malat@debian.org> wrote:
>

> On Tue, Jan 15, 2019 at 8:22 AM Masahiro Yamada

> <yamada.masahiro@socionext.com> wrote:

> >

> > Commit c3ff2a5193fa ("powerpc/32: add stack protector support")

> > caused kernel panic on PowerPC if an external module is used with

> > CONFIG_STACKPROTECTOR because the 'prepare' target was not executed

> > for the external module build.

> >

> > Commit e07db28eea38 ("kbuild: fix single target build for external

> > module") turned it into a build error because the 'prepare' target is

> > now executed but the 'prepare0' target is missing for the external

> > module build.

> >

> > External module on arm/arm64 with CONFIG_STACKPROTECTOR_PER_TASK is

> > also broken in the same way.

> >

> > Move 'PHONY += prepare0' to the common place. Make is fine with missing

> > rule for phony targets.

> >

> > I minimize the change so it can be easily backported to 4.20.x

> >

> > To fix v4.20 for external modules of PowerPC, please backport

> > e07db28eea38 ("kbuild: fix single target build for external module"),

> > and then this commit.

> >

> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=201891

> > Fixes: e07db28eea38 ("kbuild: fix single target build for external module")

> > Fixes: c3ff2a5193fa ("powerpc/32: add stack protector support")

> > Fixes: 189af4657186 ("ARM: smp: add support for per-task stack canaries")

> > Fixes: 0a1213fa7432 ("arm64: enable per-task stack canaries")

> > Cc: linux-stable <stable@vger.kernel.org> # v4.20

> > Reported-by: Samuel Holland <samuel@sholland.org>

> > Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>

> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

> > ---

> >

> >  Makefile | 4 ++--

> >  1 file changed, 2 insertions(+), 2 deletions(-)

> >

> > diff --git a/Makefile b/Makefile

> > index 499b968..789b332 100644

> > --- a/Makefile

> > +++ b/Makefile

> > @@ -955,6 +955,7 @@ ifdef CONFIG_STACK_VALIDATION

> >    endif

> >  endif

> >

> > +PHONY += prepare0

> >

> >  ifeq ($(KBUILD_EXTMOD),)

> >  core-y         += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/

> > @@ -1061,8 +1062,7 @@ scripts: scripts_basic scripts_dtc

> >  # archprepare is used in arch Makefiles and when processed asm symlink,

> >  # version.h and scripts_basic is processed / created.

> >

> > -# Listed in dependency order

>

> The above comment may need to be tweaked a bit


The comment is wrong irrespective of this patch,
and less important.

Do you have any suggestion how to tweak it?


> > -PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3

> > +PHONY += prepare archprepare prepare1 prepare2 prepare3

> >

> >  # prepare3 is used to check if we are building in a separate output directory,

> >  # and if so do:

> > --

> > 2.7.4

> >




-- 
Best Regards
Masahiro Yamada
Masahiro Yamada Jan. 16, 2019, 2:33 p.m. UTC | #3
On Tue, Jan 15, 2019 at 5:07 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>

> Commit c3ff2a5193fa ("powerpc/32: add stack protector support")

> caused kernel panic on PowerPC if an external module is used with

> CONFIG_STACKPROTECTOR because the 'prepare' target was not executed

> for the external module build.

>

> Commit e07db28eea38 ("kbuild: fix single target build for external

> module") turned it into a build error because the 'prepare' target is

> now executed but the 'prepare0' target is missing for the external

> module build.

>

> External module on arm/arm64 with CONFIG_STACKPROTECTOR_PER_TASK is

> also broken in the same way.

>

> Move 'PHONY += prepare0' to the common place. Make is fine with missing

> rule for phony targets.

>

> I minimize the change so it can be easily backported to 4.20.x

>

> To fix v4.20 for external modules of PowerPC, please backport

> e07db28eea38 ("kbuild: fix single target build for external module"),

> and then this commit.

>

> Link: https://bugzilla.kernel.org/show_bug.cgi?id=201891

> Fixes: e07db28eea38 ("kbuild: fix single target build for external module")

> Fixes: c3ff2a5193fa ("powerpc/32: add stack protector support")

> Fixes: 189af4657186 ("ARM: smp: add support for per-task stack canaries")

> Fixes: 0a1213fa7432 ("arm64: enable per-task stack canaries")

> Cc: linux-stable <stable@vger.kernel.org> # v4.20

> Reported-by: Samuel Holland <samuel@sholland.org>

> Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

> ---


Applied to linux-kbuild/fixes.


>  Makefile | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/Makefile b/Makefile

> index 499b968..789b332 100644

> --- a/Makefile

> +++ b/Makefile

> @@ -955,6 +955,7 @@ ifdef CONFIG_STACK_VALIDATION

>    endif

>  endif

>

> +PHONY += prepare0

>

>  ifeq ($(KBUILD_EXTMOD),)

>  core-y         += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/

> @@ -1061,8 +1062,7 @@ scripts: scripts_basic scripts_dtc

>  # archprepare is used in arch Makefiles and when processed asm symlink,

>  # version.h and scripts_basic is processed / created.

>

> -# Listed in dependency order

> -PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3

> +PHONY += prepare archprepare prepare1 prepare2 prepare3

>

>  # prepare3 is used to check if we are building in a separate output directory,

>  # and if so do:

> --

> 2.7.4

>



-- 
Best Regards
Masahiro Yamada
Michael Ellerman Jan. 17, 2019, 1:39 p.m. UTC | #4
Masahiro Yamada <yamada.masahiro@socionext.com> writes:
> On Tue, Jan 15, 2019 at 5:07 PM Masahiro Yamada

> <yamada.masahiro@socionext.com> wrote:

>>

>> Commit c3ff2a5193fa ("powerpc/32: add stack protector support")

>> caused kernel panic on PowerPC if an external module is used with

>> CONFIG_STACKPROTECTOR because the 'prepare' target was not executed

>> for the external module build.

>>

>> Commit e07db28eea38 ("kbuild: fix single target build for external

>> module") turned it into a build error because the 'prepare' target is

>> now executed but the 'prepare0' target is missing for the external

>> module build.

>>

>> External module on arm/arm64 with CONFIG_STACKPROTECTOR_PER_TASK is

>> also broken in the same way.

>>

>> Move 'PHONY += prepare0' to the common place. Make is fine with missing

>> rule for phony targets.

>>

>> I minimize the change so it can be easily backported to 4.20.x

>>

>> To fix v4.20 for external modules of PowerPC, please backport

>> e07db28eea38 ("kbuild: fix single target build for external module"),

>> and then this commit.

>>

>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=201891

>> Fixes: e07db28eea38 ("kbuild: fix single target build for external module")

>> Fixes: c3ff2a5193fa ("powerpc/32: add stack protector support")

>> Fixes: 189af4657186 ("ARM: smp: add support for per-task stack canaries")

>> Fixes: 0a1213fa7432 ("arm64: enable per-task stack canaries")

>> Cc: linux-stable <stable@vger.kernel.org> # v4.20

>> Reported-by: Samuel Holland <samuel@sholland.org>

>> Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>

>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

>> ---

>

> Applied to linux-kbuild/fixes.


Thanks.

cheers
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 499b968..789b332 100644
--- a/Makefile
+++ b/Makefile
@@ -955,6 +955,7 @@  ifdef CONFIG_STACK_VALIDATION
   endif
 endif
 
+PHONY += prepare0
 
 ifeq ($(KBUILD_EXTMOD),)
 core-y		+= kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
@@ -1061,8 +1062,7 @@  scripts: scripts_basic scripts_dtc
 # archprepare is used in arch Makefiles and when processed asm symlink,
 # version.h and scripts_basic is processed / created.
 
-# Listed in dependency order
-PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
+PHONY += prepare archprepare prepare1 prepare2 prepare3
 
 # prepare3 is used to check if we are building in a separate output directory,
 # and if so do: