Skip to content

Commit

Permalink
MemorySanitizer: improve the udev dynamic loading hack.
Browse files Browse the repository at this point in the history
Use the unversioned symlink to ensure we always load instrumented udev.

BUG=437464, 438427
R=thestig@chromium.org, reillyg@chromium.org

Review URL: https://codereview.chromium.org/755873003

Cr-Commit-Position: refs/heads/master@{#307067}
  • Loading branch information
earthdok authored and Commit bot committed Dec 5, 2014
1 parent 914f82d commit cec4406
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions device/udev_linux/udev0_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ bool Udev0Loader::Init() {
if (lib_loader_)
return lib_loader_->loaded();
lib_loader_.reset(new LibUdev0Loader);
#if defined(MEMORY_SANITIZER)
// Temporary hack: rely on the symlink to pick up whichever *instrumented*
// version of libudev we have, be it libudev0 or libudev1. crbug.com/437464
// TODO(earthdok): Remove this hack after upgrading our LKGR builders.
return lib_loader_->Load("libudev.so");
#else
return lib_loader_->Load("libudev.so.0");
#endif
}

const char* Udev0Loader::udev_device_get_action(udev_device* udev_device) {
Expand Down
2 changes: 1 addition & 1 deletion device/udev_linux/udev_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ UdevLoader* UdevLoader::Get() {
// will only build an instrumented copy of libudev0 and not libudev1. If one
// runs the binary on Trusty, it will end up loading an uninstrumented
// libudev1 at run time. http://crbug.com/437464
// TODO(thestig): Remove this after upgrading our MSAN LKGR builders to
// TODO(earthdok): Remove this after upgrading our MSAN LKGR builders to
// Trusty.
#if !defined(MEMORY_SANITIZER)
udev_loader.reset(new Udev1Loader);
Expand Down

0 comments on commit cec4406

Please sign in to comment.