Skip to content

__read_overflow not eliminated in lib/fortify_kunit.c after 47f4af43e7c0cf702d6a6321542f0c0d9c4216e3 #2075

Description

@nathanchance

I see a build failure in the fortify KUnit tests after commit 47f4af43e7c0 ("ubsan/overflow: Enable ignorelist parsing and add type filter"). I originally noticed this in Fedora's configuration, which does disable the signed wrap configuration but since the rename, it gets turned back on. Minimized on top of virtconfig for ARCH=arm64:

$ cat kernel/configs/repro.config
CONFIG_FORTIFY_SOURCE=y
CONFIG_KUNIT=m
CONFIG_FORTIFY_KUNIT_TEST=m
CONFIG_UBSAN=y
# CONFIG_UBSAN_BOUNDS is not set
# CONFIG_UBSAN_SHIFT is not set
# CONFIG_UBSAN_DIV_ZERO is not set
# CONFIG_UBSAN_UNREACHABLE is not set
CONFIG_UBSAN_INTEGER_WRAP=y
# CONFIG_UBSAN_BOOL is not set
# CONFIG_UBSAN_ENUM is not set
# CONFIG_UBSAN_ALIGNMENT is not set

$ make -skj"$(nproc)" ARCH=arm64 LLVM=1 mrproper virtconfig repro.config lib/fortify_kunit.o
In file included from lib/fortify_kunit.c:43:
In file included from include/kunit/device.h:16:
In file included from include/kunit/test.h:22:
In file included from include/linux/kref.h:16:
In file included from include/linux/spinlock.h:59:
In file included from include/linux/irqflags.h:18:
In file included from arch/arm64/include/asm/irqflags.h:9:
In file included from arch/arm64/include/asm/ptrace.h:11:
In file included from arch/arm64/include/asm/cpufeature.h:27:
In file included from include/linux/cpumask.h:12:
In file included from include/linux/bitmap.h:13:
In file included from include/linux/string.h:392:
include/linux/fortify-string.h:719:4: error: call to '__read_overflow' declared with 'error' attribute: detected read beyond size of object (1st parameter)
  719 |                         __read_overflow();
      |                         ^
1 error generated.

I see this with LLVM 20.1.0 and tip of tree.

cc @kees @JustinStitt

Metadata

Metadata

Assignees

Labels

[BUG] linux-nextThis is an issue only seen in linux-next[WORKAROUND] AppliedThis bug has an applied workaround

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions