Commit graph

1253 commits

Author SHA1 Message Date
Greg Kroah-Hartman
0c73169690 Linux 4.4.152 2018-08-24 13:27:02 +02:00
Greg Kroah-Hartman
78f654f6cc Linux 4.4.151 2018-08-22 07:48:38 +02:00
Greg Kroah-Hartman
7dc18ebc31 Linux 4.4.150 2018-08-18 10:45:38 +02:00
Greg Kroah-Hartman
45cf1802a1 Linux 4.4.149 2018-08-17 20:56:45 +02:00
Andrey Konovalov
dcb852a7db kasan: don't emit builtin calls when sanitization is off
commit 0e410e158e5baa1300bdf678cea4f4e0cf9d8b94 upstream.

With KASAN enabled the kernel has two different memset() functions, one
with KASAN checks (memset) and one without (__memset).  KASAN uses some
macro tricks to use the proper version where required.  For example
memset() calls in mm/slub.c are without KASAN checks, since they operate
on poisoned slab object metadata.

The issue is that clang emits memset() calls even when there is no
memset() in the source code.  They get linked with improper memset()
implementation and the kernel fails to boot due to a huge amount of KASAN
reports during early boot stages.

The solution is to add -fno-builtin flag for files with KASAN_SANITIZE :=
n marker.

Link: http://lkml.kernel.org/r/8ffecfffe04088c52c42b92739c2bd8a0bcb3f5e.1516384594.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Nick Desaulniers <ndesaulniers@google.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ Nick : Backported to 4.4 avoiding KUBSAN ]
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-17 20:56:44 +02:00
Greg Kroah-Hartman
30a97c1e2d Linux 4.4.148 2018-08-15 17:42:11 +02:00
Greg Kroah-Hartman
8404ae6c8c Linux 4.4.147 2018-08-09 12:19:28 +02:00
Greg Kroah-Hartman
bffa1e42b3 Linux 4.4.146 2018-08-06 16:24:42 +02:00
Greg Kroah-Hartman
ac15b2b238 Linux 4.4.145 2018-07-28 07:45:05 +02:00
Arnd Bergmann
d41d0fe374 turn off -Wattribute-alias
Starting with gcc-8.1, we get a warning about all system call definitions,
which use an alias between functions with incompatible prototypes, e.g.:

In file included from ../mm/process_vm_access.c:19:
../include/linux/syscalls.h:211:18: warning: 'sys_process_vm_readv' alias between functions of incompatible types 'long int(pid_t,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)' {aka 'long int(int,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)'} and 'long int(long int,  long int,  long int,  long int,  long int,  long int)' [-Wattribute-alias]
  asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
                  ^~~
../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
  __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^~~~~~~~~~~~~~~~~
../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
 #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
                                    ^~~~~~~~~~~~~~~
../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
 SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,
 ^~~~~~~~~~~~~~~
../include/linux/syscalls.h:215:18: note: aliased declaration here
  asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
                  ^~~
../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
  __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^~~~~~~~~~~~~~~~~
../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
 #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
                                    ^~~~~~~~~~~~~~~
../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
 SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,

