mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 13:05:47 +00:00
diag: dump guest stack on blocked SUD traps
This commit is contained in:
1 parent
b160011cd9
commit
67e46ce419
1 file changed
+9
-2
@@ -1,5 +1,5 @@
|
||||
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Seccomp/SeccompEmulator.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Seccomp/SeccompEmulator.cpp
|
||||
index 1dc85de..be763fc 100644
|
||||
index 1dc85de..dc0b3a1 100644
|
||||
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Seccomp/SeccompEmulator.cpp
|
||||
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Seccomp/SeccompEmulator.cpp
|
||||
@@ -6,6 +6,7 @@ $end_info$
|
||||
@@ -10,13 +10,20 @@ index 1dc85de..be763fc 100644
|
||||
#include <unistd.h>
|
||||
#include "LinuxSyscalls/Seccomp/BPFEmitter.h"
|
||||
#include "LinuxSyscalls/Seccomp/SeccompEmulator.h"
|
||||
@@ -365,7 +366,9 @@ SeccompEmulator::ExecuteSyscallUserDispatch(FEXCore::Core::CpuStateFrame* Frame,
|
||||
@@ -365,7 +366,16 @@ SeccompEmulator::ExecuteSyscallUserDispatch(FEXCore::Core::CpuStateFrame* Frame,
|
||||
|
||||
if (SUD.Selector) {
|
||||
uint8_t State {};
|
||||
- if (FaultSafeUserMemAccess::CopyFromUser(&State, reinterpret_cast<const void*>(SUD.Selector), sizeof(State))) {
|
||||
+ const bool SelFault = FaultSafeUserMemAccess::CopyFromUser(&State, reinterpret_cast<const void*>(SUD.Selector), sizeof(State));
|
||||
+ if (SelFault || State != 0) ::dprintf(2, "DDSUD %d/%ld nr=%lu rip=%#lx off=%#lx len=%#lx sel=%#lx fault=%d state=%u\n", ::getpid(), ::syscall(SYS_gettid), SyscallNumber, PostSyscallRIP, SUD.Offset, SUD.Length, SUD.Selector, SelFault, State);
|
||||
+ if (SelFault || State != 0) {
|
||||
+ uint64_t Stk[48] {};
|
||||
+ const uint64_t Rsp = Frame->State.gregs[FEXCore::X86State::REG_RSP];
|
||||
+ FaultSafeUserMemAccess::CopyFromUser(Stk, reinterpret_cast<const void*>(Rsp), sizeof(Stk));
|
||||
+ ::dprintf(2, "DDSUDCTX %d/%ld mask=%#lx rsp=%#lx rbp=%#lx rdi=%#lx rsi=%#lx\n", ::getpid(), ::syscall(SYS_gettid), static_cast<unsigned long>(Thread->SignalInfo.CurrentSignalMask.Val), Rsp, Frame->State.gregs[FEXCore::X86State::REG_RBP], Frame->State.gregs[FEXCore::X86State::REG_RDI], Frame->State.gregs[FEXCore::X86State::REG_RSI]);
|
||||
+ for (int i = 0; i < 48; i += 6) ::dprintf(2, "DDSTK %d +%#x %#lx %#lx %#lx %#lx %#lx %#lx\n", ::getpid(), i * 8, Stk[i], Stk[i+1], Stk[i+2], Stk[i+3], Stk[i+4], Stk[i+5]);
|
||||
+ }
|
||||
+ if (SelFault) {
|
||||
ForceExitSignal(Thread, SIGSEGV);
|
||||
return {true, SyscallNumber};
|
||||
|
||||
Reference in new issue
Block a user