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

Issue 780065 link

Starred by 2 users

Issue metadata

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

Blocking:
issue 740414
issue 780077



Sign in to add a comment

storage_test_2 broken on non ATA device

Project Member Reported by gwendal@chromium.org, Oct 31 2017

Issue description

Testing on eve (NVMe) or cyan (eMMC), storage_test_2 is returning an error:

cyan: CHROMEOS_RELEASE_BUILDER_PATH=cyan-release/R64-10064.0.0
eve: CHROMEOS_RELEASE_BUILDER_PATH=eve-release/R64-10068.0.0

/sbin/badblock: No such file or directory while trying to determine device size
 
Blocking: 780077
Owner: asavery@chromium.org
Status: Assigned (was: Untriaged)
Summary: storage_test_2 broken on non ATA device (was: storage_test_2 broken)
The problem is in platform2/debugd/src/storage_tool.cc
Where the fixed device is expected to be /dev/sda.

see platform2/debugd/src/storage_tool.cc 

This is wrong. We should use the existing code for retrieving the fixed device. For StorageTool::Smartctl, check if it is SATA, bailed if not, or let smartctl throw an error the feature is not supported).

For StorageTool::Start, badblocks can work on any device.
Cc: yungleem@chromium.org ka...@chromium.org nsale@chromium.org gwendal@chromium.org
 Issue 780077  has been merged into this issue.
Project Member

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

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/e39d349a3e615e619aa82bb892d1cafdac0454d8

commit e39d349a3e615e619aa82bb892d1cafdac0454d8
Author: Alexis Savery <asavery@chromium.org>
Date: Wed Feb 14 05:17:15 2018

debugd: Replace hardcoded fixed device

Retrieve the fixed device instead of using hardcoded /dev/sda.
Remove the partition from the device name.
For StorageTool::Smartctl, if device is not SATA, return a
message to indicate that the feature is not supported.

BUG= chromium:780065 
TEST=Ran storage_test_1 and storage_test_2 on SATA, emmc, and
nvme devices. Ran unit tests.

Change-Id: Ie916bb6b9828d4b9688b4ba6956eaf8edadfc9f3
Reviewed-on: https://chromium-review.googlesource.com/759299
Commit-Ready: Alexis Savery <asavery@chromium.org>
Tested-by: Alexis Savery <asavery@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>

[modify] https://crrev.com/e39d349a3e615e619aa82bb892d1cafdac0454d8/debugd/src/storage_tool.h
[modify] https://crrev.com/e39d349a3e615e619aa82bb892d1cafdac0454d8/debugd/debugd.gyp
[add] https://crrev.com/e39d349a3e615e619aa82bb892d1cafdac0454d8/debugd/src/storage_tool_unittest.cc
[modify] https://crrev.com/e39d349a3e615e619aa82bb892d1cafdac0454d8/debugd/src/storage_tool.cc

Cc: manojgupta@chromium.org
I believe CL 759299 has made ASan unhappy. https://uberchromegw.corp.google.com/i/chromiumos/builders/amd64-generic-asan/builds/23389

