lua: Properly support high-range 64 addresses
Lua's native Number type is a 64-bit double with 52-bit precision, which was causing rounding errors when storing and working with high-range memory addresses (namely, addresses from the kernel, which are all in the `0xffffffff........` range). To work around this, we've made sure to never call `tonumber` on any variables that represent memory addresses, and instead continue operating on them with their native types: LuaJIT can work with the underlying `uint64_t` type for these values and transparently perform all kinds of numeric operations. The only limitation of working with native 64-bit types in LuaJIT is that they cannot be printed with the language's default `string.format` API. To give better UX to probe writers, these APIs have been monkeypatched so the `%p` format specifier will now properly handle 64-bit addresses and print them in an appropriate format.
Showing
Please register or sign in to comment