Commit Graph

1506 Commits

Author SHA1 Message Date
Greg Kroah-Hartman
e0f8b8a65a Linux 4.14.170 2020-02-05 14:18:29 +00:00
Greg Kroah-Hartman
9fa690a2a0 Linux 4.14.169 2020-01-29 15:02:39 +01:00
Greg Kroah-Hartman
9a95f25269 Linux 4.14.168 2020-01-27 14:46:54 +01:00
Masahiro Yamada
f3691b5e7d 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:46:13 +01:00
Greg Kroah-Hartman
8bac50406c Linux 4.14.167 2020-01-23 08:20:37 +01:00
Greg Kroah-Hartman
c1141b3aab Linux 4.14.166 2020-01-17 19:45:55 +01:00
Greg Kroah-Hartman
c04fc6fa5c Linux 4.14.165 2020-01-14 20:05:49 +01:00
Greg Kroah-Hartman
6d0c334a40 Linux 4.14.164 2020-01-12 12:12:09 +01:00
Greg Kroah-Hartman
b0cdffaa54 Linux 4.14.163 2020-01-09 10:18:00 +01:00
Greg Kroah-Hartman
84f5ad4681 Linux 4.14.162 2020-01-04 14:00:23 +01:00
Greg Kroah-Hartman
4c5bf01e16 Linux 4.14.161 2019-12-31 12:38:09 +01:00
Greg Kroah-Hartman
e1f7d50ae3 Linux 4.14.160 2019-12-21 10:47:56 +01:00
Greg Kroah-Hartman
bfb9e5c030 Linux 4.14.159 2019-12-17 20:40:05 +01:00
Masahiro Yamada
a87bd630bc 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-17 20:38:31 +01:00
Greg Kroah-Hartman
a844dc4c54 Linux 4.14.158 2019-12-05 15:38:36 +01:00
Greg Kroah-Hartman
fbc5fe7a54 Linux 4.14.157 2019-12-01 09:14:37 +01:00
Greg Kroah-Hartman
43598c571e Linux 4.14.156 2019-11-24 08:23:35 +01:00
Greg Kroah-Hartman
f56f3d0e65 Linux 4.14.155 2019-11-20 18:00:54 +01:00
Greg Kroah-Hartman
775d01b65b Linux 4.14.154 2019-11-12 19:19:08 +01:00
Greg Kroah-Hartman
4762bcd451 Linux 4.14.153 2019-11-10 11:25:43 +01:00
Seth Forshee
2103cc67db 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:25:39 +01:00
Masahiro Yamada
b125188db9 kbuild: use -fmacro-prefix-map to make __FILE__ a relative path
[ Upstream commit a73619a845 ]

The __FILE__ macro is used everywhere in the kernel to locate the file
printing the log message, such as WARN_ON(), etc.  If the kernel is
built out of tree, this can be a long absolute path, like this:

  WARNING: CPU: 1 PID: 1 at /path/to/build/directory/arch/arm64/kernel/foo.c:...

This is because Kbuild runs in the objtree instead of the srctree,
then __FILE__ is expanded to a file path prefixed with $(srctree)/.

Commit 9da0763bdd ("kbuild: Use relative path when building in a
subdir of the source tree") improved this to some extent; $(srctree)
becomes ".." if the objtree is a child of the srctree.

For other cases of out-of-tree build, __FILE__ is still the absolute
path.  It also means the kernel image depends on where it was built.

A brand-new option from GCC, -fmacro-prefix-map, solves this problem.
If your compiler supports it, __FILE__ is the relative path from the
srctree regardless of O= option.  This provides more readable log and
more reproducible builds.

Please note __FILE__ is always an absolute path for external modules.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-11-10 11:25:38 +01:00
Greg Kroah-Hartman
c9fda4f224 Linux 4.14.152 2019-11-06 12:43:42 +01:00
Greg Kroah-Hartman
ddef1e8e3f Linux 4.14.151 2019-10-29 09:17:49 +01:00
Greg Kroah-Hartman
b98aebd298 Linux 4.14.150 2019-10-17 13:44:04 -07:00
Greg Kroah-Hartman
e132c8d7b5 Linux 4.14.149 2019-10-11 18:18:50 +02:00
Greg Kroah-Hartman
42327896f1 Linux 4.14.148 2019-10-07 18:55:23 +02:00
Greg Kroah-Hartman
db1892238c Linux 4.14.147 2019-10-05 12:48:14 +02:00
Rolf Eike Beer
21b50a160d objtool: Query pkg-config for libelf location
commit 056d28d135 upstream.

If it is not in the default location, compilation fails at several points.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/91a25e992566a7968fedc89ec80e7f4c83ad0548.1553622500.git.jpoimboe@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-05 12:47:32 +02:00
Greg Kroah-Hartman
f6e27dbb1a Linux 4.14.146 2019-09-21 07:15:48 +02:00
Greg Kroah-Hartman
b10ab5e2c4 Linux 4.14.145 2019-09-19 09:08:09 +02:00
Greg Kroah-Hartman
968722f537 Linux 4.14.144 2019-09-16 08:20:46 +02:00
Greg Kroah-Hartman
e2cd24b629 Linux 4.14.143 2019-09-10 10:32:22 +01:00
Greg Kroah-Hartman
414510bc00 Linux 4.14.142 2019-09-06 10:21:01 +02:00
Greg Kroah-Hartman
01fd1694b9 Linux 4.14.141 2019-08-29 08:26:46 +02:00
Greg Kroah-Hartman
b526080152 Linux 4.14.140 2019-08-25 10:50:29 +02:00
Greg Kroah-Hartman
45f092f9e9 Linux 4.14.139 2019-08-16 10:13:59 +02:00
Greg Kroah-Hartman
3ffe1e79c1 Linux 4.14.138 2019-08-09 17:53:37 +02:00
Greg Kroah-Hartman
b19ffe6e72 Linux 4.14.137 2019-08-06 19:05:30 +02:00
Masahiro Yamada
3e1332cfb4 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:05:25 +02:00
Greg Kroah-Hartman
7d80e1218a Linux 4.14.136 2019-08-04 09:32:04 +02:00
Greg Kroah-Hartman
10d6aa565d Linux 4.14.135 2019-07-31 07:28:59 +02:00
Nathan Chancellor
89567efefe 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:28:52 +02:00
Greg Kroah-Hartman
ff33472c28 Linux 4.14.134 2019-07-21 09:04:43 +02:00
Greg Kroah-Hartman
aea8526edf Linux 4.14.133 2019-07-10 09:54:43 +02:00
Greg Kroah-Hartman
e3c1b27308 Linux 4.14.132 2019-07-03 13:16:04 +02:00
Greg Kroah-Hartman
f4cc0ed9b2 Linux 4.14.131 2019-06-27 08:15:09 +08:00
Greg Kroah-Hartman
bc2bccef19 Linux 4.14.130 2019-06-25 11:36:55 +08:00
Linus Torvalds
8e69458509 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:36:50 +08:00
Greg Kroah-Hartman
a5758c5311 Linux 4.14.129 2019-06-22 08:16:19 +02:00