Why Nostr? What is Njump?
2024-07-29 16:31:35
in reply to

Hector Martin on Nostr: Easier? Only sometimes, not that often. Access tracing gets directly at the hardware ...

Easier? Only sometimes, not that often. Access tracing gets directly at the hardware and skips dealing with multiple layers of abstraction and irrelevant details in the driver. Plus it allows you to experimentally figure out features that the original driver does not exercise, once you get a good mental model of the hardware.

The problem with just reading the code is that you need to have the mental discipline to not copy. Lots of people don't, and I've seen this go horribly wrong with other projects. It turns out that the people who are capable of abstracting out the hardware in their head to a degree that they won't infringe with their implementation, *also* are good at interpreting hardware traces and skipping reading the code altogether. The people who think reading the code is much easier turn out to just be... copying, on purpose or not.

In the end, I find the only times I really find reading code easier is when you'd wind up with the ~same code with access tracing, just done slower. This usually means initialization sequences and stuff like that, which boil down to a pile of dumb register writes (which isn't copyrightable either if it's a sequence the hardware requires to function properly). E.g. there are some hard coded "mask and set bits" tables in Apple's drivers, particularly things like pulling bits out of calibrarion fuses and into PHY registers, and no matter how you slice it those would turn out to be identical if reverse engineered purely black box. It just takes longer since you have to use injected test patterns to identify all the field offsets and widths across multiple virtual boots, and you'd come up with the same table that's in Apple's driver anyway.

So when a new chip comes out with new fuse offsets, it's easier to just throw the driver in Ghidra and pull out the table than spend hours reverse engineering the same table experimentally.

But other than boring stuff like that, no, I often find hardware tracing more efficient than reverse engineering drivers.
Author Public Key
npub1qk9x6yrvten3jqyvundn7exggm90fxf9yfarj5eaz25yd7aty8hqe9azpx