[LU-14093] gcc10 fails to build Lustre Created: 29/Oct/20  Updated: 24/Jan/22  Resolved: 25/Aug/21

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.14.0
Fix Version/s: Lustre 2.15.0

Type: Bug Priority: Minor
Reporter: Alex Zhuravlev Assignee: Alex Zhuravlev
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
is related to LU-14776 Ubuntu 20.04 HWE support Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   
/ldiskfs_extents.h:214:12: error: ‘zero_ex2.ee_start_hi’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  214 |  block |= ((ldiskfs_fsblk_t) le16_to_cpu(ex->ee_start_hi) << 31) << 1;
/home/alexey/head2/ldiskfs/extents.c:3411:34: note: ‘zero_ex2.ee_start_hi’ was declared here
 3411 |  struct ldiskfs_extent zero_ex1, zero_ex2;
      |                                  ^~~~~~~~
...
/home/alexey/head2/lustre/obdclass/llog_swab.c: In function ‘lustre_swab_update_ops’:
/home/alexey/head2/lustre/obdclass/llog_swab.c:137:46: error: array subscript 65534 is outside the bounds of an interior zero-length array ‘__u16[0]’ {aka ‘short unsigned int[]’} [-Werror=zero-length-bounds]
  137 |    __swab16s(&uops->uops_op[i].uop_params_off[j]);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
...
/home/alexey/head2/lustre/mgc/mgc_request.c: In function ‘mgc_apply_recover_logs’:
/home/alexey/head2/lustre/mgc/mgc_request.c:1506:24: error: ‘sprintf’ argument 4 may overlap destination object ‘<unknown>’ [-Werror=restrict]
 1506 |                 pos += sprintf(obdname + pos, "-%s-%s", cname, inst);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
In function ‘lfs_project_item_alloc’,
    inlined from ‘lfs_project_handle_dir’ at lfs_project.c:288:9:
lfs_project.c:72:2: error: ‘strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Werror=stringop-truncation]
   72 |  strncpy(lpi->lpi_pathname, pathname, sizeof(lpi->lpi_pathname) - 1);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


 Comments   
Comment by Gerrit Updater [ 30/Oct/20 ]

Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/40484
Subject: LU-14093 mgc: rework mgc_apply_recover_logs() for gcc10
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 19a6b718741568661f45b7c01f9f2b52f4941f2b

Comment by Gerrit Updater [ 30/Oct/20 ]

Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/40485
Subject: LU-14093 utils: trivial changes to support gcc10
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 4e3ceb36b1f6eacef5dd9e1b7db46463eb8e384c

Comment by Gerrit Updater [ 30/Oct/20 ]

Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/40486
Subject: LU-14093 ptlrpc: redefine uop_params_off to support gcc10
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 830439c1eb1a64865ec183b72489f57a1d817bb7

