summaryrefslogtreecommitdiff
path: root/Makefile
AgeCommit message (Collapse)Author
2018-03-28Linux 4.9.91v4.9.91Greg Kroah-Hartman
2018-03-28kbuild: disable clang's default use of -fmerge-all-constantsDaniel Borkmann
commit 87e0d4f0f37fb0c8c4aeeac46fff5e957738df79 upstream. Prasad reported that he has seen crashes in BPF subsystem with netd on Android with arm64 in the form of (note, the taint is unrelated): [ 4134.721483] Unable to handle kernel paging request at virtual address 800000001 [ 4134.820925] Mem abort info: [ 4134.901283] Exception class = DABT (current EL), IL = 32 bits [ 4135.016736] SET = 0, FnV = 0 [ 4135.119820] EA = 0, S1PTW = 0 [ 4135.201431] Data abort info: [ 4135.301388] ISV = 0, ISS = 0x00000021 [ 4135.359599] CM = 0, WnR = 0 [ 4135.470873] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffe39b946000 [ 4135.499757] [0000000800000001] *pgd=0000000000000000, *pud=0000000000000000 [ 4135.660725] Internal error: Oops: 96000021 [#1] PREEMPT SMP [ 4135.674610] Modules linked in: [ 4135.682883] CPU: 5 PID: 1260 Comm: netd Tainted: G S W 4.14.19+ #1 [ 4135.716188] task: ffffffe39f4aa380 task.stack: ffffff801d4e0000 [ 4135.731599] PC is at bpf_prog_add+0x20/0x68 [ 4135.741746] LR is at bpf_prog_inc+0x20/0x2c [ 4135.751788] pc : [<ffffff94ab7ad584>] lr : [<ffffff94ab7ad638>] pstate: 60400145 [ 4135.769062] sp : ffffff801d4e3ce0 [...] [ 4136.258315] Process netd (pid: 1260, stack limit = 0xffffff801d4e0000) [ 4136.273746] Call trace: [...] [ 4136.442494] 3ca0: ffffff94ab7ad584 0000000060400145 ffffffe3a01bf8f8 0000000000000006 [ 4136.460936] 3cc0: 0000008000000000 ffffff94ab844204 ffffff801d4e3cf0 ffffff94ab7ad584 [ 4136.479241] [<ffffff94ab7ad584>] bpf_prog_add+0x20/0x68 [ 4136.491767] [<ffffff94ab7ad638>] bpf_prog_inc+0x20/0x2c [ 4136.504536] [<ffffff94ab7b5d08>] bpf_obj_get_user+0x204/0x22c [ 4136.518746] [<ffffff94ab7ade68>] SyS_bpf+0x5a8/0x1a88 Android's netd was basically pinning the uid cookie BPF map in BPF fs (/sys/fs/bpf/traffic_cookie_uid_map) and later on retrieving it again resulting in above panic. Issue is that the map was wrongly identified as a prog! Above kernel was compiled with clang 4.0, and it turns out that clang decided to merge the bpf_prog_iops and bpf_map_iops into a single memory location, such that the two i_ops could then not be distinguished anymore. Reason for this miscompilation is that clang has the more aggressive -fmerge-all-constants enabled by default. In fact, clang source code has a comment about it in lib/AST/ExprConstant.cpp on why it is okay to do so: Pointers with different bases cannot represent the same object. (Note that clang defaults to -fmerge-all-constants, which can lead to inconsistent results for comparisons involving the address of a constant; this generally doesn't matter in practice.) The issue never appeared with gcc however, since gcc does not enable -fmerge-all-constants by default and even *explicitly* states in it's option description that using this flag results in non-conforming behavior, quote from man gcc: Languages like C or C++ require each variable, including multiple instances of the same variable in recursive calls, to have distinct locations, so using this option results in non-conforming behavior. There are also various clang bug reports open on that matter [1], where clang developers acknowledge the non-conforming behavior, and refer to disabling it with -fno-merge-all-constants. But even if this gets fixed in clang today, there are already users out there that triggered this. Thus, fix this issue by explicitly adding -fno-merge-all-constants to the kernel's Makefile to generically disable this optimization, since potentially other places in the kernel could subtly break as well. Note, there is also a flag called -fmerge-constants (not supported by clang), which is more conservative and only applies to strings and it's enabled in gcc's -O/-O2/-O3/-Os optimization levels. In gcc's code, the two flags -fmerge-{all-,}constants share the same variable internally, so when disabling it via -fno-merge-all-constants, then we really don't merge any const data (e.g. strings), and text size increases with gcc (14,927,214 -> 14,942,646 for vmlinux.o). $ gcc -fverbose-asm -O2 foo.c -S -o foo.S -> foo.S lists -fmerge-constants under options enabled $ gcc -fverbose-asm -O2 -fno-merge-all-constants foo.c -S -o foo.S -> foo.S doesn't list -fmerge-constants under options enabled $ gcc -fverbose-asm -O2 -fno-merge-all-constants -fmerge-constants foo.c -S -o foo.S -> foo.S lists -fmerge-constants under options enabled Thus, as a workaround we need to set both -fno-merge-all-constants *and* -fmerge-constants in the Makefile in order for text size to stay as is. [1] https://bugs.llvm.org/show_bug.cgi?id=18538 Reported-by: Prasad Sodagudi <psodagud@codeaurora.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Chenbo Feng <fengc@google.com> Cc: Richard Smith <richard-llvm@metafoo.co.uk> Cc: Chandler Carruth <chandlerc@gmail.com> Cc: linux-kernel@vger.kernel.org Tested-by: Prasad Sodagudi <psodagud@codeaurora.org> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-24Linux 4.9.90v4.9.90Greg Kroah-Hartman
2018-03-22Linux 4.9.89v4.9.89Greg Kroah-Hartman
2018-03-18Linux 4.9.88v4.9.88Greg Kroah-Hartman
2018-03-11Linux 4.9.87v4.9.87Greg Kroah-Hartman
2018-03-03Linux 4.9.86v4.9.86Greg Kroah-Hartman
2018-02-28Linux 4.9.85v4.9.85Greg Kroah-Hartman
2018-02-25Linux 4.9.84v4.9.84Greg Kroah-Hartman
2018-02-25tools build: Add tools tree support for 'make -s'Josh Poimboeuf
commit e572d0887137acfc53f18175522964ec19d88175 upstream. When doing a kernel build with 'make -s', everything is silenced except the objtool build. That's because the tools tree support for silent builds is some combination of missing and broken. Three changes are needed to fix it: - Makefile: propagate '-s' to the sub-make's MAKEFLAGS variable so the tools Makefiles can see it. - tools/scripts/Makefile.include: fix the tools Makefiles' ability to recognize '-s'. The MAKE_VERSION and MAKEFLAGS checks are copied from the top-level Makefile. This silences the "DESCEND objtool" message. - tools/build/Makefile.build: add support to the tools Build files for recognizing '-s'. Again the MAKE_VERSION and MAKEFLAGS checks are copied from the top-level Makefile. This silences all the object compile/link messages. Reported-and-Tested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Michal Marek <mmarek@suse.com> Link: http://lkml.kernel.org/r/e8967562ef640c3ae9a76da4ae0f4e47df737c34.1484799200.git.jpoimboe@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22Linux 4.9.83v4.9.83Greg Kroah-Hartman
2018-02-17Linux 4.9.82v4.9.82Greg Kroah-Hartman
2018-02-13Linux 4.9.81v4.9.81Greg Kroah-Hartman
2018-02-03Linux 4.9.80v4.9.80Greg Kroah-Hartman
2018-01-31Linux 4.9.79v4.9.79Greg Kroah-Hartman
2018-01-23Linux 4.9.78v4.9.78Greg Kroah-Hartman
2018-01-17Linux 4.9.77v4.9.77Greg Kroah-Hartman
2018-01-10Linux 4.9.76v4.9.76Greg Kroah-Hartman
2018-01-05Linux 4.9.75v4.9.75Greg Kroah-Hartman
2018-01-02Linux 4.9.74v4.9.74Greg Kroah-Hartman
2018-01-02kbuild: add '-fno-stack-check' to kernel build optionsLinus Torvalds
commit 3ce120b16cc548472f80cf8644f90eda958cf1b6 upstream. It appears that hardened gentoo enables "-fstack-check" by default for gcc. That doesn't work _at_all_ for the kernel, because the kernel stack doesn't act like a user stack at all: it's much smaller, and it doesn't auto-expand on use. So the extra "probe one page below the stack" code generated by -fstack-check just breaks the kernel in horrible ways, causing infinite double faults etc. [ I have to say, that the particular code gcc generates looks very stupid even for user space where it works, but that's a separate issue. ] Reported-and-tested-by: Alexander Tsoy <alexander@tsoy.me> Reported-and-tested-by: Toralf Förster <toralf.foerster@gmx.de> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Jiri Kosina <jikos@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-29Linux 4.9.73v4.9.73Greg Kroah-Hartman
2017-12-25Linux 4.9.72v4.9.72Greg Kroah-Hartman
2017-12-20Linux 4.9.71v4.9.71Greg Kroah-Hartman
2017-12-16Linux 4.9.70v4.9.70Greg Kroah-Hartman
2017-12-16kbuild: do not call cc-option before KBUILD_CFLAGS initializationMasahiro Yamada
[ Upstream commit 433dc2ebe7d17dd21cba7ad5c362d37323592236 ] Some $(call cc-option,...) are invoked very early, even before KBUILD_CFLAGS, etc. are initialized. The returned string from $(call cc-option,...) depends on KBUILD_CPPFLAGS, KBUILD_CFLAGS, and GCC_PLUGINS_CFLAGS. Since they are exported, they are not empty when the top Makefile is recursively invoked. The recursion occurs in several places. For example, the top Makefile invokes itself for silentoldconfig. "make tinyconfig", "make rpm-pkg" are the cases, too. In those cases, the second call of cc-option from the same line runs a different shell command due to non-pristine KBUILD_CFLAGS. To get the same result all the time, KBUILD_* and GCC_PLUGINS_CFLAGS must be initialized before any call of cc-option. This avoids garbage data in the .cache.mk file. Move all calls of cc-option below the config targets because target compiler flags are unnecessary for Kconfig. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-14Linux 4.9.69v4.9.69Greg Kroah-Hartman
2017-12-09Linux 4.9.68v4.9.68Greg Kroah-Hartman
2017-12-05Linux 4.9.67v4.9.67Greg Kroah-Hartman
2017-11-30Linux 4.9.66v4.9.66Greg Kroah-Hartman
2017-11-24Linux 4.9.65v4.9.65Greg Kroah-Hartman
2017-11-21Linux 4.9.64v4.9.64Greg Kroah-Hartman
2017-11-18Linux 4.9.63v4.9.63Greg Kroah-Hartman
2017-11-15Linux 4.9.62v4.9.62Greg Kroah-Hartman
2017-11-08Linux 4.9.61v4.9.61Greg Kroah-Hartman
2017-11-02Linux 4.9.60v4.9.60Greg Kroah-Hartman
2017-10-27Linux 4.9.59v4.9.59Greg Kroah-Hartman
2017-10-21Linux 4.9.58v4.9.58Greg Kroah-Hartman
2017-10-18Linux 4.9.57v4.9.57Greg Kroah-Hartman
2017-10-12Linux 4.9.56v4.9.56Greg Kroah-Hartman
2017-10-12Linux 4.9.55v4.9.55Greg Kroah-Hartman
2017-10-08Linux 4.9.54v4.9.54Greg Kroah-Hartman
2017-10-05Linux 4.9.53v4.9.53Greg Kroah-Hartman
2017-09-27Linux 4.9.52v4.9.52Greg Kroah-Hartman
2017-09-20Linux 4.9.51v4.9.51Greg Kroah-Hartman
2017-09-13Linux 4.9.50v4.9.50Greg Kroah-Hartman
2017-09-10Linux 4.9.49v4.9.49Greg Kroah-Hartman
2017-09-07Linux 4.9.48v4.9.48Greg Kroah-Hartman
2017-09-02Linux 4.9.47v4.9.47Greg Kroah-Hartman
2017-08-30Linux 4.9.46v4.9.46Greg Kroah-Hartman