summaryrefslogtreecommitdiff
path: root/src/core/gdbstub/gdbstub.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-12-12 12:52:31 -0500
committerLioncash <mathew1800@gmail.com>2018-12-12 15:44:58 -0500
commit09a219d5b4a45537502c219542a51a57d6d0c317 (patch)
tree753f76ffbf8bc98318f7db63706f6d617ded8818 /src/core/gdbstub/gdbstub.cpp
parentd8deb39b83409f1d9b5eeec0a719d560e4409aae (diff)
svc: Write out the complete MemoryInfo structure in QueryProcessMemory
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.
Diffstat (limited to 'src/core/gdbstub/gdbstub.cpp')
0 files changed, 0 insertions, 0 deletions