Re: [PATCH -next] x86/apic: Force logial APIC ID in range from 0 to 8

From: Thomas Gleixner
Date: Fri Apr 23 2021 - 04:37:33 EST


On Fri, Apr 23 2021 at 15:53, Xu Yihang wrote:
> According to Intel 64 and IA-32 Architectures Software Developer’s Manuals
> Vol. 3A 10.6.2.2, Logical APIC ID locates on bit 24 to 31, can only
> support up to 8 local APIC under flat mode. Also C99 says left shift exceeding
> maximum value representable in the result type is undefined behavior. But
> under x86 architecture, it seems doesn't do any actual damage.
>
> There is KASAN warning on a 80 cores machine after booting #64 CPU.
> ```
> [ 1.681097] UBSAN: Undefined behaviour in arch/x86/kernel/apic/apic_flat_64.c:51:11
> [ 1.688739] shift exponent 64 is too large for 64-bit type 'long unsigned int'
> ```

This function should not be invoked on a 80 core machine at all.

Can you please add 'apic=verbose' to the kernel command line and provide
a full boot log?

Thanks,

tglx