HNHacker News
TopNewBestAskShowJobs

ksml

860 karma · joined March 22, 2015

ryan at reberhardt com
submissionscomments
ksml··on Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
Flutter feels so strange to me. In many ways, it's reimplementing major parts of a browser, compiled to (web)assembly, running inside a browser compiled to assembly... Watch five years from now someone add a low-level programming framework to Flutter and then soneone else reimplement the browser using that
ksml··on Remote Code Execution Found in CocoaPods
That was really short and sweet. Thanks for the writeup!
ksml··on Milky Way, 12 years, 1250 hours of exposures and 125 x 22 degrees of sky
Note that these images are made from many exposures that are then processed and combined, and the total exposure time is given. The individual exposure times were probably long, but I'm guessing on the order of minutes, not hours. (Actually, if you photograph stars with an exposure time that is too long, then you get star trails in the image.)
ksml··on Barcode scanner app on Google Play infects 10M users with one update
Also if you were slow updating, you could avoid critical security patches (and many people did)
ksml··on A Look at iMessage in iOS 14
I read it as GP arguing we don't do enough of it.
ksml··on Zoom executive charged with disrupting meetings commemorating Tiananmen Square
Because it works really well (at least from my experience and others I've heard). It has a solid (and really useful) feature set, and I generally have lower latency and less CPU usage than any other video conferencing system I've tried.
ksml··on I Bought Apple Silicon
This is my first time hearing Apple refurbished meaning old store display model. I always thought refurbished machines were products that other people bought new and returned, and then Apple restored them to like-new condition. There seem to be a lot more refurbs available than I would imagine there are old display models. Now I'm curious, though, does anyone know more about how (Apple official) refurbs are sourced?
ksml··on How Pfizer delivered a Covid vaccine in record time
Serious question, can someone who downvoted the parent comment please explain why? This sounds in line with what I've heard about treatment of African Americans by the US medical system, so I would love to hear if there is evidence to say this is wrong.
ksml··on My First Kernel Module: A Debugging Nightmare
Ah! This would have been really helpful!
ksml··on My First Kernel Module: A Debugging Nightmare
Every C Playground program runs in a Docker container, so this is already perfectly set up for CRIU. I might give it a try!
ksml··on My First Kernel Module: A Debugging Nightmare
Concurrency is still hard for me, but I do find it getting much easier over the years :) thanks for the story!
ksml··on My First Kernel Module: A Debugging Nightmare
I hadn't considered eBPF because I needed some pretty obscure information from the kernel internals (i.e. the addresses of the `struct file`s) and I didn't realize eBPF was as capable as it is. Another commenter suggested trying it, though, so I'm checking it out now!

I did use printk for debugging, but I (incorrectly) assumed it could block. Another commenter pointed out that this is not the case. TIL!

The gdb link looks very helpful and I'll try that next time. Thanks for linking that.

ksml··on My First Kernel Module: A Debugging Nightmare
This is really good to know. I had assumed it could block when allocating memory for the formatted string buffer, but the rationale explained in that article makes a lot of sense. Being able to use printk simplifes things a lot.
ksml··on My First Kernel Module: A Debugging Nightmare
This is really interesting; I hadn't realized it was so capable/general. I'll look into this. Thanks for the references!
ksml··on My First Kernel Module: A Debugging Nightmare
Oh, that's clever! I might try that. I really don't feel comfortable building my own kernel
ksml··on My First Kernel Module: A Debugging Nightmare
Thank you! It's open source, and I'd love to hear if you have any suggestions for it. Would also love to see what you're building!
ksml··on My First Kernel Module: A Debugging Nightmare
That's a good point. I'm hoping that this never gets hit, and if that line ever appears in the logs, then things are already broken. However, it's probably better to improve the failure mode where possible :)

[edit] and yes, since we break and don't follow the `next` pointer in the linked list, that also shouldn't cause any problems.

[edit 2] a sibling comment by cesarb pointed out that printk actually does not block, since it's important for it to be usable in critical sections to debug when the kernel gets into trouble

ksml··on My First Kernel Module: A Debugging Nightmare
Elixir was extremely helpful to me! It didn't always help me understand _why_ code was written the way it was (hence my incorrect use of rcu_read_lock), but it was very helpful to see some examples.
ksml··on My First Kernel Module: A Debugging Nightmare
I can't do that across processes, though, can I? (to see whether two processes have file descriptors pointing to the same open file) edit -- it does look like it works cross-process!

