[LU-15798] RHEL9 / gcc-11 adds -Wstringop-overread false warnings Created: 28/Apr/22 Updated: 16/Jan/24 |
|
| Status: | Open |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Shaun Tancheff | Assignee: | Shaun Tancheff |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Rank (Obsolete): | 9223372036854775807 | ||||||||||||
| Description |
|
gcc-11 stringop-overread reports a false positive on Use _Pragma to exclude the diagnostic for this case. |
| Comments |
| Comment by Gerrit Updater [ 28/Apr/22 ] |
|
"Shaun Tancheff <shaun.tancheff@hpe.com>" uploaded a new patch: https://review.whamcloud.com/47167 |
| Comment by James A Simmons [ 28/Apr/22 ] |
|
Patch https://review.whamcloud.com/c/46319 resolves this in a clear way, |
| Comment by Xinliang Liu [ 25/Sep/23 ] |
|
This issue still exists on rhel9.2: /tmp/rpmbuild-lustre-jenkins-SCTCWlBO/BUILD/lustre-2.15.58_59_g2ddb1d3_dirty/lustre/include/uapi/linux/lustre/lustre_user.h:2095:16: error: 'strlen' reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread] 2095 | return strlen(changelog_rec_sname(rec)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| Comment by Shaun Tancheff [ 25/Sep/23 ] |
|
Strange that I do not see this on x86_64 ... it this aarch64? |
| Comment by Xinliang Liu [ 26/Sep/23 ] |
|
Yes, it is aarch64. |
| Comment by Xinliang Liu [ 13/Oct/23 ] |
|
@stancheff have tried make rpms? Just make no compile error. |
| Comment by Shaun Tancheff [ 13/Oct/23 ] |
|
Yes, make and make rpms both work. With gcc-12 I do see a few issues with configure and with compiling: In function ‘strnlen’,
inlined from ‘lov_iocontrol’ at /home/shaun/lustre-release/lustre/lov/lov_obd.c:1079:4:
include/linux/fortify-string.h:23:34: error: array subscript 112 is outside array bounds of ‘void[112]’ [-Werror=array-bounds]
23 | __builtin_constant_p(*__p)) { \
| ^~~~
include/linux/fortify-string.h:141:24: note: in expansion of macro ‘__compiletime_strlen’
141 | size_t p_len = __compiletime_strlen(p);
| ^~~~~~~~~~~~~~~~~~~~
In file included from include/linux/fs.h:44,
from /home/shaun/lustre-release/libcfs/include/libcfs/linux/linux-misc.h:35,
from /home/shaun/lustre-release/libcfs/include/libcfs/libcfs.h:43:
In function ‘kmalloc’,
inlined from ‘lov_iocontrol’ at /home/shaun/lustre-release/lustre/lov/lov_obd.c:1072:3:
include/linux/slab.h:611:24: note: at offset 112 into object of size 112 allocated by ‘kmem_cache_alloc_trace’
611 | return kmem_cache_alloc_trace(
| ^~~~~~~~~~~~~~~~~~~~~~~
612 | kmalloc_caches[kmalloc_type(flags)][index],
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
613 | flags, size);
| ~~~~~~~~~~~~
cc1: all warnings being treated as errors
|
| Comment by Xinliang Liu [ 16/Oct/23 ] |
|
Thanks, stancheff for the info, it seems an Aarch64 specific issue. |
| Comment by Xinliang Liu [ 17/Oct/23 ] |
|
Find that the below commit breaks the compiling on rhel9.2. efc5c8d4de60 ~/work/lustre/lustre-release$ git log -p efc5c8d4de60 -- lustre//include/uapi/linux/lustre/lustre_user.h Author: Lai Siyao <lai.siyao@whamcloud.com> Date: Thu Dec 1 03:17:00 2022 -0500 LU-16335 build: remove _GNU_SOURCE dependency in lustre_user.h The lustre_user.h header uses the non-standard strchrnul() function in userspace. This will always leads to LC_IOC_REMOVE_ENTRY configure check to fail, and in the end "lfs rm_entry" always returns -ENOTSUP. Implement an alternative approach to avoid external dependencies on the lustre_user.h header. Also, LC_IOC_REMOVE_ENTRY is itself unnecessary, the code can check for LL_IOC_REMOVE_ENTRY directly. Replace the NFS-specific -ENOTSUP error return code with -EOPNOTSUPP. Fix the compile test_400[ab] checks to not use "-std=c99" to verify that the uapi headers are usable without this dependency. ... diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index 1b1e60acf805..36e1e70b9224 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -2033,7 +2033,11 @@ static inline char *changelog_rec_name(const struct changelog_rec *rec) static inline char *changelog_rec_sname(const struct changelog_rec *rec) { - return strchrnul(changelog_rec_name(rec), '\0') + 1; + char *str = changelog_rec_name(rec); + + while (*str != '\0') + str++; + return str + 1; } |
| Comment by Gerrit Updater [ 16/Jan/24 ] |
|
"xinliang <xinliang.liu@linaro.org>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/53685 |
| Comment by Xinliang Liu [ 16/Jan/24 ] |
|
This issue can be fixed by patch: https://review.whamcloud.com/c/fs/lustre-release/+/53624 |