alistair23-linux/arch/arm64
Nick Desaulniers a194c33f45 arm64: acpi: fix UBSAN warning
Will reported a UBSAN warning:

UBSAN: null-ptr-deref in arch/arm64/kernel/smp.c:596:6
member access within null pointer of type 'struct acpi_madt_generic_interrupt'
CPU: 0 PID: 0 Comm: swapper Not tainted 5.7.0-rc6-00124-g96bc42ff0a82 #1
Call trace:
 dump_backtrace+0x0/0x384
 show_stack+0x28/0x38
 dump_stack+0xec/0x174
 handle_null_ptr_deref+0x134/0x174
 __ubsan_handle_type_mismatch_v1+0x84/0xa4
 acpi_parse_gic_cpu_interface+0x60/0xe8
 acpi_parse_entries_array+0x288/0x498
 acpi_table_parse_entries_array+0x178/0x1b4
 acpi_table_parse_madt+0xa4/0x110
 acpi_parse_and_init_cpus+0x38/0x100
 smp_init_cpus+0x74/0x258
 setup_arch+0x350/0x3ec
 start_kernel+0x98/0x6f4

This is from the use of the ACPI_OFFSET in
arch/arm64/include/asm/acpi.h. Replace its use with offsetof from
include/linux/stddef.h which should implement the same logic using
__builtin_offsetof, so that UBSAN wont warn.

Reported-by: Will Deacon <will@kernel.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/20200521100952.GA5360@willie-the-truck/
Link: https://lore.kernel.org/r/20200608203818.189423-1-ndesaulniers@google.com
Signed-off-by: Will Deacon <will@kernel.org>
2020-06-10 11:41:08 +01:00
..
boot ARM: devicetree updates for v5.7 2020-04-03 15:22:05 -07:00
configs ARM: defconfig updates 2020-04-03 15:15:10 -07:00
crypto SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
include arm64: acpi: fix UBSAN warning 2020-06-10 11:41:08 +01:00
kernel arm64: vdso32: add CONFIG_THUMB2_COMPAT_VDSO 2020-06-10 11:38:56 +01:00
kvm Merge branch 'for-next/kvm/errata' into for-next/core 2020-05-28 18:02:51 +01:00
lib arm64: Reorder the macro arguments in the copy routines 2020-04-29 21:50:01 +01:00
mm Merge branch 'for-next/scs' into for-next/core 2020-05-28 18:03:40 +01:00
net Merge branch 'for-next/bti' into for-next/core 2020-05-28 18:00:51 +01:00
xen
Kbuild
Kconfig arm64: vdso32: add CONFIG_THUMB2_COMPAT_VDSO 2020-06-10 11:38:56 +01:00
Kconfig.debug arm64: remove CONFIG_DEBUG_ALIGN_RODATA feature 2020-04-01 21:44:43 +01:00
Kconfig.platforms ARM: SoC updates 2020-04-03 15:02:35 -07:00
Makefile Merge branch 'for-next/scs' into for-next/core 2020-05-28 18:03:40 +01:00