[lkml]   [2020]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH 4.19 135/639] kbuild: mark prepare0 as PHONY to fix external module build
    From: Masahiro Yamada <>

    [ Upstream commit e00d8880481497474792d28c14479a9fb6752046 ]

    Commit c3ff2a5193fa ("powerpc/32: add stack protector support")
    caused kernel panic on PowerPC when 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. GNU Make is fine with
    missing rule for phony targets. I also removed the comment which is
    wrong irrespective of this commit.

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

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

    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 <> # v4.20
    Reported-by: Samuel Holland <>
    Reported-by: Alexey Kardashevskiy <>
    Signed-off-by: Masahiro Yamada <>
    Acked-by: Ard Biesheuvel <>
    Tested-by: Alexey Kardashevskiy <>
    Signed-off-by: Sasha Levin <>
    Makefile | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/Makefile b/Makefile
    index 48dbafb790ff1..9ceecb038356d 100644
    --- a/Makefile
    +++ b/Makefile
    @@ -964,6 +964,7 @@ ifdef CONFIG_STACK_VALIDATION

    +PHONY += prepare0

    ifeq ($(KBUILD_EXTMOD),)
    core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
    @@ -1072,8 +1073,7 @@ scripts: scripts_basic asm-generic gcc-plugins $(autoksyms_h)
    # 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:

     \ /
      Last update: 2020-01-24 12:06    [W:4.028 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site