New issue
Advanced search Search tips

Issue 809786 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Feb 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug
Build-Toolchain



Sign in to add a comment

Asan complains about use of unaligned addresss in //base/files/dir_reader_linux.h

Project Member Reported by manojgupta@chromium.org, Feb 7 2018

Issue description

libchromeos-ui-0.0.1-r1470:  * ASAN error detected:
libchromeos-ui-0.0.1-r1470:  * base/files/dir_reader_linux.h:79:20: runtime error: member access within misaligned address 0x7ffdae34d024 for type 'const base::linux_dirent', which requires 8 byte alignment
libchromeos-ui-0.0.1-r1470:  * 0x7ffdae34d024: note: pointer points here
libchromeos-ui-0.0.1-r1470:  *   04 00 00 00 70 d9 8e 09  00 00 00 00 01 00 00 00  00 00 00 00 18 00 04 2e  00 00 00 00 6f d9 8e 09
libchromeos-ui-0.0.1-r1470:  *               ^
libchromeos-ui-0.0.1-r1470:  * SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior base/files/dir_reader_linux.h:79:20 in
libchromeos-ui-0.0.1-r1470:  * base/files/dir_reader_linux.h:55:26: runtime error: member access within misaligned address 0x7ffdae34d024 for type 'base::linux_dirent', which requires 8 byte alignment
libchromeos-ui-0.0.1-r1470:  * 0x7ffdae34d024: note: pointer points here
libchromeos-ui-0.0.1-r1470:  *   04 00 00 00 70 d9 8e 09  00 00 00 00 01 00 00 00  00 00 00 00 18 00 04 2e  00 00 00 00 6f d9 8e 09
libchromeos-ui-0.0.1-r1470:  *               ^
libchromeos-ui-0.0.1-r1470:  * SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior base/files/dir_reader_linux.h:55:26 in
libchromeos-ui-0.0.1-r1470:  * base/files/dir_reader_linux.h:55:26: runtime error: load of misaligned address 0x7ffdae34d034 for type 'unsigned short', which requires 8 byte alignment
libchromeos-ui-0.0.1-r1470:  * 0x7ffdae34d034: note: pointer points here
libchromeos-ui-0.0.1-r1470:  *   00 00 00 00 18 00 04 2e  00 00 00 00 6f d9 8e 09  00 00 00 00 02 00 00 00  00 00 00 00 18 00 04 2e
libchromeos-ui-0.0.1-r1470:  *               ^
libchromeos-ui-0.0.1-r1470:  * SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior base/files/dir_reader_linux.h:55:26 in
libchromeos-ui-0.0.1-r1470: 
libchromeos-ui-0.0.1-r1470: 

 
Hitting this when trying to make libchrome build with ASan in  bug 809148 .
Components: Internals>Core
Project Member

Comment 3 by bugdroid1@chromium.org, Feb 7 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6f7ee4bf915be08d284f383940cab70f08d8740b

commit 6f7ee4bf915be08d284f383940cab70f08d8740b
Author: Manoj Gupta <manojgupta@google.com>
Date: Wed Feb 07 14:19:35 2018

Fix an alignment issue reported by ASan.

linux_dirent struct pointers are casted to buf[] array in a few
functions. However buf[]'s alignment (4) doesn't match the
alignment required by linux_dirent making ASan unhappy.

Fix this by forcing buf[]'s alignment to match linux_dirent struct.

This issue was discovered when I was trying to libbase work with ASan
on Chrome OS.

BUG= chromium:809786 
TEST=ASan's alignment errors are gone.

Change-Id: I9ec7f1436e5129fde836f5e5f97da7780560a153
Reviewed-on: https://chromium-review.googlesource.com/905806
Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534999}
[modify] https://crrev.com/6f7ee4bf915be08d284f383940cab70f08d8740b/base/files/dir_reader_linux.h

Status: Verified (was: Untriaged)
Labels: OS-Chrome
Labels: libcxx_asan

Sign in to add a comment