Comment by Gerrit Updater [ 07/Nov/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/40486/
Subject: LU-14093 ptlrpc: redefine uop_params_off to support gcc10
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 99ad32e7b9af807ef80d074c901a4d390c1ac0a1

Comment by Gerrit Updater [ 10/Apr/21 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/40485/
Subject: LU-14093 utils: trivial changes to support gcc10
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 79acd674e3bc49ac630d84ef64df2291fc9ade01

Comment by Gerrit Updater [ 15/May/21 ]

Dominique Martinet (qhufhnrynczannqp.f@noclue.notk.org) uploaded a new patch: https://review.whamcloud.com/43711
Subject: LU-14093 utils: fix format-overflow warning
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 2c211160d8bddd1b7fe635de5ed4917ffb6bdc73

Comment by Gerrit Updater [ 15/May/21 ]

Dominique Martinet (qhufhnrynczannqp.f@noclue.notk.org) uploaded a new patch: https://review.whamcloud.com/43712
Subject: LU-14093 llapi: remove ignored qualifier
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: e287a5e9205baa14d40a5aa7d5a6f300e0e698d0

Comment by Gerrit Updater [ 15/May/21 ]

Dominique Martinet (qhufhnrynczannqp.f@noclue.notk.org) uploaded a new patch: https://review.whamcloud.com/43713
Subject: LU-14093 lnet: annotate LNET_WIRE_HANDLE_COOKIE_NONE as u64
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: d59c0272db78be520b0f47ab64ab5f37bdeda0d1

Comment by Gerrit Updater [ 07/Jun/21 ]

James Simmons (jsimmons@infradead.org) uploaded a new patch: https://review.whamcloud.com/43938
Subject: LU-14093 utils: fix DLSYM buffer over flow
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 35ddaafe03c74e998d67071848eafd5d90d1ff34

Comment by James A Simmons [ 07/Jun/21 ]

I'm also seeing this compile error but don't have a solution.

llog_reader.c: In function ‘lustre_swab_lu_fid’:

llog_reader.c:781:12: error: taking address of packed member of ‘struct lu_fid’ may result in an unaligned pointer value [-Werror=address-of-packed-member]

  781 |  __swab64s(&fid->f_seq);

Comment by Gerrit Updater [ 14/Jun/21 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/43711/
Subject: LU-14093 utils: fix format-overflow warning
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: a0fe9be254b944f5b005dd4b36c414827bcb40df

Comment by Gerrit Updater [ 14/Jun/21 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/43712/
Subject: LU-14093 llapi: remove ignored qualifier
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 90ee0457c9fb1da939558186961f346c917d678f

Comment by James A Simmons [ 14/Jun/21 ]

A few more patches are needed so don't close just yet.

Comment by Gerrit Updater [ 21/Jun/21 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/43938/
Subject: LU-14093 utils: fix DLSYM buffer over flow
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 76bea6ca661609e3788d1cfe7e08e4a63af0a349

Comment by Gerrit Updater [ 08/Jul/21 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/43713/
Subject: LU-14093 lnet: annotate LNET_WIRE_HANDLE_COOKIE_NONE as u64
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 27214876fcdfbda016c920bce4ab1da800fcda4b

Comment by James A Simmons [ 08/Jul/21 ]

Need two more patches to complete this on my end.

Comment by James A Simmons [ 20/Jul/21 ]

Ubuntu 20 HWE has moved to gcc 10. New bugs are showing up.

Comment by Gerrit Updater [ 21/Jul/21 ]

James Simmons (jsimmons@infradead.org) uploaded a new patch: https://review.whamcloud.com/44363
Subject: LU-14093 gss: gcc10 fixes for GSS
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 4377e1485433732ab08724806d8b26be21dc0649

Comment by Gerrit Updater [ 31/Jul/21 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/44363/
Subject: LU-14093 gss: gcc10 fixes for GSS
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 39e4c97530c4657192e7c0d6a22ca30c90cdb6e4

Comment by James A Simmons [ 31/Jul/21 ]

Couple of more patches.

Comment by James A Simmons [ 03/Aug/21 ]

So I see this error:

badarea_io.c: In function ‘main’:

badarea_io.c:59:7: error: ‘write’ reading 2097152 bytes from a region of size 4 [-Werror=stringop-overflow=]

   59 |  rc = write(fd, &fd, 2UL*1024*1024);

      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from badarea_io.c:30:

/usr/include/unistd.h:367:16: note: in a call to function ‘write’ declared with attribute ‘read_only (2, 3)’

  367 | extern ssize_t write (int _fd, const void *_buf, size_t __n) __wur

      |                ^~~~~

badarea_io.c:63:7: error: ‘write’ reading 2147483648 bytes from a region of size 4 [-Werror=stringop-overflow=]

   63 |  rc = write(fd, &fd, 2UL*1024*1024*1024);

      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from badarea_io.c:30:

/usr/include/unistd.h:367:16: note: in a call to function ‘write’ declared with attribute ‘read_only (2, 3)’

  367 | extern ssize_t write (int _fd, const void *_buf, size_t __n) __wur

      |                ^~~~~

badarea_io.c:67:7: error: ‘write’ specified size 18446744073709551614 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]

   67 |  rc = write(fd, &fd, -2);

      |       ^~~~~~~~~~~~~~~~~~

In file included from badarea_io.c:30:

/usr/include/unistd.h:367:16: note: in a call to function ‘write’ declared with attribute ‘read_only (2, 3)’

  367 | extern ssize_t write (int _fd, const void *_buf, size_t __n) __wur

      |                ^~~~~

 

Was the original intent to actually write large amounts of data ? Just want to understand what the original intent was.

Comment by Andreas Dilger [ 05/Aug/21 ]

James, the goal of badarea_io is to verify that the /procfs, /sysfs, /debugfs handlers are not doing anything bad with invalid input (e.g. buffer overflows, choking on garbage data, etc). That used to happen on occasion and caused a kernel crash, but is largely robust now due to these tests.

It should be fine to replace "&fd" with any other pointer, since the kernel input parsing should stop long before accessing 2MiB or 2GiB or 16EiB of data. It might be enough to malloc() a buffer (e.g. 4KB) and use that directly, but if newer GCC also complains about overflowing the 4KB static buffer size, then it would also be possible to (optionally) accept the buffer size on the command-line just to work around any static size logic in the compiler. We don't necessarily want to avoid passing a bad pointer to the kernel, since that is exactly what this test is trying to exercise (e.g. copy_from_user() is being used properly, etc).

Comment by James A Simmons [ 16/Aug/21 ]

I pushed the last patch for this work that I see.

https://review.whamcloud.com/#/c/44670

Alex if you see anything else let me know.

Comment by Gerrit Updater [ 18/Aug/21 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/40484/
Subject: LU-14093 mgc: rework mgc_apply_recover_logs() for gcc10
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: d13d8158e816b7ac4437ff6d6c6aec3926ba7531

Comment by Gerrit Updater [ 18/Aug/21 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/44484/
Subject: LU-14093 lutf: fix build with gcc10
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 5220160648140800ced6466a1f75071ca80162da

Comment by Gerrit Updater [ 25/Aug/21 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/44670/
Subject: LU-14093 tests: silence gcc10 error for badarea_io
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 084546f7d01b0eec8dafae9bc50edc778c3886ca

Comment by James A Simmons [ 25/Aug/21 ]

All the build issues I have seen have been addresses. Alex if you have any more please reopen this ticket.

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