gliaskos / freebsd-chromium

Chromium port for FreeBSD
47 stars 14 forks source link

Accessing USB device from an App make chromium to crash #101

Open alexdupre opened 6 years ago

alexdupre commented 6 years ago

I'm trying to use Chrome extensions that interact with USB devices, like Trezor or Ledger wallets, but chrome crashes as soon as they try to connect.

You can easily reproduce the issue by simply installing the extension at https://wallet.trezor.io (no need to have any device)

alexdupre commented 6 years ago

For the records, I've tried to build the FreeBSD port with the DEBUG flag to try to get a stacktrace, but it fails to compile with the following error:

[12237/32200] python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="llvm-nm40" --sofile="./libgfx.so" --tocfile="./libgfx.so.TOC" --output="./libgfx.so" -- clang++40 -shared -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--no-as-needed -lpthread -Wl,--as-needed -fuse-ld=lld -m64 -Wl,--gdb-index -Wl,--export-dynamic -L/usr/local/lib -o "./libgfx.so" -Wl,-soname="libgfx.so" @"./libgfx.so.rsp" FAILED: libgfx.so libgfx.so.TOC python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="llvm-nm40" --sofile="./libgfx.so" --tocfile="./libgfx.so.TOC" --output="./libgfx.so" -- clang++40 -shared -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--no-as-needed -lpthread -Wl,--as-needed -fuse-ld=lld -m64 -Wl,--gdb-index -Wl,--export-dynamic -L/usr/local/lib -o "./libgfx.so" -Wl,-soname="libgfx.so" @"./libgfx.so.rsp" /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::GetFallbackFonts(gfx::Font const&)): undefined symbol 'FcPatternCreate' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::GetFallbackFonts(gfx::Font const&)): undefined symbol 'FcPatternAdd' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::GetFallbackFonts(gfx::Font const&)): undefined symbol 'FcConfigSubstitute' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::GetFallbackFonts(gfx::Font const&)): undefined symbol 'FcDefaultSubstitute' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::GetFallbackFonts(gfx::Font const&)): undefined symbol 'FcFontSort' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::GetFallbackFonts(gfx::Font const&)): undefined symbol 'FcPatternGetString' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::GetFallbackFonts(gfx::Font const&)): undefined symbol 'FcFontSetDestroy' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::GetFallbackFonts(gfx::Font const&)): undefined symbol 'FcPatternDestroy' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFontSet::CreateFcFontSetForLocale(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)): undefined symbol 'FcPatternCreate' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFontSet::CreateFcFontSetForLocale(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)): undefined symbol 'FcPatternAddString' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFontSet::CreateFcFontSetForLocale(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)): undefined symbol 'FcPatternAddBool' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFontSet::CreateFcFontSetForLocale(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)): undefined symbol 'FcConfigSubstitute' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFontSet::CreateFcFontSetForLocale(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)): undefined symbol 'FcDefaultSubstitute' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFontSet::CreateFcFontSetForLocale(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)): undefined symbol 'FcPatternDel' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFontSet::CreateFcFontSetForLocale(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)): undefined symbol 'FcFontSort' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFontSet::CreateFcFontSetForLocale(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)): undefined symbol 'FcPatternDestroy' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFontSet::FillFallbackList()): undefined symbol 'FcPatternGetBool' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFontSet::FillFallbackList()): undefined symbol 'FcPatternGetString' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFontSet::FillFallbackList()): undefined symbol 'FcPatternGetCharSet' /usr/local/llvm40/bin/ld.lld: error: ../../ui/gfx/font_fallback_linux.cc:(function gfx::(anonymous namespace)::CachedFont::GetFontName(_FcPattern*)): undefined symbol 'FcPatternGetString' /usr/local/llvm40/bin/ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors) clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)

cpu82 commented 6 years ago

Support for USB U2F devices was added in r455495.

alexdupre commented 6 years ago

It doesn't crash anymore, but also it doesn't seem to recognize any plugged-in device, even after changing the /dev/uhid and /dev/usb/ permissions.

cpu82 commented 6 years ago

Do you have security/libu2f-host installed?

Please see PR196754 for further details.

alexdupre commented 6 years ago

As far as I can see that port simply installs a set of devd rules to change the device permissions, the same thing I did. The chromium patches are expected to add support for any HID device or just for U2F ones?

cpu82 commented 6 years ago

The chromium patches add support for both types of devices. It should work (not tested), but you have to add the UDEV rules.

https://github.com/trezor/trezor-common/blob/master/udev/51-trezor.rules

alexdupre commented 6 years ago

The UDEV rules are just the Linux equivalent of the FreeBSD devd rules to change permissions.

cpu82 commented 6 years ago

Yes of course, we use devd rules. Your best bet is to ask @gonzoua. In fact, he added support for USB U2F devices.