]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
lib/ubsan: add type mismatch handler for new GCC/Clang
authorAndrey Ryabinin <aryabinin@virtuozzo.com>
Tue, 6 Feb 2018 23:40:42 +0000 (15:40 -0800)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 22 Feb 2018 14:21:54 +0000 (08:21 -0600)
commit883a671efd1d83267b0b512533045d65d76a086a
tree7dab7b23ec0303ea177a9658ef80761071ad6c1c
parent13f5ab81fe4691fba83000e25cb325720e24f52b
lib/ubsan: add type mismatch handler for new GCC/Clang

BugLink: http://bugs.launchpad.net/bugs/1751064
commit 42440c1f9911b4b7b8ba3dc4e90c1197bc561211 upstream.

UBSAN=y fails to build with new GCC/clang:

    arch/x86/kernel/head64.o: In function `sanitize_boot_params':
    arch/x86/include/asm/bootparam_utils.h:37: undefined reference to `__ubsan_handle_type_mismatch_v1'

because Clang and GCC 8 slightly changed ABI for 'type mismatch' errors.
Compiler now uses new __ubsan_handle_type_mismatch_v1() function with
slightly modified 'struct type_mismatch_data'.

Let's add new 'struct type_mismatch_data_common' which is independent from
compiler's layout of 'struct type_mismatch_data'.  And make
__ubsan_handle_type_mismatch[_v1]() functions transform compiler-dependent
type mismatch data to our internal representation.  This way, we can
support both old and new compilers with minimal amount of change.

Link: http://lkml.kernel.org/r/20180119152853.16806-1-aryabinin@virtuozzo.com
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reported-by: Sodagudi Prasad <psodagud@codeaurora.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
lib/ubsan.c
lib/ubsan.h