New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 807532 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

btrfs on 4.14 throws compile warning in ZSTD_decodeSequenceLong

Project Member Reported by smbar...@chromium.org, Jan 31 2018

Issue description

Enabling CONFIG_BTRFS_FS=y on 4.14 causes a compile warning:

/mnt/host/source/src/third_party/kernel/v4.14/lib/zstd/decompress.c: In function ‘ZSTD_decodeSequenceLong’:
/mnt/host/source/src/third_party/kernel/v4.14/lib/zstd/decompress.c:1195:21: error: array subscript is above array bounds [-Werror=array-bounds]
     offset = OF_base[ofCode] + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits);
                          ^

This doesn't happen with clang or gcc 6.3, just the older gcc 4.9 in the chroot.
 

Comment 1 by groeck@chromium.org, Jan 31 2018

gcc 5.4.0 doesn't throw the warning either. There is an explicit comment in the code suggesting that this condition won't happen. Guess we'll have to put the blame on gcc here. 

Comment 2 by vapier@chromium.org, Jan 31 2018

as long as we're building our kernels w/gcc-4.9 then, we'll have to add a CHROMIUM hack to disable this warning in this file/location ?

Comment 3 by groeck@chromium.org, Jan 31 2018

Decisions have consequences. In this case it is the decision to stick with gcc v4.9.x which has consequences. Kernels for some architectures don't even build anymore with gcc 4.9.x (it bails out with compiler errors, or in some cases due to changes assembler mnemonics), so we have to consider ourselves lucky.

Comment 4 by dgreid@chromium.org, Jan 31 2018

So chromium patch it is? I'll put that together. a BUG_ON checking array bounds should do the trick.
Project Member

Comment 5 by bugdroid1@chromium.org, Feb 1 2018

Labels: merge-merged-chromeos-4.14
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/dd48fe25e65e382dde3f1331f339d0985132d329

commit dd48fe25e65e382dde3f1331f339d0985132d329
Author: Dylan Reid <dgreid@chromium.org>
Date: Thu Feb 01 10:41:52 2018

CHROMIUM: lib: zstd: Add check for OF_base array bounds

Chrome OS compiles with gcc 4.9.x which doesn't like this code without
the check. It isn't a real problem and newer compilers know that, so
keep a local chromium patch to work around it until we move to a newer
compiler.

BUG= 807532 
TEST=Build kernel for tatl with brtfs and zstd enabled.

Change-Id: Iaed17679f5351616adf5540a07c5b4ba40c0feda
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/895964
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/dd48fe25e65e382dde3f1331f339d0985132d329/lib/zstd/decompress.c

Status: Fixed (was: Untriaged)
Components: OS>Systems>Containers

Sign in to add a comment