From: Stephen Rothwell <hidden> Date: 2025-02-27 01:38:13
Hi Venkat,
CC Kees Cook for advice. This is a result of the tests added in commit
bbeb38b8487a ("string.h: Validate memtostr*()/strtomem*() arguments more carefully")
from the kspp tree.
I note that the comment about memtostr() says "Copy a possibly
non-NUL-term string".
On Thu, 27 Feb 2025 06:30:12 +0530 Venkat Rao Bagalkote [off-list ref] wrote:
I am seeing build failures with kernel next-20250226, on IBM Power8 systems.
Failures:
In file included from ./include/asm-generic/div64.h:27,
from ./arch/powerpc/include/generated/asm/div64.h:1,
from ./include/linux/math.h:6,
from ./include/linux/math64.h:6,
from ./include/linux/time.h:6,
from fs/ext4/file.c:22:
fs/ext4/file.c: In function 'ext4_sample_last_mounted':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:418:6: note: in expansion of macro '__must_be_noncstr'
__must_be_noncstr(dest) + \
^~~~~~~~~~~~~~~~~
fs/ext4/file.c:869:2: note: in expansion of macro 'strtomem_pad'
strtomem_pad(sbi->s_es->s_last_mounted, cp, 0);
^~~~~~~~~~~~
In file included from ./include/linux/build_bug.h:5,
from ./include/linux/container_of.h:5,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from drivers/message/fusion/mptsas.c:46:
drivers/message/fusion/mptsas.c: In function 'mptsas_exp_repmanufacture_info':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2968:3: note: in expansion of macro 'memtostr'
memtostr(edev->vendor_id, manufacture_reply->vendor_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2969:3: note: in expansion of macro 'memtostr'
memtostr(edev->product_id, manufacture_reply->product_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2970:3: note: in expansion of macro 'memtostr'
memtostr(edev->product_rev, manufacture_reply->product_rev);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2973:4: note: in expansion of macro 'memtostr'
memtostr(edev->component_vendor_id,
^~~~~~~~
make[4]: *** [scripts/Makefile.build:203: fs/ext4/file.o] Error 1
make[3]: *** [scripts/Makefile.build:461: fs/ext4] Error 2
make[3]: *** Waiting for unfinished jobs....
In file included from ./include/linux/array_size.h:5,
from ./include/linux/kernel.h:16,
from drivers/scsi/mpt3sas/mpt3sas_base.c:46:
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_display_ioc_capabilities':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_base.c:4798:2: note: in expansion of macro 'memtostr'
memtostr(desc, ioc->manu_pg0.ChipName);
^~~~~~~~
In file included from ./include/linux/build_bug.h:5,
from ./include/linux/container_of.h:5,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from drivers/scsi/mpt3sas/mpt3sas_transport.c:45:
drivers/scsi/mpt3sas/mpt3sas_transport.c: In function '_transport_expander_report_manufacture':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:461:3: note: in expansion of macro 'memtostr'
memtostr(edev->vendor_id, manufacture_reply->vendor_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:462:3: note: in expansion of macro 'memtostr'
memtostr(edev->product_id, manufacture_reply->product_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:463:3: note: in expansion of macro 'memtostr'
memtostr(edev->product_rev, manufacture_reply->product_rev);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:466:4: note: in expansion of macro 'memtostr'
memtostr(edev->component_vendor_id,
^~~~~~~~
make[5]: *** [scripts/Makefile.build:203: drivers/scsi/mpt3sas/mpt3sas_transport.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [scripts/Makefile.build:203: drivers/message/fusion/mptsas.o] Error 1
make[4]: *** [scripts/Makefile.build:461: drivers/message/fusion] Error 2
make[3]: *** [scripts/Makefile.build:461: drivers/message] Error 2
make[3]: *** Waiting for unfinished jobs....
make[5]: *** [scripts/Makefile.build:203: drivers/scsi/mpt3sas/mpt3sas_base.o] Error 1
In file included from ./include/linux/array_size.h:5,
from ./include/linux/kernel.h:16,
from drivers/scsi/qla2xxx/qla_def.h:9,
from drivers/scsi/qla2xxx/qla_mr.c:6:
drivers/scsi/qla2xxx/qla_mr.c: In function 'qlafx00_fx_disc':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_mr.c:1912:3: note: in expansion of macro 'memtostr'
memtostr(vha->hw->model_number, pinfo->model_num);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_mr.c:1913:3: note: in expansion of macro 'memtostr'
memtostr(vha->hw->model_desc, pinfo->model_description);
^~~~~~~~
make[5]: *** [scripts/Makefile.build:203: drivers/scsi/qla2xxx/qla_mr.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:461: fs] Error 2
make[2]: *** Waiting for unfinished jobs....
make[4]: *** [scripts/Makefile.build:461: drivers/scsi/mpt3sas] Error 2
make[4]: *** Waiting for unfinished jobs....
make[4]: *** [scripts/Makefile.build:461: drivers/scsi/qla2xxx] Error 2
make[3]: *** [scripts/Makefile.build:461: drivers/scsi] Error 2
make[2]: *** [scripts/Makefile.build:461: drivers] Error 2
make[1]: *** [/root/linux-next/Makefile:1989: .] Error 2
make: *** [Makefile:251: __sub-make] Error 2
Hi Venkat,
CC Kees Cook for advice. This is a result of the tests added in commit
bbeb38b8487a ("string.h: Validate memtostr*()/strtomem*() arguments more carefully")
from the kspp tree.
I note that the comment about memtostr() says "Copy a possibly
non-NUL-term string".
Can you tell more about your config and your environment ?
I just tested with ppc64_defconfig and ppc64le_defconfig, with gcc 12.4,
gcc 13.2 and gcc 14.2 and didn't get that build error.
Christophe
On Thu, 27 Feb 2025 06:30:12 +0530 Venkat Rao Bagalkote [off-list ref] wrote:
quoted
I am seeing build failures with kernel next-20250226, on IBM Power8 systems.
Failures:
In file included from ./include/asm-generic/div64.h:27,
from ./arch/powerpc/include/generated/asm/div64.h:1,
from ./include/linux/math.h:6,
from ./include/linux/math64.h:6,
from ./include/linux/time.h:6,
from fs/ext4/file.c:22:
fs/ext4/file.c: In function 'ext4_sample_last_mounted':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:418:6: note: in expansion of macro '__must_be_noncstr'
__must_be_noncstr(dest) + \
^~~~~~~~~~~~~~~~~
fs/ext4/file.c:869:2: note: in expansion of macro 'strtomem_pad'
strtomem_pad(sbi->s_es->s_last_mounted, cp, 0);
^~~~~~~~~~~~
In file included from ./include/linux/build_bug.h:5,
from ./include/linux/container_of.h:5,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from drivers/message/fusion/mptsas.c:46:
drivers/message/fusion/mptsas.c: In function 'mptsas_exp_repmanufacture_info':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2968:3: note: in expansion of macro 'memtostr'
memtostr(edev->vendor_id, manufacture_reply->vendor_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2969:3: note: in expansion of macro 'memtostr'
memtostr(edev->product_id, manufacture_reply->product_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2970:3: note: in expansion of macro 'memtostr'
memtostr(edev->product_rev, manufacture_reply->product_rev);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2973:4: note: in expansion of macro 'memtostr'
memtostr(edev->component_vendor_id,
^~~~~~~~
make[4]: *** [scripts/Makefile.build:203: fs/ext4/file.o] Error 1
make[3]: *** [scripts/Makefile.build:461: fs/ext4] Error 2
make[3]: *** Waiting for unfinished jobs....
In file included from ./include/linux/array_size.h:5,
from ./include/linux/kernel.h:16,
from drivers/scsi/mpt3sas/mpt3sas_base.c:46:
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_display_ioc_capabilities':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_base.c:4798:2: note: in expansion of macro 'memtostr'
memtostr(desc, ioc->manu_pg0.ChipName);
^~~~~~~~
In file included from ./include/linux/build_bug.h:5,
from ./include/linux/container_of.h:5,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from drivers/scsi/mpt3sas/mpt3sas_transport.c:45:
drivers/scsi/mpt3sas/mpt3sas_transport.c: In function '_transport_expander_report_manufacture':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:461:3: note: in expansion of macro 'memtostr'
memtostr(edev->vendor_id, manufacture_reply->vendor_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:462:3: note: in expansion of macro 'memtostr'
memtostr(edev->product_id, manufacture_reply->product_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:463:3: note: in expansion of macro 'memtostr'
memtostr(edev->product_rev, manufacture_reply->product_rev);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:466:4: note: in expansion of macro 'memtostr'
memtostr(edev->component_vendor_id,
^~~~~~~~
make[5]: *** [scripts/Makefile.build:203: drivers/scsi/mpt3sas/mpt3sas_transport.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [scripts/Makefile.build:203: drivers/message/fusion/mptsas.o] Error 1
make[4]: *** [scripts/Makefile.build:461: drivers/message/fusion] Error 2
make[3]: *** [scripts/Makefile.build:461: drivers/message] Error 2
make[3]: *** Waiting for unfinished jobs....
make[5]: *** [scripts/Makefile.build:203: drivers/scsi/mpt3sas/mpt3sas_base.o] Error 1
In file included from ./include/linux/array_size.h:5,
from ./include/linux/kernel.h:16,
from drivers/scsi/qla2xxx/qla_def.h:9,
from drivers/scsi/qla2xxx/qla_mr.c:6:
drivers/scsi/qla2xxx/qla_mr.c: In function 'qlafx00_fx_disc':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_mr.c:1912:3: note: in expansion of macro 'memtostr'
memtostr(vha->hw->model_number, pinfo->model_num);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_mr.c:1913:3: note: in expansion of macro 'memtostr'
memtostr(vha->hw->model_desc, pinfo->model_description);
^~~~~~~~
make[5]: *** [scripts/Makefile.build:203: drivers/scsi/qla2xxx/qla_mr.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:461: fs] Error 2
make[2]: *** Waiting for unfinished jobs....
make[4]: *** [scripts/Makefile.build:461: drivers/scsi/mpt3sas] Error 2
make[4]: *** Waiting for unfinished jobs....
make[4]: *** [scripts/Makefile.build:461: drivers/scsi/qla2xxx] Error 2
make[3]: *** [scripts/Makefile.build:461: drivers/scsi] Error 2
make[2]: *** [scripts/Makefile.build:461: drivers] Error 2
make[1]: *** [/root/linux-next/Makefile:1989: .] Error 2
make: *** [Makefile:251: __sub-make] Error 2
Hello,
Attached is the .config file.
This is being run on IBM Power8 system in PowerVM mode, as a full system
LPAR.
Regards,
Venkat.
On 27/02/25 4:13 pm, Christophe Leroy wrote:
Le 27/02/2025 à 02:38, Stephen Rothwell a écrit :
quoted
Hi Venkat,
CC Kees Cook for advice. This is a result of the tests added in commit
bbeb38b8487a ("string.h: Validate memtostr*()/strtomem*()
arguments more carefully")
from the kspp tree.
I note that the comment about memtostr() says "Copy a possibly
non-NUL-term string".
Can you tell more about your config and your environment ?
I just tested with ppc64_defconfig and ppc64le_defconfig, with gcc
12.4, gcc 13.2 and gcc 14.2 and didn't get that build error.
Christophe
quoted
On Thu, 27 Feb 2025 06:30:12 +0530 Venkat Rao Bagalkote
[off-list ref] wrote:
quoted
I am seeing build failures with kernel next-20250226, on IBM Power8
systems.
Failures:
In file included from ./include/asm-generic/div64.h:27,
from ./arch/powerpc/include/generated/asm/div64.h:1,
from ./include/linux/math.h:6,
from ./include/linux/math64.h:6,
from ./include/linux/time.h:6,
from fs/ext4/file.c:22:
fs/ext4/file.c: In function 'ext4_sample_last_mounted':
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:418:6: note: in expansion of macro
'__must_be_noncstr'
__must_be_noncstr(dest) + \
^~~~~~~~~~~~~~~~~
fs/ext4/file.c:869:2: note: in expansion of macro 'strtomem_pad'
strtomem_pad(sbi->s_es->s_last_mounted, cp, 0);
^~~~~~~~~~~~
In file included from ./include/linux/build_bug.h:5,
from ./include/linux/container_of.h:5,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from drivers/message/fusion/mptsas.c:46:
drivers/message/fusion/mptsas.c: In function
'mptsas_exp_repmanufacture_info':
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2968:3: note: in expansion of macro
'memtostr'
memtostr(edev->vendor_id, manufacture_reply->vendor_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2969:3: note: in expansion of macro
'memtostr'
memtostr(edev->product_id, manufacture_reply->product_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2970:3: note: in expansion of macro
'memtostr'
memtostr(edev->product_rev, manufacture_reply->product_rev);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2973:4: note: in expansion of macro
'memtostr'
memtostr(edev->component_vendor_id,
^~~~~~~~
make[4]: *** [scripts/Makefile.build:203: fs/ext4/file.o] Error 1
make[3]: *** [scripts/Makefile.build:461: fs/ext4] Error 2
make[3]: *** Waiting for unfinished jobs....
In file included from ./include/linux/array_size.h:5,
from ./include/linux/kernel.h:16,
from drivers/scsi/mpt3sas/mpt3sas_base.c:46:
drivers/scsi/mpt3sas/mpt3sas_base.c: In function
'_base_display_ioc_capabilities':
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_base.c:4798:2: note: in expansion of
macro 'memtostr'
memtostr(desc, ioc->manu_pg0.ChipName);
^~~~~~~~
In file included from ./include/linux/build_bug.h:5,
from ./include/linux/container_of.h:5,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from drivers/scsi/mpt3sas/mpt3sas_transport.c:45:
drivers/scsi/mpt3sas/mpt3sas_transport.c: In function
'_transport_expander_report_manufacture':
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:461:3: note: in expansion
of macro 'memtostr'
memtostr(edev->vendor_id, manufacture_reply->vendor_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:462:3: note: in expansion
of macro 'memtostr'
memtostr(edev->product_id, manufacture_reply->product_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:463:3: note: in expansion
of macro 'memtostr'
memtostr(edev->product_rev, manufacture_reply->product_rev);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:466:4: note: in expansion
of macro 'memtostr'
memtostr(edev->component_vendor_id,
^~~~~~~~
make[5]: *** [scripts/Makefile.build:203:
drivers/scsi/mpt3sas/mpt3sas_transport.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [scripts/Makefile.build:203:
drivers/message/fusion/mptsas.o] Error 1
make[4]: *** [scripts/Makefile.build:461: drivers/message/fusion]
Error 2
make[3]: *** [scripts/Makefile.build:461: drivers/message] Error 2
make[3]: *** Waiting for unfinished jobs....
make[5]: *** [scripts/Makefile.build:203:
drivers/scsi/mpt3sas/mpt3sas_base.o] Error 1
In file included from ./include/linux/array_size.h:5,
from ./include/linux/kernel.h:16,
from drivers/scsi/qla2xxx/qla_def.h:9,
from drivers/scsi/qla2xxx/qla_mr.c:6:
drivers/scsi/qla2xxx/qla_mr.c: In function 'qlafx00_fx_disc':
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_mr.c:1912:3: note: in expansion of macro
'memtostr'
memtostr(vha->hw->model_number, pinfo->model_num);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_mr.c:1913:3: note: in expansion of macro
'memtostr'
memtostr(vha->hw->model_desc, pinfo->model_description);
^~~~~~~~
make[5]: *** [scripts/Makefile.build:203:
drivers/scsi/qla2xxx/qla_mr.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:461: fs] Error 2
make[2]: *** Waiting for unfinished jobs....
make[4]: *** [scripts/Makefile.build:461: drivers/scsi/mpt3sas] Error 2
make[4]: *** Waiting for unfinished jobs....
make[4]: *** [scripts/Makefile.build:461: drivers/scsi/qla2xxx] Error 2
make[3]: *** [scripts/Makefile.build:461: drivers/scsi] Error 2
make[2]: *** [scripts/Makefile.build:461: drivers] Error 2
make[1]: *** [/root/linux-next/Makefile:1989: .] Error 2
make: *** [Makefile:251: __sub-make] Error 2
Le 27/02/2025 à 14:47, Venkat Rao Bagalkote a écrit :
Hello,
Attached is the .config file.
This is being run on IBM Power8 system in PowerVM mode, as a full system
LPAR.
Ah ok so you are using a quite old version of GCC, that is GCC 8.5
I get the same problem when building ppc64_defconfig with GCC 8.5
Kees, can you have a look ?
Regards
Christophe
Regards,
Venkat.
On 27/02/25 4:13 pm, Christophe Leroy wrote:
quoted
Le 27/02/2025 à 02:38, Stephen Rothwell a écrit :
quoted
Hi Venkat,
CC Kees Cook for advice. This is a result of the tests added in commit
bbeb38b8487a ("string.h: Validate memtostr*()/strtomem*()
arguments more carefully")
from the kspp tree.
I note that the comment about memtostr() says "Copy a possibly
non-NUL-term string".
Can you tell more about your config and your environment ?
I just tested with ppc64_defconfig and ppc64le_defconfig, with gcc
12.4, gcc 13.2 and gcc 14.2 and didn't get that build error.
Christophe
quoted
On Thu, 27 Feb 2025 06:30:12 +0530 Venkat Rao Bagalkote
[off-list ref] wrote:
quoted
I am seeing build failures with kernel next-20250226, on IBM Power8
systems.
Failures:
In file included from ./include/asm-generic/div64.h:27,
from ./arch/powerpc/include/generated/asm/div64.h:1,
from ./include/linux/math.h:6,
from ./include/linux/math64.h:6,
from ./include/linux/time.h:6,
from fs/ext4/file.c:22:
fs/ext4/file.c: In function 'ext4_sample_last_mounted':
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:418:6: note: in expansion of macro
'__must_be_noncstr'
__must_be_noncstr(dest) + \
^~~~~~~~~~~~~~~~~
fs/ext4/file.c:869:2: note: in expansion of macro 'strtomem_pad'
strtomem_pad(sbi->s_es->s_last_mounted, cp, 0);
^~~~~~~~~~~~
In file included from ./include/linux/build_bug.h:5,
from ./include/linux/container_of.h:5,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from drivers/message/fusion/mptsas.c:46:
drivers/message/fusion/mptsas.c: In function
'mptsas_exp_repmanufacture_info':
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2968:3: note: in expansion of macro
'memtostr'
memtostr(edev->vendor_id, manufacture_reply->vendor_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2969:3: note: in expansion of macro
'memtostr'
memtostr(edev->product_id, manufacture_reply->product_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2970:3: note: in expansion of macro
'memtostr'
memtostr(edev->product_rev, manufacture_reply->product_rev);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/message/fusion/mptsas.c:2973:4: note: in expansion of macro
'memtostr'
memtostr(edev->component_vendor_id,
^~~~~~~~
make[4]: *** [scripts/Makefile.build:203: fs/ext4/file.o] Error 1
make[3]: *** [scripts/Makefile.build:461: fs/ext4] Error 2
make[3]: *** Waiting for unfinished jobs....
In file included from ./include/linux/array_size.h:5,
from ./include/linux/kernel.h:16,
from drivers/scsi/mpt3sas/mpt3sas_base.c:46:
drivers/scsi/mpt3sas/mpt3sas_base.c: In function
'_base_display_ioc_capabilities':
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_base.c:4798:2: note: in expansion of
macro 'memtostr'
memtostr(desc, ioc->manu_pg0.ChipName);
^~~~~~~~
In file included from ./include/linux/build_bug.h:5,
from ./include/linux/container_of.h:5,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from drivers/scsi/mpt3sas/mpt3sas_transport.c:45:
drivers/scsi/mpt3sas/mpt3sas_transport.c: In function
'_transport_expander_report_manufacture':
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:461:3: note: in expansion
of macro 'memtostr'
memtostr(edev->vendor_id, manufacture_reply->vendor_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:462:3: note: in expansion
of macro 'memtostr'
memtostr(edev->product_id, manufacture_reply->product_id);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:463:3: note: in expansion
of macro 'memtostr'
memtostr(edev->product_rev, manufacture_reply->product_rev);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_transport.c:466:4: note: in expansion
of macro 'memtostr'
memtostr(edev->component_vendor_id,
^~~~~~~~
make[5]: *** [scripts/Makefile.build:203: drivers/scsi/mpt3sas/
mpt3sas_transport.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [scripts/Makefile.build:203: drivers/message/fusion/
mptsas.o] Error 1
make[4]: *** [scripts/Makefile.build:461: drivers/message/fusion]
Error 2
make[3]: *** [scripts/Makefile.build:461: drivers/message] Error 2
make[3]: *** Waiting for unfinished jobs....
make[5]: *** [scripts/Makefile.build:203: drivers/scsi/mpt3sas/
mpt3sas_base.o] Error 1
In file included from ./include/linux/array_size.h:5,
from ./include/linux/kernel.h:16,
from drivers/scsi/qla2xxx/qla_def.h:9,
from drivers/scsi/qla2xxx/qla_mr.c:6:
drivers/scsi/qla2xxx/qla_mr.c: In function 'qlafx00_fx_disc':
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_mr.c:1912:3: note: in expansion of macro
'memtostr'
memtostr(vha->hw->model_number, pinfo->model_num);
^~~~~~~~
./include/linux/compiler.h:197:62: error: static assertion failed:
"must be non-C-string (not NUL-terminated)"
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct
{_Static_assert(!(e), msg);}))
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro
'__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/qla2xxx/qla_mr.c:1913:3: note: in expansion of macro
'memtostr'
memtostr(vha->hw->model_desc, pinfo->model_description);
^~~~~~~~
make[5]: *** [scripts/Makefile.build:203: drivers/scsi/qla2xxx/
qla_mr.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:461: fs] Error 2
make[2]: *** Waiting for unfinished jobs....
make[4]: *** [scripts/Makefile.build:461: drivers/scsi/mpt3sas] Error 2
make[4]: *** Waiting for unfinished jobs....
make[4]: *** [scripts/Makefile.build:461: drivers/scsi/qla2xxx] Error 2
make[3]: *** [scripts/Makefile.build:461: drivers/scsi] Error 2
make[2]: *** [scripts/Makefile.build:461: drivers] Error 2
make[1]: *** [/root/linux-next/Makefile:1989: .] Error 2
make: *** [Makefile:251: __sub-make] Error 2
From: Michael Kelley <hidden> Date: 2025-02-27 14:05:30
From: Christophe Leroy <redacted> Sent: Thursday, February 27, 2025 2:43 AM
Le 27/02/2025 à 02:38, Stephen Rothwell a écrit :
quoted
Hi Venkat,
CC Kees Cook for advice. This is a result of the tests added in commit
bbeb38b8487a ("string.h: Validate memtostr*()/strtomem*() arguments more carefully")
from the kspp tree.
I note that the comment about memtostr() says "Copy a possibly
non-NUL-term string".
Can you tell more about your config and your environment ?
I just tested with ppc64_defconfig and ppc64le_defconfig, with gcc 12.4,
gcc 13.2 and gcc 14.2 and didn't get that build error.
Christophe
FWIW, I see the same build failures related to __must_be_noncstr()
when building natively on x86 and on arm64. In both cases, it's an
Ubuntu 20.04 installation with gcc 9.4.0 and binutils 2.34.
Michael
quoted
On Thu, 27 Feb 2025 06:30:12 +0530 Venkat Rao Bagalkote
[off-list ref] wrote:
quoted
quoted
I am seeing build failures with kernel next-20250226, on IBM Power8 systems.
Failures:
In file included from ./include/asm-generic/div64.h:27,
from ./arch/powerpc/include/generated/asm/div64.h:1,
from ./include/linux/math.h:6,
from ./include/linux/math64.h:6,
from ./include/linux/time.h:6,
from fs/ext4/file.c:22:
fs/ext4/file.c: In function 'ext4_sample_last_mounted':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
quoted
quoted
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:418:6: note: in expansion of macro '__must_be_noncstr'
__must_be_noncstr(dest) + \
^~~~~~~~~~~~~~~~~
fs/ext4/file.c:869:2: note: in expansion of macro 'strtomem_pad'
strtomem_pad(sbi->s_es->s_last_mounted, cp, 0);
^~~~~~~~~~~~
In file included from ./include/linux/build_bug.h:5,
from ./include/linux/container_of.h:5,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from drivers/message/fusion/mptsas.c:46:
drivers/message/fusion/mptsas.c: In function 'mptsas_exp_repmanufacture_info':
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string
^~~~~~~~~~~~~~
./include/linux/compiler.h:226:2: note: in expansion of macro
'__BUILD_BUG_ON_ZERO_MSG'
quoted
quoted
__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \
^~~~~~~~~~~~~~~~~~~~~~~
./include/linux/string.h:468:26: note: in expansion of macro '__must_be_noncstr'
const size_t _src_len = __must_be_noncstr(src) + \
^~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_base.c:4798:2: note: in expansion of macro 'memtostr'
memtostr(desc, ioc->manu_pg0.ChipName);
^~~~~~~~
In file included from ./include/linux/build_bug.h:5,
from ./include/linux/container_of.h:5,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from drivers/scsi/mpt3sas/mpt3sas_transport.c:45:
drivers/scsi/mpt3sas/mpt3sas_transport.c: In function
'_transport_expander_report_manufacture':
quoted
quoted
./include/linux/compiler.h:197:62: error: static assertion failed: "must be non-C-string
From: Christophe Leroy <redacted> Sent: Thursday, February 27, 2025 2:43 AM
quoted
Le 27/02/2025 à 02:38, Stephen Rothwell a écrit :
quoted
Hi Venkat,
CC Kees Cook for advice. This is a result of the tests added in commit
bbeb38b8487a ("string.h: Validate memtostr*()/strtomem*() arguments more carefully")
from the kspp tree.
I note that the comment about memtostr() says "Copy a possibly
non-NUL-term string".
Can you tell more about your config and your environment ?
I just tested with ppc64_defconfig and ppc64le_defconfig, with gcc 12.4,
gcc 13.2 and gcc 14.2 and didn't get that build error.
Christophe
FWIW, I see the same build failures related to __must_be_noncstr()
when building natively on x86 and on arm64. In both cases, it's an
Ubuntu 20.04 installation with gcc 9.4.0 and binutils 2.34.
Looks like I get that problem only with GCC 8.5 and GCC 9.5.
I don't get it with gcc 10.3 nor 11.3 nor 12.4 nor 13.2 nor 14.2
I don't get it either with gcc 5.5 or 7.5
Christophe
On Thu, Feb 27, 2025 at 03:15:35PM +0100, Christophe Leroy wrote:
Le 27/02/2025 à 15:05, Michael Kelley a écrit :
quoted
From: Christophe Leroy <redacted> Sent: Thursday, February 27, 2025 2:43 AM
quoted
Le 27/02/2025 à 02:38, Stephen Rothwell a écrit :
quoted
Hi Venkat,
CC Kees Cook for advice. This is a result of the tests added in commit
bbeb38b8487a ("string.h: Validate memtostr*()/strtomem*() arguments more carefully")
from the kspp tree.
I note that the comment about memtostr() says "Copy a possibly
non-NUL-term string".
Can you tell more about your config and your environment ?
I just tested with ppc64_defconfig and ppc64le_defconfig, with gcc 12.4,
gcc 13.2 and gcc 14.2 and didn't get that build error.
Christophe
FWIW, I see the same build failures related to __must_be_noncstr()
when building natively on x86 and on arm64. In both cases, it's an
Ubuntu 20.04 installation with gcc 9.4.0 and binutils 2.34.
Looks like I get that problem only with GCC 8.5 and GCC 9.5.
I don't get it with gcc 10.3 nor 11.3 nor 12.4 nor 13.2 nor 14.2
I don't get it either with gcc 5.5 or 7.5
I will investigate! Sorry for the trouble.
--
Kees Cook
On Thu, Feb 27, 2025 at 03:15:35PM +0100, Christophe Leroy wrote:
Le 27/02/2025 à 15:05, Michael Kelley a écrit :
quoted
From: Christophe Leroy <redacted> Sent: Thursday, February 27, 2025 2:43 AM
quoted
Le 27/02/2025 à 02:38, Stephen Rothwell a écrit :
quoted
Hi Venkat,
CC Kees Cook for advice. This is a result of the tests added in commit
bbeb38b8487a ("string.h: Validate memtostr*()/strtomem*() arguments more carefully")
from the kspp tree.
I note that the comment about memtostr() says "Copy a possibly
non-NUL-term string".
Can you tell more about your config and your environment ?
I just tested with ppc64_defconfig and ppc64le_defconfig, with gcc 12.4,
gcc 13.2 and gcc 14.2 and didn't get that build error.
Christophe
FWIW, I see the same build failures related to __must_be_noncstr()
when building natively on x86 and on arm64. In both cases, it's an
Ubuntu 20.04 installation with gcc 9.4.0 and binutils 2.34.
Looks like I get that problem only with GCC 8.5 and GCC 9.5.
I don't get it with gcc 10.3 nor 11.3 nor 12.4 nor 13.2 nor 14.2
These have both nonstring and __builtin_has_attribute()
I don't get it either with gcc 5.5 or 7.5
These have neither.
The problem was in the span of time when nonstring got introduced, but
__builtin_has_attribute() hadn't been yet (GCC 8 and 9). I had accounted
for having neither, but not for missing one. :|
Thank you all for helping debug this!
-Kees
--
Kees Cook
From: Michael Kelley <hidden> Date: 2025-03-01 05:44:16
From: Kees Cook <kees@kernel.org> Sent: Friday, February 28, 2025 9:46 AM
On Thu, Feb 27, 2025 at 03:15:35PM +0100, Christophe Leroy wrote:
quoted
Le 27/02/2025 à 15:05, Michael Kelley a écrit :
quoted
From: Christophe Leroy <redacted> Sent: Thursday, February 27, 2025 2:43 AM
quoted
Le 27/02/2025 à 02:38, Stephen Rothwell a écrit :
quoted
Hi Venkat,
CC Kees Cook for advice. This is a result of the tests added in commit
bbeb38b8487a ("string.h: Validate memtostr*()/strtomem*() arguments more carefully")
from the kspp tree.
I note that the comment about memtostr() says "Copy a possibly
non-NUL-term string".
Can you tell more about your config and your environment ?
I just tested with ppc64_defconfig and ppc64le_defconfig, with gcc 12.4,
gcc 13.2 and gcc 14.2 and didn't get that build error.
Christophe
FWIW, I see the same build failures related to __must_be_noncstr()
when building natively on x86 and on arm64. In both cases, it's an
Ubuntu 20.04 installation with gcc 9.4.0 and binutils 2.34.
Looks like I get that problem only with GCC 8.5 and GCC 9.5.
I don't get it with gcc 10.3 nor 11.3 nor 12.4 nor 13.2 nor 14.2
These have both nonstring and __builtin_has_attribute()
quoted
I don't get it either with gcc 5.5 or 7.5
These have neither.
The problem was in the span of time when nonstring got introduced, but
__builtin_has_attribute() hadn't been yet (GCC 8 and 9). I had accounted
for having neither, but not for missing one. :|
The new patch solves the problem I was seeing with gcc 9.4.0 on
x86 and arm64.
Thanks!
Michael