debugd-0.0.1-r2490:  * ASAN error detected:
debugd-0.0.1-r2490:  * =================================================================
debugd-0.0.1-r2490:  * ==17==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7fb428ac05a6 at pc 0x7fb4287adabc bp 0x7ffc827a8210 sp 0x7ffc827a79c0
debugd-0.0.1-r2490:  * READ of size 8 at 0x7fb428ac05a6 thread T0
debugd-0.0.1-r2490:  *     #0 0x7fb4287adabb in __interceptor_write ??:0:0
debugd-0.0.1-r2490:  *     #1 0x7fb42773f2ed in base::WriteFileDescriptor(int, char const*, int) /build/amd64-generic/tmp/portage/chromeos-base/libchrome-395517-r16/work/libchrome-395517/base/files/file_util_posix.cc:745:9
debugd-0.0.1-r2490:  *     #2 0x7fb42773f2ed in base::WriteFile(base::FilePath const&, char const*, int) /build/amd64-generic/tmp/portage/chromeos-base/libchrome-395517-r16/work/libchrome-395517/base/files/file_util_posix.cc:733:0
debugd-0.0.1-r2490:  * 
debugd-0.0.1-r2490:  * 0x7fb428ac05a6 is located 0 bytes to the right of global variable '<string literal>' defined in '../../../../../../../../../mnt/host/source/src/platform2/debugd/src/storage_tool_unittest.cc:298:26' (0x7fb428ac05a0) of size 6
debugd-0.0.1-r2490:  *   '<string literal>' is ascii string 'OTHER'
debugd-0.0.1-r2490:  * SUMMARY: AddressSanitizer: global-buffer-overflow (/var/cache/portage/chromeos-base/debugd/out/Default/debugd_testrunner+0x159abb)
debugd-0.0.1-r2490:  * Shadow bytes around the buggy address:
debugd-0.0.1-r2490:  *   0x0ff705150060: 00 00 00 07 f9 f9 f9 f9 00 00 00 05 f9 f9 f9 f9
debugd-0.0.1-r2490:  *   0x0ff705150070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debugd-0.0.1-r2490:  *   0x0ff705150080: 00 00 00 00 00 00 00 00 00 00 00 00 02 f9 f9 f9
debugd-0.0.1-r2490:  *   0x0ff705150090: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
debugd-0.0.1-r2490:  *   0x0ff7051500a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04
debugd-0.0.1-r2490:  * =>0x0ff7051500b0: f9 f9 f9 f9[06]f9 f9 f9 f9 f9 f9 f9 00 00 00 00
debugd-0.0.1-r2490:  *   0x0ff7051500c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debugd-0.0.1-r2490:  *   0x0ff7051500d0: 00 00 00 00 00 00 00 00 f9 f9 f9 f9 00 00 00 00
debugd-0.0.1-r2490:  *   0x0ff7051500e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debugd-0.0.1-r2490:  *   0x0ff7051500f0: 00 00 00 00 00 00 00 02 f9 f9 f9 f9 04 f9 f9 f9
debugd-0.0.1-r2490:  *   0x0ff705150100: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
debugd-0.0.1-r2490:  * Shadow byte legend (one shadow byte represents 8 application bytes):
debugd-0.0.1-r2490:  *   Addressable:           00
debugd-0.0.1-r2490:  *   Partially addressable: 01 02 03 04 05 06 07
debugd-0.0.1-r2490:  *   Heap left redzone:       fa
debugd-0.0.1-r2490:  *   Freed heap region:       fd
debugd-0.0.1-r2490:  *   Stack left redzone:      f1
debugd-0.0.1-r2490:  *   Stack mid redzone:       f2
debugd-0.0.1-r2490:  *   Stack right redzone:     f3
debugd-0.0.1-r2490:  *   Stack after return:      f5
debugd-0.0.1-r2490:  *   Stack use after scope:   f8
debugd-0.0.1-r2490:  *   Global redzone:          f9
debugd-0.0.1-r2490:  *   Global init order:       f6
debugd-0.0.1-r2490:  *   Poisoned by user:        f7
debugd-0.0.1-r2490:  *   Container overflow:      fc
debugd-0.0.1-r2490:  *   Array cookie:            ac
debugd-0.0.1-r2490:  *   Intra object redzone:    bb
debugd-0.0.1-r2490:  *   ASan internal:           fe
debugd-0.0.1-r2490:  *   Left alloca redzone:     ca
debugd-0.0.1-r2490:  *   Right alloca redzone:    cb
debugd-0.0.1-r2490:  * ==17==ABORTING
This CL: https://chromium-review.googlesource.com/#/c/chromiumos/platform2/+/923289/
should fix the ASAN error from #6
Project Member

Comment 8 by bugdroid1@chromium.org, Feb 17 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/60061f8752a9130663bcafbc140afb40a503f701

commit 60061f8752a9130663bcafbc140afb40a503f701
Author: Alexis Savery <asavery@chromium.org>
Date: Sat Feb 17 02:48:17 2018

debugd: Fix unittest causing ASAN error

Change WriteFile to use strlen instead of sizeof on string literals
to fix ASAN error.

BUG= chromium:780065 
TEST=Ran unittests on amd64-generic with profile=asan

Change-Id: I3f408b068ed806af5f37aa688d871baaef43185d
Reviewed-on: https://chromium-review.googlesource.com/923289
Commit-Ready: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Jacob Romero <levemealone72@gmail.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/60061f8752a9130663bcafbc140afb40a503f701/debugd/src/storage_tool_unittest.cc

Blocking: 740414
Status: Fixed (was: Assigned)

Sign in to add a comment