Re: [PROBLEM linux-next] include/linux/fortify-string.h:580:25: error: call to ‘__read_overflow2_field’ declared with attribute warning: detected read beyond size of field

From: Kees Cook
Date: Sun Jul 07 2024 - 11:22:19 EST




On July 6, 2024 5:26:25 PM PDT, Mirsad Todorovac <mtodorovac69@xxxxxxxxx> wrote:
>Hi, all!
>
>This is the result of testing randconfig with KCONFIG_SEED=0xEE7AB52F in next-20240703 vanilla tree on
>Ubuntu 22.04 LTS. GCC used is gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0.
>
>The particular error is as follows:
>
>In file included from ./include/linux/string.h:374,
> from ./arch/x86/include/asm/page_32.h:18,
> from ./arch/x86/include/asm/page.h:14,
> from ./arch/x86/include/asm/processor.h:20,
> from ./include/linux/sched.h:13,
> from ./include/linux/audit.h:12,
> from kernel/seccomp.c:19:
>In function ‘fortify_memcpy_chk’,
> inlined from ‘syscall_get_arguments’ at ./arch/x86/include/asm/syscall.h:85:2,

memcpy(args, &regs->bx, 6 * sizeof(args[0]));

Yup, this reads from regs starting at bx, rather than only bx. I will send to patch to expand it (like is done for compat mode a few lines later).

-Kees

--
Kees Cook