8 ms·
I think I found a Mac kernel bug (2018)
- IceWreck 4y agoIs this fixed now ?
- kayodelycaon 4y agoTested it on macOS 12.3. It's fixed.
- eesmith 4y agohttps://github.com/hishamhm/htop/issues/682#issuecomment-377061917 https://github.com/hishamhm/htop/issues/682#issuecomment-377... (the htop issue) says "according to others above, Apple has seemingly fixed this in 10.13.4."
- kayodelycaon 4y agoIt's freezing the querying of process status, which is very not good, but that isn't the entire kernel. If it was the entire kernel, you wouldn't be able to use Ctrl+C.
- anyfoo 4y agoYes. The title of the actual blog post seems more accurate.
- byteduck 4y agoMy naïve guess is that this is probably some sort of lock contention thing.
- alin23 4y agoCoincidentally, I also stumbled upon a way to make the kernel of Apple Silicon Macs panic and restart while developing the https://lowtechguys.com https://lowtechguys.com website. I distilled the problem in a repo so it can be reproduced with a single command: https://github.com/alin23/m1-panic https://github.com/alin23/m1-panic I found it while on Monterey and reported it 2 times through Feedback Assistant, but it still happens on Ventura. NOTE: Don't try it without saving all your work, it has a very high chance of restarting your computer forcefully.
- metadat 4y agoDo you know what the underlying problematic instruction sequence is? Or the precise location where it halts?
- alin23 4y agoI have no idea how I could find that, given that the system freezes completely. Maybe tracing the CPU instructions using LLDB might be possible, but the bug is most likely in the kernel code so this would not help much.
- catiopatio 4y agoYou can debug the kernel remotely over Ethernet: https://developer.apple.com/documentation/apple-silicon/debugging-a-custom-kernel-extension https://developer.apple.com/documentation/apple-silicon/debu... If that still fails, virtualization tools provide debugging interfaces you can use to step the execution of the virtualized CPU; e.g. VMware’s “debugStub” feature.
- Firmwarrior 4y agohaha, let's just let the Apple engineers on this thread figure that shit out
- sharikous 4y agoYou can't with Apple Silicon. It's shameful in my opinion. You still can load a core dump or view the state after a NMI but you can't run the kernel under a debugger.
- anon291 4y agoNot surprised. I wrote some kqueue code in C once that not only froze the Mac Kernel. It caused the entire computer to crash. I reported the issue to Apple, and never really heard back. They don't really care, as long as all the mac store apps work, in my experience. This was one call to kqueue with incorrect (but not particularly malicious, just normal C silliness) arguments, and boom!
- catiopatio 4y agoIs it still reproducible?
- anon291 4y agoI haven't had a mac in years. This was ~2010.
- JonathonW 4y agoBugs do get fixed (eventually; they're not always timely about it depending on severity), but Apple's feedback systems are and always have been a black hole. Basically, as a reporter, the only time you hear anything back from Apple about a bug report is if they need additional information; nothing else in their process is visible externally (until you go back and retest a few macOS releases later and your bug is or isn't fixed).
- amenghra 4y agoIn 2017, I wrote: Over the years, I have found numerous four different bugs in Apple's Calculator app. Here is today's wtf. Switch calculator to Scientific mode (⌘-2). Type: 1, 0, ^, 2, 0, enter, command-c (to copy), command-v (to paste) Expected result: an amount in $$$ I wouldn't mind having. Actual result: smallest number to appear 6 times in Pascal's triangle I reported all four and they never acknowledged any of them. They didn't fix any of them either. Doesn't motivate anyone to report more bugs to them. Some of the bugs got auto-closed after a while. Eventually, the bugs did get fixed, except the clipboard thing ¯\_(ツ)_/¯.
- jwilk 4y ago
- hinkley 4y agoIn the long dark ago there was a program called 'crashme' which would generate and run random code from user space to see if it could cause kernel panics.
- civopsec 4y agoDid it predate the “fuzzing” term?
- hinkley 4y agoBy at least a decade or two. The last time I saw one in the wild was probably around 1998, and it was a very old idea by then.
- jwilk 4y agohttps://people.delphiforums.com/gjc/crashme.html https://people.delphiforums.com/gjc/crashme.html
- xcdzvyn 4y agoI presume there's a low yet non-zero chance this inadvertently messes up something on the FS?
- resters 4y agoI asked ChatGPT to write some programs like this and it refused!
- deleted 4y ago[deleted]
- throwaway09223 4y agoIt's surprisingly easy to stumble into crash bugs when playing around with processes. I remember a decade or two ago I ran into a linux bug where the kernel would panic if a process was killed with an open descriptor on its /proc entries. That is: open /proc/$pid/something; kill -9 $pid #kernel crash We unfortunately discovered this when using fuser in a runscript to kill stale versions of a process, eg: sudo fuser --kill --namespace tcp 80 # kill whatever is listening on port 80 This would reliably cause kernel panics every so often, with one straightforward shell command. This ended up causing a big problem because it was part of a runscript which ran on bootup. But, it normally would do nothing so it went unnoticed until the app in question had a startup problem, leaving a copy of itself dangling listening on the port -- and instead of killing the old instance, it began crashing the entire system in a loop. Oops.
- teawrecks 4y agoIt was also unsurprisingly easy to crash a kernel a decade or two ago.
- jeffparsons 4y agoI remember a time when you had to be careful to not reveal your IP address to untrusted peers (e.g. on IRC) because a single specially malformed packet called the "Ping of Death" would reliably crash any internet-connected Windows PC. That was a wild time. Nobody talked about security back then. The idea that everything in our lives would eventually run over the internet just wasn't on people's minds.
- throwawaaarrgh 4y agoIt's very easy to freeze a system as a non-root user; cause too many interrupts, consume too many resources, etc. Many kinds of infinite loop will lock a system hard. Hell, you can crash systems with too many packets. And it's very easy to cause ps to hang. Many different kernel syscalls hang / are blocking. Mostly you see this with kernel features dependent on a resource that doesn't resolve itself, like a stuck disk, network filesystem, etc. But other various quirks of the system can cause blocking.
- adrian_b 4y agoWhile what you say is true, these are nonetheless kernel bugs. The kernel should never let any user process consume so many resources as to cause a system freeze. The kernel must not only be able to preempt any user process at any time, stopping it to consume all CPU time, but it must also prevent any user process to completely fill a SSD or HDD, because that can prevent many programs from starting.
- throwawaaarrgh 4y agoPreemptibility is an optional kernel design feature. Not all kernels have it and not in all ways. If it's intentionally designed that way it's not a bug. No kernel stops users from filling up disks (though some filesystems have such limits as features, which most of us turn off) Pretty much the only kernels that are totally preemptible are RTOS and they still don't stop you from shooting yourself in the foot.
- astrange 4y agoA computer's job is to do whatever you ask it to do; that includes using all disk or memory up, if that's what you really want. There's not really a way to prevent breaking the OS (or just using up the battery) without preventing you from using all the computer you bought. A phone is different since it always has to be able to make phone calls.
- deleted 4y ago[deleted]
- 4y ago
- deleted 4y ago[deleted]
- saagarjha 4y agoPast discussion of this bug: https://news.ycombinator.com/item?id=16082861 https://news.ycombinator.com/item?id=16082861
- dang 4y agoThanks! Macroexpanded: I think I found a Mac kernel bug? - https://news.ycombinator.com/item?id=16250677 https://news.ycombinator.com/item?id=16250677 - Jan 2018 (117 comments)