bemoody / lightwave

LightWAVE is a lightweight waveform and annotation viewer and editor.
http://physionet.org/lightwave/
13 stars 6 forks source link

Use of newfstatat on newer glibc #3

Open bemoody opened 1 year ago

bemoody commented 1 year ago

sandboxed-lightwave (0.71) works on glibc 2.31-13+deb11u6 (bullseye) and doesn't work on glibc 2.36-9 (bookworm).

The reason is that glibc now uses the newfstatat system call, instead of fstat or fstat64, to implement the fstat library function.

(The LightWAVE sandbox can't allow newfstatat(fd, "", &s, AT_EMPTY_PATH) - equivalent to fstat(fd, &s), which is safe - without also allowing newfstatat(fd, "foo", &s, AT_EMPTY_PATH) - roughly equivalent to fchdir(fd), stat("foo", &s), which is dangerous. The design of AT_EMPTY_PATH is silly.)

Now, this is really only a theoretical problem, for a bunch of reasons:

That said, I don't like the idea of releasing lightwave with a known security vulnerability. These are the options I see:

bemoody commented 1 year ago

or:

bemoody commented 1 year ago

For what it's worth, this issue has supposedly been fixed in glibc master, and presumably will be in 2.39, on some, but not all architectures: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=551101e8240b7514fc646d1722f8b79c90362b8f

According to commenters on LWN (https://lwn.net/Articles/944214/), there isn't currently a way to fix this for all architectures: fstat isn't Y2038-safe on 32-bit architectures, and some newer architectures don't have fstat at all. As the LWN article notes, this is also a performance issue, so maybe a future kernel will rectify it.