[LU-11233] gcc8 support Created: 10/Aug/18  Updated: 08/Jun/19  Resolved: 29/May/19

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.13.0, Lustre 2.12.3

Type: Improvement Priority: Trivial
Reporter: Alex Zhuravlev Assignee: Alex Zhuravlev
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
is related to LU-12269 Support RHEL 8.0 Resolved
is related to LU-11838 Support linux kernel version 4.18 Resolved
Rank (Obsolete): 9223372036854775807

 Description   

gcc8 introduces number of new checks (especially in string manipulation area) preventing builds

 



 Comments   
Comment by Gerrit Updater [ 10/Aug/18 ]

Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/32978
Subject: LU-11233 build: gcc8 support
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 94f34bfcde638b7d3535154c04907544ca4b6fce

Comment by Gerrit Updater [ 15/Apr/19 ]

Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/34660
Subject: LU-11233 build: support for gcc8
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 76e3fc7e99538ce73708514863e63467066dced8

Comment by Gerrit Updater [ 15/Apr/19 ]

Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/34661
Subject: LU-11233 build: support for gcc8
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 973f4ffb776303c8caddbc6e507d0d5c7c75f4ee

Comment by Gerrit Updater [ 15/Apr/19 ]

Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/34662
Subject: LU-11233 build: support for gcc8
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: ae3e0118240849c89ac3b222ef38ddc7184bd29a

Comment by Dongyang Li [ 16/Apr/19 ]

Alex, please add something like this below to https://review.whamcloud.com/#/c/34662/ to make server utils build with gcc8:

diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c
index 1acd6353a0..c3dcf5e62c 100644
--- a/lustre/utils/mount_lustre.c
+++ b/lustre/utils/mount_lustre.c
@@ -348,7 +348,7 @@ int parse_options(struct mount_opts *mop, char *orig_options,
                                free(options);
                                return EINVAL;
                        }
-                       strncpy(mop->mo_skpath, val + 1, strlen(val + 1));
+                       strncpy(mop->mo_skpath, val + 1, strlen(mop->mo_skpath) - 1);
 #endif
                } else if (parse_one_option(opt, flagp) == 0) {
                        /* pass this on as an option */
Comment by Alex Zhuravlev [ 16/Apr/19 ]

dongyang please tell what exact gcc you are using

Comment by Dongyang Li [ 17/Apr/19 ]
[root@rhel8 ~]# gcc --version
gcc (GCC) 8.2.1 20180905 (Red Hat 8.2.1-3)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment by Alex Zhuravlev [ 17/Apr/19 ]

gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)

ah, GSS support is disabled in my case..
but I gues you really meant not strlen(mop->mo_skpath), but rather sizeof(mop->mo_skpath) ?

Comment by Dongyang Li [ 17/Apr/19 ]

Yes it should be sizeof(mop->mo_skpath) here, my bad.

with the above patches and the change I mentioned, I was able to build all the modules/utils with gcc8 on rhel8.

Comment by Gerrit Updater [ 18/Apr/19 ]

Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/34711
Subject: LU-11233 utils: fix double-free of params fields
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 01eb91f826be2531f707540e57266fc04f7d2c67

