prefiks / u2f4moz

U2F support extension for Firefox
GNU Lesser General Public License v2.1
197 stars 15 forks source link

High CPU load (Firefox 51.0.1 x64 Linux) #51

Open rysiekpl opened 7 years ago

rysiekpl commented 7 years ago

After using a YubiKey with this extension to sign-in to a service (self-hosted GitLab instance) in a private window, there is latent very high CPU load generated by the firefox process. The only way to solve it is to restart Firefox (and not use YubiKey with it during sign-in).

prefiks commented 7 years ago

I can't reproduce that in my setup, extension looks like is idle when nothing is using it.

Could you please try to reproduce this and when this happens could you try grabbing logs from extension to see if there is something in them? (on add-ons page click on preferences button for u2f extension and there should be "show logs" button here, and copy/paste it). I don't need to see exact content of communication with your device so you can remove lines that contain json data, it's not particular unsafe to do that, but i really don't need to see it.

Also would you be able to open about:performance page when that happens and see what it shows fro u2f extension?

rysiekpl commented 7 years ago

Logs below. This happens on a clean Firefox profile (no other extensions apart from this and "Ubuntu Modifications"), both in regular and private window. On GitHub for example, the CPU revvs up either after I touch the button on my YubiKey, or after waiting for that to happen timeouts.

EB1 sign https://github.com [{version:"U2F_V2", challenge:"...", keyHandle:"...", appId:"https://github.com/u2f/trusted_facets"}] null EB2 /home/rysiek/.mozilla/firefox/cu250uqq.U2F Test/extensions/u2f4moz@prefiks.org/bin/linux_x86_64-gcc3/u2f EB3 ({killed:false, exitCode:(void 0), signalCode:(void 0), stdin:{readable:false, writable:false, encoding:null}, stdout:{readable:false, writable:false, encoding:null}, stderr:{readable:false, writable:false, encoding:null}}) stdin s0012000100e3https://github.com{"version":"U2F_V2","challenge":"...","keyHandle":"...","appId":"https://github.com/u2f/trusted_facets"} EBD b device waits for button press EBD r01a8{ "signatureData": "...", "clientData": "...", "keyHandle": "..." } exit null (void 0) showLogsCalled

prefiks commented 7 years ago

Thanks, let me try digest this and see if i would find something that can cause this.

prefiks commented 7 years ago

There is one suspicious thing in that log - it may be that binary part that talk to u2f device doesn't quit as it's expected. I am adding some extra measures to code that is responsible so this may help in your case, but if you will be able to run another test for me it could help if it's that - to do that after you do execute operation that use u2f could you open new tab in firefox and type about:performance in address field and see if u2f extension is shown as run slow (results aren't visible immediately, you may wait 10 or so seconds). Also in system shell could you run "top" command and see which process is using cpu? Is that firefox, or maybe process named u2f or something else?

rysiekpl commented 7 years ago
  1. no, the extension does not show up in the about:performance tab
  2. the process that is running at 120-140% CPU is firefox

However, this CPU-spike only happens when a). I have the extension enabled; b). I try to log-in to a site that asks for U2F and the extension asks me to touch my key. When I touch it or it times out, the spike happens immediately afterwards (i.e. after touch, or after timeout).