dom/webauthn/libudev-sys is third party code
Categories
(Core :: DOM: Web Authentication, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox85 | --- | fixed |
People
(Reporter: Sylvestre, Assigned: Gankra)
Details
Attachments
(1 file, 1 obsolete file)
And we aren't using the latest version, isn't in third party and don't have a checksum file
Reporter | ||
Comment 1•4 years ago
|
||
And move from 0.1.3 to 0.1.4
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/156832378185 move dom/webauthn/libudev-sys in third_party/rust r=jcj
Comment 3•4 years ago
|
||
Backed out changeset 156832378185 (bug 1619094) for build bustages. CLOSED TREE
Log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=291466082&repo=autoland&lineNumber=12399
Push with failures:
https://treeherder.mozilla.org/#/jobs?repo=autoland&group_state=expanded&revision=15683237818591d8c552eaf5ca8cc063e3e3ff32
Backout:
https://hg.mozilla.org/integration/autoland/rev/898a5cdb553409bc789aada28ffe2315ef0de161
Reporter | ||
Comment 4•4 years ago
|
||
Not sure what is going on, I will have a look
Comment 5•4 years ago
|
||
The priority flag is not set for this bug.
:jcj, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•4 years ago
|
Comment 6•4 years ago
|
||
There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:Sylvestre, could you have a look please?
For more information, please visit auto_nag documentation.
Reporter | ||
Comment 7•4 years ago
|
||
Still have the patch in review, I will work on it
Reporter | ||
Comment 8•4 years ago
|
||
JC, to change my mind, I had a new look to this one.
Moving place requires to update libudev to 0.1.4.
Two things are a bit confusing:
- it requires the package libudev-dev for the pkg-config task (and probably the header). It wasn't the case before.
- it builds but fails to link
6:52.03 ld.lld: error: undefined symbol: udev_enumerate_add_match_subsystem
6:52.03 >>> referenced by enumerator.rs:49 (/home/sylvestre/dev/mozilla/mozilla-central.hg/third_party/rust/libudev/src/enumerator.rs:49)
6:52.03 >>> authenticator-abc69fe5e60fbfa2.authenticator.dn9qihlx-cgu.9.rcgu.o:(libudev::enumerator::Enumerator::match_subsystem::ha27796f8f8e35c01) in archive /home/sylvestre/dev/mozilla/mozilla-central.hg/obj-x86_64-pc-linux-gnu/x86_64-unknown-linux-gnu/debug/libgkrust.a
So, my question is simple: was it really compiled and linked before? :)
Comment 9•4 years ago
|
||
I mean, it was... that is a fairly important part, and no one is complaining about it being broken on udev-using platforms.
Perhaps this needs to be explicitly added to authenticator-rs's Cargo.toml, and then we can resolve whatever the link error is, there.
I've opened https://github.com/mozilla/authenticator-rs/issues/128 to look into this in the lib, maybe with an explicit dependency, or maybe a switch to https://crates.io/crates/udev - donno yet.
Updated•4 years ago
|
Reporter | ||
Comment 10•4 years ago
|
||
jcj, Do you think you own this bug? Or delegate it to someone who know vendoring rust code better than I? :)
Comment 11•4 years ago
|
||
I'm taking a look at it right now, and I think, uh, dom/webauthn/libudev-sys/ is very much not the crate in crates.io; it looks like Tim rewrote it from scratch to support dynamic loading, since Firefox has to dynamically load libudev.so.
It's deliberate that it's name-colliding with the crate of the same name, as it's basically a monkeypatch. As a -sys
crate, it's just the extern "C" functions and structs, and won't change much.
But the key pieces there are the lazy_static dlopen and the library tracking.
Turns out I opened an issue on the parent lib in 2017: https://github.com/dcuddeback/libudev-sys/issues/1 .
What I think I need to do here is to take this bug and do two things:
- provide a PR to
dcuddeback/libudev-sys
with the mozilla-central changes - add a README to the m-c folder explaining all this.
Then sometime in the future we can look to vendor in the original lib, if our PR gets accepted.
Let me know if you want some other outcomes.
Comment 12•4 years ago
|
||
uh, oof, actually the whole lib.rs
has to get replaced. Even if I make dynamic loading a feature on the crate, I'd basically need to make build.rs
choose between completely different implementations.
I am guessing we were hoping bindgen
would magic itself dynamic ffi, but that appears to still be an open feature request.
So providing a PR back to the author isn't going to be a quick process. Maybe we can just put a README in-tree? Maybe also a comment in one of the gecko .toml
s ?
Comment 13•4 years ago
|
||
for when it's relevant: https://github.com/jcjones/libudev-sys has the m-c changes in it. I'm just going to stop there for now.
Assignee | ||
Comment 14•3 years ago
|
||
So just confirming my understanding here -- the reason we need to actually dlopen libudev is so we can allow the linux gamepad system to not exist?
Assignee | ||
Comment 15•3 years ago
|
||
Wait sorry, even stronger: so that we can defer the cost of the dynamic linker looking up libudev until you visit a page that uses the JS gamepad API? To make process startup times faster? Is this a general policy, or just something that we took special care with udev for?
Reporter | ||
Comment 16•3 years ago
|
||
Chris, do you have an opinion on comment #15? thanks!
Comment 17•3 years ago
|
||
(In reply to Alexis Beingessner [:Gankra] from comment #15)
Wait sorry, even stronger: so that we can defer the cost of the dynamic linker looking up libudev until you visit a page that uses the JS gamepad API? To make process startup times faster? Is this a general policy, or just something that we took special care with udev for?
Sorry to not be able to provide a more certain answer here, but I wasn't around when the design decisions behind this were being made (and afaik everyone that was around no longer works here). I've been working on this code for a little while now, so I'll give my best educated guess.
My impression is that a fair bit of effort was put into making all the Gamepad API code almost-completely dynamic. (Probably because gamepad use in Firefox is relatively rare.)
If the JS Gamepad API isn't being used by a content process, GamepadManager
and GamepadPlatformService
won't be allocated, the IPDL channel between them won't be created, and none of the OS-specific APIs will be initialized (RawInput
/XInput
on Windows, IOHIDManager
on Darwin, libudev
on Linux). These things are also eagerly destroyed as soon as all JS Gamepad
objects are finalized. In effect, the gamepad infrastructure has almost-zero cost if you aren't actively using it.
So my best guess would be that dynamically loading udev is just a downstream consequence of the fact that all Gamepad stuff is dynamically loaded, and not anything special about udev specifically. We do the same thing on Windows with xinput1_4.dll
.
Aside
I don't completely understand everything up there ^^^ about this Rust libudev-sys
crate, but AFAICT the Gamepad code does the dlopen()
and dlsym()
calls itself here and doesn't invoke any Rust functions to do it. I don't know if this "monkey patching" thing changes that, but are you certain that the Gamepad code is using this Rust crate?
Assignee | ||
Comment 18•3 years ago
|
||
Oh ok I see, I just instinctively assumed the rust uses of libudev were for the same reasons as the cpp ones, and that's wrong.
Actually, we only use libudev-sys for the authenticator
crate, which in turn is pulled in by gkrust-shared... but then seemingly never used?
Is authenticator-rs abandoned/dead code?
Assignee | ||
Comment 19•3 years ago
|
||
Or perhaps it hasn't actually been fully hooked up yet.
Assignee | ||
Comment 20•3 years ago
|
||
Comment 21•3 years ago
|
||
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/176c0f345637 Properly explain our fork of libudev-sys. r=sylvestre DONTBUILD
Comment 22•3 years ago
|
||
bugherder |
Description
•