Comment by Gerrit Updater [ 04/May/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/34660/
Subject: LU-11233 build: support for gcc8
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 6601661f96325b4971d0d1cb0be0fa01cc2ddc97

Comment by Gerrit Updater [ 04/May/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/34711/
Subject: LU-11233 utils: fix double-free of params fields
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 7c7c39d84c98df3c6fe33c04c9e391529a86db53

Comment by Jian Yu [ 22/May/19 ]

Hi Alex,
I'm working on RHEL 8.0 Lustre client support (LU-12269). With a bunch of patches applied, the build in https://review.whamcloud.com/34908 failed as follows:

00:35:12 liblnetconfig.c: In function 'yaml_copy_peer_nids':
00:35:12 liblnetconfig.c:4321:3: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
00:35:12    strncpy(nids[num], entry->cy_valuestring,
00:35:12    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00:35:12     strlen(entry->cy_valuestring));
00:35:12     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00:35:12 liblnetconfig.c: In function 'lnet_expr2ips':
00:35:12 liblnetconfig.c:722:30: error: '%s' directive output may be truncated writing up to 127 bytes into a region of size 104 [-Werror=format-truncation=]
00:35:12     "\"cannot parse ip_range '%s'\"", ip_range);
00:35:12                               ^~      ~~~~~~~~
00:35:12 liblnetconfig.c:720:3: note: 'snprintf' output between 27 and 154 bytes into a destination of size 128
00:35:12    snprintf(err_str,
00:35:12    ^~~~~~~~~~~~~~~~~
00:35:12     LNET_MAX_STR_LEN,
00:35:12     ~~~~~~~~~~~~~~~~~
00:35:12     "\"cannot parse ip_range '%s'\"", ip_range);
00:35:12     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00:35:12 cc1: all warnings being treated as errors

However, the output of configure was:

00:21:24 checking for -Wno-format-truncation support... yes
00:21:24 checking for -Wno-stringop-truncation support... yes
00:21:24 checking for -Wno-stringop-overflow support... yes
<~snip~>
00:21:28 EXTRA_KCFLAGS: -include /var/lib/jenkins/workspace/lustre-reviews/arch/x86_64/build_type/client/distro/el8/ib_stack/inkernel/BUILD/lustre/undef.h -include /var/lib/jenkins/workspace/lustre-reviews/arch/x86_64/build_type/client/distro/el8/ib_stack/inkernel/BUILD/lustre/config.h  -g -I/var/lib/jenkins/workspace/lustre-reviews/arch/x86_64/build_type/client/distro/el8/ib_stack/inkernel/BUILD/lustre/libcfs/include -I/var/lib/jenkins/workspace/lustre-reviews/arch/x86_64/build_type/client/distro/el8/ib_stack/inkernel/BUILD/lustre/lnet/include -I/var/lib/jenkins/workspace/lustre-reviews/arch/x86_64/build_type/client/distro/el8/ib_stack/inkernel/BUILD/lustre/lustre/include -Wno-format-truncation -Wno-stringop-truncation -Wno-stringop-overflow

"-Wno-format-truncation -Wno-stringop-truncation -Wno-stringop-overflow" were specified in EXTRA_KCFLAGS but they didn't work. gcc version is 8.2.1.

Could you please advise?

Comment by Gerrit Updater [ 25/May/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/34662/
Subject: LU-11233 utils: fix build warnings for gcc8
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 5e0ad2afa62e9eb7cf4f48c394c6a84c74a02f2f

Comment by Gerrit Updater [ 29/May/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/34661/
Subject: LU-11233 tests: fix gcc8 build warnings
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 6733fbff9a682bcec5fdca6f7062c24f0fe27cfe

Comment by Peter Jones [ 29/May/19 ]

Landed for 2.13

Comment by Gerrit Updater [ 30/May/19 ]

Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35002
Subject: LU-11233 build: support for gcc8
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: ea462e2422153901f9b7115ca567911911768f67

Comment by Gerrit Updater [ 30/May/19 ]

Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35003
Subject: LU-11233 utils: fix double-free of params fields
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: e1432f444904fc016f173690ad0ab3683df753c6

Comment by Gerrit Updater [ 30/May/19 ]

Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35004
Subject: LU-11233 utils: fix build warnings for gcc8
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: f457cdc4ec5bc51f9491890b81e78e62dba20950

Comment by Gerrit Updater [ 30/May/19 ]

Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35005
Subject: LU-11233 tests: fix gcc8 build warnings
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: 72949fed0b1c17b5a1e57dc955c6ea2ae56400dc

Comment by Gerrit Updater [ 08/Jun/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/35003/
Subject: LU-11233 utils: fix double-free of params fields
Project: fs/lustre-release
Branch: b2_12
Current Patch Set:
Commit: 0b86b935a16171120036260f4a0850e2e1245f46

Comment by Gerrit Updater [ 08/Jun/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/35004/
Subject: LU-11233 utils: fix build warnings for gcc8
Project: fs/lustre-release
Branch: b2_12
Current Patch Set:
Commit: 67533bcad5e937126c6e1da8fc13003816431858

Comment by Gerrit Updater [ 08/Jun/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/35005/
Subject: LU-11233 tests: fix gcc8 build warnings
Project: fs/lustre-release
Branch: b2_12
Current Patch Set:
Commit: 097c911244b53a044c4d4dfd33fdf12fd9a9cdd3

Comment by Gerrit Updater [ 08/Jun/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/35002/
Subject: LU-11233 build: support for gcc8
Project: fs/lustre-release
Branch: b2_12
Current Patch Set:
Commit: 2059acdcaee186256ce0eeae2f28b090058b0b39

Generated at Sat Feb 10 02:42:06 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.