GPSD 3.12 has shipped – bulletproofed from below
I’ve been radio silent the last couple of weeks mainly because I’ve been concentrating furiously on getting a GPSD release out the door. This one is a little more noteworthy than usual because it may actually have fixed a well-hidden flaw or vulnerability of some significance.
Regular readers may recall from back in 2013 that I published a heads-up titled No, GPSD is not the battery-killer on your Android! addressing a power-drain bug reported from a handful of Android phones.
I believed at the time that the proximate cause of the bug was in the kernel serial device-drivers somewhere specific to particular hardware on those phones. I still believe that, because if it had been a purely GPSD problem the error would likely have been much more widespread and I’d have been flooded with complaints.
However, I’ve been concerned ever since that GPSD might not have been doing everything it could to armor itself against bugginess in the layers below it. And a couple of weeks ago I found a problem…
The problem was that the particular combination of options I was using led tty input to be presented to the select loop a character at a time. Oops! This is perfect for minimum fix latency but not so good for avoiding power drain – it means that in the normal course of things the main loop could spin pretty fast.
I had CPU-usage measurements indicating this hadn’t been a problem, including on low-power ARM processors like they put in phones. On the other hand, there were those scattered reports of excess power usage.
So I set out to change this, going to blocking I/O in which data from the device would be accumulated in the kernel tty layer and released to GPSD’s main loop in bursts, meaning it wouldn’t spin as often.
That change in itself was not difficult, but it produced some problems in my regression-test framework that took a while to iron out. Nothing difficult, but a lot of fussy detail work.
Result: 3.12 works, it’s testable, and I think I may have removed the vulnerability that made the battery-eater bug possible.
Eric S. Raymond's Blog
- Eric S. Raymond's profile
- 140 followers
