Re: [PATCH 03/24] alpha: select ARCH_HAS_UBSAN

From: Michael Cree

Date: Fri Sep 04 2026 - 16:51:53 EST


On Wed, Sep 02, 2026 at 12:34:50AM +0200, Magnus Lindholm wrote:
> On Tue, Sep 1, 2026 at 5:50 PM Matt Turner <mattst88@xxxxxxxxx> wrote:
> >
> > GCC's undefined behavior sanitizer has no architecture-specific runtime
> > requirements. Enable it for Alpha to allow UBSAN instrumentation of the
> > kernel.
> >
> I tested this patch on top of my rebased Alpha GENERIC_ENTRY patch on an
> AlphaServer ES40. The kernel built and booted successfully with
> CONFIG_UBSAN=y, and the UBSAN instrumentation is active.

So have I, on an XP1000 and ES45.

> CONFIG_UBSAN_ALIGNMENT did expose a misaligned struct bucket_table
> allocation in lib/rhashtable.c. This appears to be a generic rhashtable
> allocation-alignment issue rather than an Alpha UBSAN problem.

But in my case the kernel vomited copious misaligned access reports,
so many that it took quite a few minutes to boot and I lost much of
the kernel log before disks were mounted. A few examples that
were recorded later in the boot on the ES45:

Sep 03 21:12:36 electro kernel: UBSAN: misaligned-access in net/core/dev.c:1401:2
Sep 03 21:12:36 electro kernel: member access within misaligned address (____ptrval____) for type 'struct net_device'
Sep 03 21:12:36 electro kernel: which requires 64 byte alignment

Sep 03 21:12:36 electro kernel: UBSAN: misaligned-access in kernel/signal.c:4362:4
Sep 03 21:12:36 electro kernel: member access within misaligned address 0000000058e1e939 for type 'struct task_struct'
Sep 03 21:12:36 electro kernel: which requires 64 byte alignment

Sep 03 21:13:04 electro kernel: UBSAN: misaligned-access in drivers/net/ethernet/intel/e100.c:1941:36
Sep 03 21:13:04 electro kernel: member access within misaligned address 000000001c866fa6 for type 'struct rfd'
Sep 03 21:13:04 electro kernel: which requires 4 byte alignment

Interestingly "kernel unaligned acc" in /proc/cpuinfo remained at
zero, which really makes me wonder whether these reports are all
false-positives.

This kernel was cross-compiled with: "alpha-linux-gnu-gcc (Debian
14.2.0-19)"

Cheers,
Michael.