Linux ~4.7 or so fixed a bug in fadvise, specifically FADV_DONTNEED, that incorrectly rounded page boundaries to the effect of making some calls less effective. Found and fixed by a developer who wondered why his page cache was filling up, even though the backup software he used made use of DONTNEED :) The bug was in from day 1.
How I Found a 20-Year-Old Linux Kernel Bug
11–20 of 45 posts
Re: How I Found a 20-Year-Old Linux Kernel Bug
#12did this guy get a bug bounty?
Re: How I Found a 20-Year-Old Linux Kernel Bug
#13given enough eyeballs, all bugs are shallow
Re: How I Found a 20-Year-Old Linux Kernel Bug
#14It's always nice to see fixes of problems found with improved testing. It would be nice to see something like Haskells QuickCheck rigorously applied on the majority of the kernel functions/interfaces.
Re: How I Found a 20-Year-Old Linux Kernel Bug
#15given enough eyeballs, all bugs are shallow
Re: How I Found a 20-Year-Old Linux Kernel Bug
#16Re: How I Found a 20-Year-Old Linux Kernel Bug
#17Linux ~4.7 or so fixed a bug in fadvise, specifically FADV_DONTNEED, that incorrectly rounded page boundaries to the effect of making some calls less effective. Found and fixed by a developer who wondered why his page cache was filling up, even though the backup software he used made use of DONTNEED :) The bug was in from day 1.
https://github.com/torvalds/linux/commit/18aba41cbfbcd138e9f...
Re: How I Found a 20-Year-Old Linux Kernel Bug
#18given enough eyeballs, all bugs are shallow
In particular it seems to me like this could have been fixed with a better, machine-readable description of the types/structures for each ioctl, plus a static analysis tool that makes sure that the kernel does a copy_from_user on exactly what the documented input types are and no more or less. There is already a halfhearted attempt to encode type information in ioctls (the _IOR, _IOW, etc. macros), so I think this is doable. I'm not sure how much work is required to trace copy_from/to_user statically, but it certainly seems like it would be far less work than 20 years of people using these syscalls.
As another example, I think "given enough eyeballs, all bugs are shallow" would be a poor reason to eschew writing tests for your code.
Re: How I Found a 20-Year-Old Linux Kernel Bug
#19Re: How I Found a 20-Year-Old Linux Kernel Bug
#20I have not ready anything about this bug, other than the very short description in the linked blog, however this seems like a bug that would have been flagged by a static analysis tool. I know they've been used on the kernel (e.g. Coverity) Very surprised it survived until now.
the syscall function takes a void* parameter then does a copy from user space into the kernel using the wrong target type/sizeof. i think it works because the incorrect type was a superset of the correct type. i don't think any static analyser could catch this. proposed patch here: https://bugzilla.kernel.org/attachment.cgi?id=256997&action=...