Live data from Hacker News

Kernel bugs hide for 2 years on average. Some hide for 20

pebblebed.com

131–140 of 186 posts

Re: Kernel bugs hide for 2 years on average. Some hide for 20

#131
post #87

Earlier quoted context omitted.

> To what extent do you trust "well-tested" code? I don't, which is why I use Qubes OS providing security through compartmentalization.

Then the question becomes: to what extent do you trust Xen and Qubes RPC?

I do have to somewhat trust Xen, but Qubes' isolation relies on hardware virtualization (VT-d), which statistically has much less security issues than Xen itself. Most Xen advisories do not affect Qubes: https://www.qubes-os.org/security/xsa/

Re: Kernel bugs hide for 2 years on average. Some hide for 20

#132

Before the "rewrite it in Rust" comments take over the thread: It is worth noting that the class of bugs described here (logic errors in highly concurrent state machines, incorrect hardware assumptions) wouldn't necessarily be caught by the borrow checker. Rust is fantastic for memory safety, but it will not stop you from misunderstanding the spec of a network card or writing a race condition in unsafe logic that int…

Thanks for raising this. It feels like evangelists paint a picture of Rust basically being magic which squashes all bugs. My personal experience is rather different. When I gave Rust a whirl a few years ago, I happened to play with mio for some reason I can't remember yet. Had some basic PoC code which didn't work as expected. So while not being a Rust expert, I am still too much fan of the scratch your own itch philosophy, so I started to read the mio source code. And after 5 minutes, I found the logic bug. Submitted a PR and moved on. But what stayed with me was this insight that if someone like me can casually find and fix a Rust library bug, propaganda is probably doing more work then expected. The Rust craze feels a bit like Java. Just because a language baby-sits the developer doesn't automatically mean better quality. At the end of the day, the dev needs to juggle the development process. Sure, tools are useful, but overstating safety is likely a route better avoided.

Re: Kernel bugs hide for 2 years on average. Some hide for 20

#133

Before the "rewrite it in Rust" comments take over the thread: It is worth noting that the class of bugs described here (logic errors in highly concurrent state machines, incorrect hardware assumptions) wouldn't necessarily be caught by the borrow checker. Rust is fantastic for memory safety, but it will not stop you from misunderstanding the spec of a network card or writing a race condition in unsafe logic that int…

> It is worth noting that the class of bugs described here (logic errors in highly concurrent state machines, incorrect hardware assumptions) While the bugs you describe are indeed things that aren't directly addressed by Rust's borrow checker, I think the article covers more ground than your comment implies. For example, a significant portion (most?) of the article is simply analyzing the gathered data, like groupin…

Why doesn't it surprise me that the CAN bus driver bugs have the longest average lifetime?

Re: Kernel bugs hide for 2 years on average. Some hide for 20

#134

Earlier quoted context omitted.

I guess because I work in security the "unintentionally" doesn't matter much to me.

But it matters for detection time, because there's a lot more "normal" use of any given piece of code than intentional attempts to break it. If a bug can't be triggered unintentionally it'll never get detected through normal use, which can lead to it staying hidden for longer.

That's not really contested? The statement was that longer detection time indicates lower severity.

Re: Kernel bugs hide for 2 years on average. Some hide for 20

#136

Earlier quoted context omitted.

It depends what they mean by some of these: are the state machine race conditions logic races (which Rust won’t trivially solve) or data races? If they are data races, are they the kind of ones that Rust will catch (missing atomics/synchronization) or the ones it won’t (bad atomic orderings, etc.). It’s also worth noting that Rust doesn’t prevent integer overflow, and it doesn’t panic on it by default in release buil…

I don’t think that the parent comment is saying all of the bugs would have been prevented by using Rust. But in the listed categories, I’m equally skeptical that none of them would have benefited from Rust even a bit.

That’s not my point - just that “state machine races” is a too-broad category to say much about how Rust would or wouldn’t help.

Re: Kernel bugs hide for 2 years on average. Some hide for 20

#137

Earlier quoted context omitted.

What warranties? I assume you’re comparing it to ext4 and not e.g. ZFS?

Here are a few - mandatory byte-range locks enforced by the kernel - explicit sharing modes - guarantees around write ordering and durability - safe delete-on-close - first-class cache coherency contracts for networked access POSIX aims for portability while NTFS/Win32 aims for explicit contracts and enforced behavior. For apps assuming POSIX semantics (e.g. git) NTFS feels rigid and weird. Coming the other way from…

These are pretty much all about mandatory locking. Which giveth and taketh away in my experience. I’ve had substantially fewer weird file handling bugs in my Linux code than my Windows code. POSIX is very loosey-goosey in general, but Linux’s VFS system + ext4 has a much stronger model than the general POSIX guarantees.

`FILE_FLAG_DELETE_ON_CLOSE`’s equivalent on Posix is just rm. Windows doesn’t let you open new handles to `FILE_FLAG_DELETE_ON_CLOSE`ed files anyway, so it’s effectively the same. The inode will get deleted when the last file description is removed.

NFS is a disaster though, I’ll give you that one. Though mandatory locks on SMB shares hanging is also very aggravating in its own right.

Re: Kernel bugs hide for 2 years on average. Some hide for 20

#138

Earlier quoted context omitted.

> …lurked for years and even decades. Heartbleed comes to mind. I don’t know much about Heartbleed, but Wikipedia says: > Heartbleed is a security bug… It was introduced into the software in 2012 and publicly disclosed in April 2014. Two years doesn’t sound like “years or even decades” to me? But again, I don’t know much about Heartbleed so I may be missing something. It does say it was also patched in 2014, not just…

This may just be me misremembering, but as I recall, the bug of Heartbleed was ultimately a very complex macro system which supported multiple very old architectures. The bug, IIRC, was the interaction between that old macro system and the new code which is what made it hard to recognize as a bug. Part of the resolution to the problem was I believe they ended up removing a fair number of unsupported platforms. It als…

Maybe you are thinking of ShellShock

https://en.wikipedia.org/wiki/Shellshock_(software_bug)

The bug was introduced into the code in 1989, and only found and exploited in 2014.

Re: Kernel bugs hide for 2 years on average. Some hide for 20

#139

Earlier quoted context omitted.

Mach is not a very good microkernel at all, because the overhead is much higher than necessary. The L4 family’s IPC design is substantially more efficient, and that’s why they’re used in actual systems. Fuchsia/Zircon have improved on the model further. Someone will of course bring up XNU, but the microkernel aspect of it died when they smashed the FreeBSD kernel into the codebase. DriverKit has brought some userspac…

> Mach is not a very good microkernel at all, because the overhead is much higher than necessary. The L4 family’s IPC design is substantially more efficient, and that’s why they’re used in actual systems. As opposed to Mach, which is not used in any actual systems

I mentioned XNU below. It doesn’t really count as a microkernel if you, you know, don’t actually use the microkernel part. At least for the 30 years between the FreeBSD collision and the introduction of DriverKit, which does most of its IPC through shared memory (because the mach ports are not efficient enough, I would assume).

Re: Kernel bugs hide for 2 years on average. Some hide for 20

#140

[flagged]

>hide for years in application code

Yea, it's pretty common. We had a customer years ago that was having a rare and random application crash under load. Never could figure out where it was from. Quite some time later a batch load interface was added to the app and with the rate things were input with it the crash could be triggered reliably.

It's something else that's added/changed in the application that eventually makes the bug stand out.

Post reply on HN