This is really noisy and does not indicate a real problem. In the latest
mainline kernel, this was addressed by commit bee20031772a ("disable
-Wattribute-alias warning for SYSCALL_DEFINEx()"), which seems too invasive
to backport.

This takes a much simpler approach and just disables the warning across the
kernel.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-28 07:45:04 +02:00
Greg Kroah-Hartman
762b585c49 Linux 4.4.144 2018-07-25 10:18:33 +02:00
Greg Kroah-Hartman
a8ea6276d0 Linux 4.4.143 2018-07-22 14:25:54 +02:00
Greg Kroah-Hartman
ecb9989751 Linux 4.4.142 2018-07-19 15:35:58 +02:00
Greg Kroah-Hartman
b3c6be58aa Linux 4.4.141 2018-07-17 11:31:46 +02:00
Greg Kroah-Hartman
d6bc7e610a Linux 4.4.140 2018-07-11 16:03:52 +02:00
Greg Kroah-Hartman
16af098616 Linux 4.4.139 2018-07-03 11:21:35 +02:00
Greg Kroah-Hartman
0bd2bedb35 Linux 4.4.138 2018-06-16 09:54:27 +02:00
Greg Kroah-Hartman
ed90fd0cfe Linux 4.4.137 2018-06-13 16:15:29 +02:00
Greg Kroah-Hartman
dc45cafe61 Linux 4.4.136 2018-06-06 16:46:24 +02:00
Greg Kroah-Hartman
50eb02ed89 Linux 4.4.135 2018-05-30 22:11:35 +02:00
Greg Kroah-Hartman
712a231848 Linux 4.4.134 2018-05-30 07:49:18 +02:00
Greg Kroah-Hartman
7620164e85 Linux 4.4.133 2018-05-26 08:49:01 +02:00
Greg Kroah-Hartman
69847b97f2 Linux 4.4.132 2018-05-16 10:06:53 +02:00
Greg Kroah-Hartman
8719027e78 Linux 4.4.131 2018-05-02 07:53:43 -07:00
Greg Kroah-Hartman
34a220d573 Linux 4.4.130 2018-04-29 07:50:07 +02:00
Greg Kroah-Hartman
8e2def054b Linux 4.4.129 2018-04-24 09:32:12 +02:00
Greg Kroah-Hartman
dbb7876236 Linux 4.4.128 2018-04-13 19:50:28 +02:00
Greg Kroah-Hartman
2cad7a1d13 Linux 4.4.127 2018-04-08 11:52:02 +02:00
Greg Kroah-Hartman
8ff8cb8ec2 Linux 4.4.126 2018-03-31 18:12:35 +02:00
Greg Kroah-Hartman
aec8e72ebd Linux 4.4.125 2018-03-28 18:40:17 +02:00
Daniel Borkmann
cbb5420a2f kbuild: disable clang's default use of -fmerge-all-constants
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-28 18:40:17 +02:00
Greg Kroah-Hartman
b766b14a48 Linux 4.4.124 2018-03-24 10:58:49 +01:00
Greg Kroah-Hartman
3753696b0a Linux 4.4.123 2018-03-22 09:23:32 +01:00
Greg Kroah-Hartman
b8ea1f9b32 Linux 4.4.122 2018-03-18 11:17:54 +01:00
Greg Kroah-Hartman
8b5ab55d25 Linux 4.4.121 2018-03-11 16:19:47 +01:00
Greg Kroah-Hartman
47356cfded Linux 4.4.120 2018-03-03 10:19:46 +01:00
Greg Kroah-Hartman
5e0c4113fc Linux 4.4.119 2018-02-28 10:17:24 +01:00
Greg Kroah-Hartman
37428a8003 Linux 4.4.118 2018-02-25 11:03:55 +01:00
Josh Poimboeuf
c6ce3e85ac tools build: Add tools tree support for 'make -s'
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-25 11:03:43 +01:00
Greg Kroah-Hartman
e9fd3d16de Linux 4.4.117 2018-02-22 15:45:02 +01:00
Greg Kroah-Hartman
0f48bd7cf0 Linux 4.4.116 2018-02-16 20:09:48 +01:00
Greg Kroah-Hartman
f0feeec9c2 Linux 4.4.115 2018-02-03 17:04:31 +01:00
Greg Kroah-Hartman
49fe90b853 Linux 4.4.114 2018-01-31 12:06:14 +01:00
Greg Kroah-Hartman
f0d0a93b0e Linux 4.4.113 2018-01-23 19:50:18 +01:00
Greg Kroah-Hartman
42375c1120 Linux 4.4.112 2018-01-17 09:35:33 +01:00
Greg Kroah-Hartman
c5ae3a6aa1 Linux 4.4.111 2018-01-10 09:27:15 +01:00
Greg Kroah-Hartman
b3e3db15b4 Linux 4.4.110 2018-01-05 15:44:27 +01:00
Greg Kroah-Hartman
e68d6189c7 Linux 4.4.109 2018-01-02 20:33:28 +01:00
Linus Torvalds
1cd09d4b38 kbuild: add '-fno-stack-check' to kernel build options
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>
2018-01-02 20:33:24 +01:00
Greg Kroah-Hartman
03028e068a Linux 4.4.108 2017-12-25 14:22:16 +01:00