Commit graph

1587 commits

Author SHA1 Message Date
Masahiro Yamada
ed94750a2e kbuild: mark prepare0 as PHONY to fix external module build
[ Upstream commit e00d888048 ]

Commit c3ff2a5193 ("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 e07db28eea ("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 e07db28eea ("kbuild: fix single target
build for external module"), and then this commit.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=201891
Fixes: e07db28eea ("kbuild: fix single target build for external module")
Fixes: c3ff2a5193 ("powerpc/32: add stack protector support")
Fixes: 189af46571 ("ARM: smp: add support for per-task stack canaries")
Fixes: 0a1213fa74 ("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>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-27 14:50:13 +01:00
Greg Kroah-Hartman
d183c8e264 Linux 4.19.98 2020-01-23 08:21:39 +01:00
Greg Kroah-Hartman
dc4ba5be1b Linux 4.19.97 2020-01-17 19:47:17 +01:00
Greg Kroah-Hartman
db5b9190ff Linux 4.19.96 2020-01-14 20:07:09 +01:00
Greg Kroah-Hartman
dcd8889835 Linux 4.19.95 2020-01-12 12:17:30 +01:00
Greg Kroah-Hartman
cb1f9a169a Linux 4.19.94 2020-01-09 10:19:10 +01:00
Greg Kroah-Hartman
3d40d7117e Linux 4.19.93 2020-01-04 19:13:46 +01:00
Greg Kroah-Hartman
c7ecf3e3a7 Linux 4.19.92 2019-12-31 16:36:37 +01:00
Greg Kroah-Hartman
672481c2de Linux 4.19.91 2019-12-21 10:57:45 +01:00
Greg Kroah-Hartman
7d120bf21c Linux 4.19.90 2019-12-17 20:36:04 +01:00
Greg Kroah-Hartman
312017a460 Linux 4.19.89 2019-12-13 08:52:59 +01:00
Masahiro Yamada
f7a5ed083e kbuild: fix single target build for external module
[ Upstream commit e07db28eea ]

Building a single target in an external module fails due to missing
.tmp_versions directory.

For example,

  $ make -C /lib/modules/$(uname -r)/build M=$PWD foo.o

will fail in the following way:

  CC [M]  /home/masahiro/foo/foo.o
/bin/sh: 1: cannot create /home/masahiro/foo/.tmp_versions/foo.mod: Directory nonexistent

This is because $(cmd_crmodverdir) is executed only before building
/, %/, %.ko single targets of external modules. Create .tmp_versions
in the 'prepare' target.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-13 08:52:21 +01:00
Greg Kroah-Hartman
fb683b5e3f Linux 4.19.88 2019-12-05 09:21:36 +01:00
Greg Kroah-Hartman
174651bdf8 Linux 4.19.87 2019-12-01 09:17:47 +01:00
Greg Kroah-Hartman
14260788bb Linux 4.19.86 2019-11-24 08:21:09 +01:00
Greg Kroah-Hartman
c63ee2939d Linux 4.19.85 2019-11-20 18:47:54 +01:00
Greg Kroah-Hartman
c555efaf14 Linux 4.19.84 2019-11-12 19:21:46 +01:00
Greg Kroah-Hartman
7d8dbefc22 Linux 4.19.83 2019-11-10 11:27:57 +01:00
Seth Forshee
b17eae5a0e kbuild: add -fcf-protection=none when using retpoline flags
[ Upstream commit 29be86d7f9 ]

The gcc -fcf-protection=branch option is not compatible with
-mindirect-branch=thunk-extern. The latter is used when
CONFIG_RETPOLINE is selected, and this will fail to build with
a gcc which has -fcf-protection=branch enabled by default. Adding
-fcf-protection=none when building with retpoline enabled
prevents such build failures.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-11-10 11:27:09 +01:00
Greg Kroah-Hartman
5ee93551c7 Linux 4.19.82 2019-11-06 13:06:31 +01:00
Greg Kroah-Hartman
ef244c3088 Linux 4.19.81 2019-10-29 09:20:09 +01:00
Greg Kroah-Hartman
c3038e718a Linux 4.19.80 2019-10-17 13:45:44 -07:00
Greg Kroah-Hartman
dafd634415 Linux 4.19.79 2019-10-11 18:21:44 +02:00
Greg Kroah-Hartman
58fce20645 Linux 4.19.78 2019-10-07 18:57:29 +02:00
Greg Kroah-Hartman
6cad9d0cf8 Linux 4.19.77 2019-10-05 13:10:13 +02:00
Greg Kroah-Hartman
555161ee1b Linux 4.19.76 2019-10-01 08:26:13 +02:00
Greg Kroah-Hartman
d573e8a79f Linux 4.19.75 2019-09-21 07:17:15 +02:00
Greg Kroah-Hartman
dbc29aff8d Linux 4.19.74 2019-09-19 09:09:41 +02:00
Greg Kroah-Hartman
db2d0b7c1d Linux 4.19.73 2019-09-16 08:22:25 +02:00
Greg Kroah-Hartman
ee809c7e08 Linux 4.19.72 2019-09-10 10:33:54 +01:00
Greg Kroah-Hartman
e7d2672c66 Linux 4.19.71 2019-09-06 12:40:02 +02:00
Greg Kroah-Hartman
0fed55c248 Linux 4.19.70 2019-09-06 10:22:24 +02:00
Greg Kroah-Hartman
97ab07e11f Linux 4.19.69 2019-08-29 08:29:00 +02:00
Greg Kroah-Hartman
def4c11b31 Linux 4.19.68 2019-08-25 10:48:06 +02:00
Greg Kroah-Hartman
a5aa80588f Linux 4.19.67 2019-08-16 10:12:54 +02:00
Greg Kroah-Hartman
893af1c79e Linux 4.19.66 2019-08-09 17:52:35 +02:00
Greg Kroah-Hartman
cc4c818b22 Linux 4.19.65 2019-08-06 19:06:58 +02:00
Masahiro Yamada
4c5a442561 kbuild: initialize CLANG_FLAGS correctly in the top Makefile
commit 5241ab4cf4 upstream.

CLANG_FLAGS is initialized by the following line:

  CLANG_FLAGS     := --target=$(notdir $(CROSS_COMPILE:%-=%))

..., which is run only when CROSS_COMPILE is set.

Some build targets (bindeb-pkg etc.) recurse to the top Makefile.

When you build the kernel with Clang but without CROSS_COMPILE,
the same compiler flags such as -no-integrated-as are accumulated
into CLANG_FLAGS.

If you run 'make CC=clang' and then 'make CC=clang bindeb-pkg',
Kbuild will recompile everything needlessly due to the build command
change.

Fix this by correctly initializing CLANG_FLAGS.

Fixes: 238bcbc4e0 ("kbuild: consolidate Clang compiler flags")
Cc: <stable@vger.kernel.org> # v5.0+
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-06 19:06:53 +02:00
Greg Kroah-Hartman
b3060a1a31 Linux 4.19.64 2019-08-04 09:30:58 +02:00
Greg Kroah-Hartman
9a9de33a9d Linux 4.19.63 2019-07-31 07:27:12 +02:00
Nathan Chancellor
27f2335e14 kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS
[ Upstream commit 589834b3a0 ]

In commit ebcc5928c5 ("arm64: Silence gcc warnings about arch ABI
drift"), the arm64 Makefile added -Wno-psabi to KBUILD_CFLAGS, which is
a GCC only option so clang rightfully complains:

warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]

https://clang.llvm.org/docs/DiagnosticsReference.html#wunknown-warning-option

However, by default, this is merely a warning so the build happily goes
on with a slew of these warnings in the process.

Commit c3f0d0bc5b ("kbuild, LLVMLinux: Add -Werror to cc-option to
support clang") worked around this behavior in cc-option by adding
-Werror so that unknown flags cause an error. However, this all happens
silently and when an unknown flag is added to the build unconditionally
like -Wno-psabi, cc-option will always fail because there is always an
unknown flag in the list of flags. This manifested as link time failures
in the arm64 libstub because -fno-stack-protector didn't get added to
KBUILD_CFLAGS.

To avoid these weird cryptic failures in the future, make clang behave
like gcc and immediately error when it encounters an unknown flag by
adding -Werror=unknown-warning-option to CLANG_FLAGS. This can be added
unconditionally for clang because it is supported by at least 3.0.0,
according to godbolt [1] and 4.0.0, according to its documentation [2],
which is far earlier than we typically support.

[1]: https://godbolt.org/z/7F7rm3
[2]: https://releases.llvm.org/4.0.0/tools/clang/docs/DiagnosticsReference.html#wunknown-warning-option

Link: https://github.com/ClangBuiltLinux/linux/issues/511
Link: https://github.com/ClangBuiltLinux/linux/issues/517
Suggested-by: Peter Smith <peter.smith@linaro.org>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-07-31 07:27:02 +02:00
Greg Kroah-Hartman
64f4694072 Linux 4.19.62 2019-07-28 08:29:30 +02:00
Greg Kroah-Hartman
7250956f6e Linux 4.19.61 2019-07-26 09:14:31 +02:00
Greg Kroah-Hartman
be9b6782a9 Linux 4.19.60 2019-07-21 09:03:18 +02:00
Greg Kroah-Hartman
3bd837bfe4 Linux 4.19.59 2019-07-14 08:11:23 +02:00
Greg Kroah-Hartman
7a6bfa08b9 Linux 4.19.58 2019-07-10 09:53:48 +02:00
Greg Kroah-Hartman
1a05924366 Linux 4.19.57 2019-07-03 13:14:50 +02:00
Greg Kroah-Hartman
aec3002d07 Linux 4.19.56 2019-06-25 11:36:02 +08:00
Linus Torvalds
76343a1363 gcc-9: silence 'address-of-packed-member' warning
commit 6f303d6053 upstream.

We already did this for clang, but now gcc has that warning too.  Yes,
yes, the address may be unaligned.  And that's kind of the point.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-25 11:35:52 +08:00
Greg Kroah-Hartman
7877807109 Linux 4.19.55 2019-06-22 11:23:18 +02:00