Update libjingle to 53856368.

R=mallinath@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/2366004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4941 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org
2013-10-07 23:32:02 +00:00
parent e0d55a0782
commit 7818752566
42 changed files with 694 additions and 202 deletions

View File

@@ -27,6 +27,10 @@
#include "talk/media/devices/libudevsymboltable.h"
#include <dlfcn.h>
#include "talk/base/logging.h"
namespace cricket {
#define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME LIBUDEV_SYMBOLS_CLASS_NAME
@@ -37,4 +41,30 @@ namespace cricket {
#undef LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST
#undef LATE_BINDING_SYMBOL_TABLE_DLL_NAME
bool IsWrongLibUDevAbiVersion(talk_base::DllHandle libudev_0) {
talk_base::DllHandle libudev_1 = dlopen("libudev.so.1", RTLD_NOW|RTLD_NOLOAD);
bool unsafe_symlink = (libudev_0 == libudev_1);
if (unsafe_symlink) {
// .0 and .1 are distinct ABIs, so if they point to the same thing then one
// of them must be wrong. Probably the old has been symlinked to the new in
// a misguided attempt at backwards compatibility.
LOG(LS_ERROR) << "libudev.so.0 and libudev.so.1 unsafely point to the"
" same thing; not using libudev";
} else if (libudev_1) {
// If libudev.so.1 is resident but distinct from libudev.so.0, then some
// system library loaded the new ABI separately. This is not a problem for
// LateBindingSymbolTable because its symbol look-ups are restricted to its
// DllHandle, but having libudev.so.0 resident may cause problems for that
// system library because symbol names are not namespaced by DLL.
LOG(LS_WARNING)
<< "libudev.so.1 is resident but distinct from libudev.so.0";
}
if (libudev_1) {
// Release the refcount that we acquired above. (Does not unload the DLL;
// whoever loaded it still needs it.)
dlclose(libudev_1);
}
return unsafe_symlink;
}
} // namespace cricket

View File

@@ -66,6 +66,14 @@ namespace cricket {
#undef LATE_BINDING_SYMBOL_TABLE_CLASS_NAME
#undef LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST
// libudev has changed ABIs to libudev.so.1 in recent distros and lots of users
// and/or software (including Google Chrome) are symlinking the old to the new.
// The entire point of ABI versions is that you can't safely do that, and
// it has caused crashes in the wild. This function checks if the DllHandle that
// we got back for libudev.so.0 is actually for libudev.so.1. If so, the library
// cannot safely be used.
bool IsWrongLibUDevAbiVersion(talk_base::DllHandle libudev_0);
} // namespace cricket
#endif // TALK_MEDIA_DEVICES_LIBUDEVSYMBOLTABLE_H_

View File

@@ -52,7 +52,8 @@ class ScopedLibUdev {
ScopedLibUdev() {}
bool Init() {
return libudev_.Load();
return libudev_.Load() &&
!IsWrongLibUDevAbiVersion(libudev_.GetDllHandle());
}
LibUDevSymbolTable libudev_;

View File

@@ -306,8 +306,9 @@ bool LinuxDeviceWatcher::Start() {
// We deliberately return true in the failure paths here because libudev is
// not a critical component of a Linux system so it may not be present/usable,
// and we don't want to halt LinuxDeviceManager initialization in such a case.
if (!libudev_.Load()) {
LOG(LS_WARNING) << "libudev not present/usable; LinuxDeviceWatcher disabled";
if (!libudev_.Load() || IsWrongLibUDevAbiVersion(libudev_.GetDllHandle())) {
LOG(LS_WARNING)
<< "libudev not present/usable; LinuxDeviceWatcher disabled";
return true;
}
udev_ = libudev_.udev_new()();