Re: linux-next: build failure after merge of the kspp tree

Kees Cook
2023-01-05T03:22:19Z

On Thu, Jan 05, 2023 at 01:25:35PM +1100, Stephen Rothwell wrote:
> Hi all,
>
> After merging the kspp tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> In file included from include/linux/string.h:253,
> from include/linux/bitmap.h:11,
> from include/linux/cpumask.h:12,
> from arch/x86/include/asm/paravirt.h:17,
> from arch/x86/include/asm/cpuid.h:62,
> from arch/x86/include/asm/processor.h:19,
> from arch/x86/include/asm/cpufeature.h:5,
> from arch/x86/include/asm/thread_info.h:53,
> from include/linux/thread_info.h:60,
> from arch/x86/include/asm/preempt.h:9,
> from include/linux/preempt.h:78,
> from include/linux/percpu.h:6,
> from include/linux/prandom.h:13,
> from include/linux/random.h:153,
> from include/linux/net.h:18,
> from net/rxrpc/output.c:10:
> In function 'fortify_memcpy_chk',
> inlined from 'rxrpc_fill_out_ack' at net/rxrpc/output.c:158:2:
> include/linux/fortify-string.h:520:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
> 520 | __write_overflow_field(p_size_field, size);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Exposed by commit
>
> f7cd05c76c70 ("fortify: Use __builtin_dynamic_object_size() when available")

Oh! I'm not sure how I missed that in test builds.

> I applied the following patch.
>
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Thu, 5 Jan 2023 12:56:39 +1100
> Subject: [PATCH] rxrpc: replace zero-lenth array with DECLARE_FLEX_ARRAY() helper
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
> net/rxrpc/ar-internal.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
> index 18092526d3c8..c7186484fc5f 100644
> --- a/net/rxrpc/ar-internal.h
> +++ b/net/rxrpc/ar-internal.h
> @@ -783,7 +783,7 @@ struct rxrpc_txbuf {
> u8 data[RXRPC_JUMBO_DATALEN]; /* Data packet */
> struct {
> struct rxrpc_ackpacket ack;
> - u8 acks[0];
> + DECLARE_FLEX_ARRAY(u8, acks);
> };
> };
> } __aligned(64);

Yes, that looks entirely correct. Are you sending that separately, or
should I carry it in my tree?

Thanks!

-Kees

--
Kees Cook