I hadn't heard of CRIU. I'll check that out. (edit: CRIU looks super useful. I think the speed/overhead of snapshotting will decide whether I can use it for this project, but I can imagine it being handy in the future regardless. Thanks for the link.)

ksml··on My First Kernel Module: A Debugging Nightmare
I actually cannot get enough information from doing that. Crucially, I need to be able to recognize whether two file descriptors point to the same open `file_struct`. (To be clear, this isn't the same as whether they're pointing to the same file path. I need to know when the two file descriptors are sharing the same cursor.) There is no way to do this using existing APIs, because there is nothing identifying a `struct file` besides the memory address of the struct. (The "open file IDs" I mention are hashes of the `file_struct` address.)

I did spend a lot of time trying to avoid writing a kernel module, and this was the only way I could find to do it :)

ksml··on My First Kernel Module: A Debugging Nightmare
That is really interesting and good to know -- thanks for that!

I hope C Playground is helpful, and I'm building it with teaching in mind. If you teach anywhere and could find it useful, let me know!

ksml··on My First Kernel Module: A Debugging Nightmare
I hadn't considered this! Can eBPF be used to access arbitrary kernel data structures, though?
ksml··on My First Kernel Module: A Debugging Nightmare
Hi HN, this was my first attempt at writing any sort of kernel code. I would love to hear your thoughts on this experience and on the fixes I applied, especially from anyone with more Linux experience than me :)
ksml··on Let’s build a high-performance fuzzer with GPUs
That sounds neat and I'd love to hear about it if you ever work on it!
ksml··on Let’s build a high-performance fuzzer with GPUs
Thanks so much for checking this out!

Like tyoma said in the previous comment, if you had a use case where you needed to run lots of things in parallel, then this would be useful. Latency is much higher on GPUs (clock speeds are lower and memory access latencies are higher), and system call support will make this even worse, so this probably wouldn't fare well unless you had a use case that could utilize that high a degree of parallelism.

ksml··on Let’s build a high-performance fuzzer with GPUs
It would be doable but not trivial. We're depending on remill not only to lift binaries, but also to add instrumentation for interposing on and translate memory accesses and function calls. We could use uninstrumented LLVM IR as input, but would need to write an LLVM pass to add in equivalent instrumentation. This shouldn't be terribly hard, but we're currently focused on getting everything working with remill.
ksml··on Let’s build a high-performance fuzzer with GPUs
Thanks for giving it a read -- I'm glad you enjoyed it!
ksml··on Let’s build a high-performance fuzzer with GPUs
That's been one of the biggest challenges of this internship, since I'm so used to assuming that any bugs are problems with my code or some library I'm using. In general, I'll first try to debug as I would normally debug my own code, but if inexplicable behavior keeps happening, I try to strip the code down to as small of an example as possible and then look at the compiler output. In some cases (e.g. bugs with LLVM), I can just try a different compiler and see if it works (e.g. nvcc), but ptxas is the only PTX assembler out there, so confirming ptxas bugs requires much more work.

Edit: another indicator is if something works at -O0 but breaks at higher optimization levels. That could be undefined behavior in your code, but it could also suggest a bug in the optimizer. Sometimes it's helpful to fiddle with the code to figure out what causes the compiler to break. For example, with the ptxas bug, our code would work fine unless we had a long chain of function calls (even if the functions in the call chain weren't doing anything interesting). That sounds more like a compiler bug than a logic error on our part. Sometimes, you can even figure out which specific pass of the optimizer is breaking the code; LLVM has a bisect tool that allows you to run optimization passes individually until you observe the output breaking.

ksml··on Let’s build a high-performance fuzzer with GPUs
The process is a little brittle right now, but when it works, it works. Remill (the binary lifter) sometimes has issues with certain constructs such as switch statements, and we've hit a number of LLVM and ptxas (PTX assembler) bugs as well, since LLVM's PTX backend isn't fully mature and most CUDA kernels are light on function calls and don't look like typical application code. However, when the process works, the PTX doesn't look too terribly different from the original code.
ksml··on Let’s build a high-performance fuzzer with GPUs
Haha... More than I had expected. We've hit two confirmed + one possible bug in LLVM and one bug in the PTX assembler. LLVM's PTX backend isn't fully mature yet, and I think the kind of PTX we're generating is very different from what people traditionally do with CUDA, so we are exposing quite a few edge cases in compilers that haven't been dealt with.
← PreviousPage 2 of 5Next →