09a219d5b4
In the previous change, the memory writing was moved into the service function itself, however it still had a problem, in that the entire MemoryInfo structure wasn't being written out, only the first 32 bytes of it were being written out. We still need to write out the trailing two reference count members and zero out the padding bits. Not doing this can result in wrong behavior in userland code in the following scenario: MemoryInfo info; // Put on the stack, not quaranteed to be zeroed out. svcQueryMemory(&info, ...); if (info.device_refcount == ...) // Whoops, uninitialized read. This can also cause the wrong thing to happen if the user code uses std::memcmp to compare the struct, with another one (questionable, but allowed), as the padding bits are not guaranteed to be a deterministic value. Note that the kernel itself also fully zeroes out the structure before writing it out including the padding bits. |
||
---|---|---|
.. | ||
arm | ||
crypto | ||
file_sys | ||
frontend | ||
gdbstub | ||
hle | ||
loader | ||
tracer | ||
CMakeLists.txt | ||
core.cpp | ||
core.h | ||
core_cpu.cpp | ||
core_cpu.h | ||
core_timing.cpp | ||
core_timing.h | ||
core_timing_util.cpp | ||
core_timing_util.h | ||
cpu_core_manager.cpp | ||
cpu_core_manager.h | ||
memory.cpp | ||
memory.h | ||
memory_hook.cpp | ||
memory_hook.h | ||
memory_setup.h | ||
perf_stats.cpp | ||
perf_stats.h | ||
settings.cpp | ||
settings.h | ||
telemetry_session.cpp | ||
telemetry_session.h |