Re: 6.1rc1: NFS memcpy warning on mount

From: Kees Cook
Date: Mon Oct 17 2022 - 00:59:39 EST


On Sun, Oct 16, 2022 at 10:58:21PM -0400, Dave Jones wrote:
> [ 19.617475] memcpy: detected field-spanning write (size 28) of single field "request.sap" at fs/nfs/super.c:857 (size 18446744073709551615)

I've sent this, which should fix it:
https://lore.kernel.org/lkml/20221017043107.never.457-kees@xxxxxxxxxx/

However, the -1 size tells me something has gone slightly wrong with the
runtime warning, as it _should_ be ignoring destinations with "unknown"
size -- in this case, struct sockaddr has a trailing array, which is
treated (currently) as a fake flexible array, so __builtin_object_size()
is reporting the "-1". But with the coming -fstrict-flex-arrays, this
will need fixing anyway. I will re-check the runtime warning logic...

--
Kees Cook