Skip to content

Commit dc19175

Browse files
Merge pull request #38 from WorksButNotTested/asan_segv
Fix issue with use of architecture specific exception code
2 parents d09c24c + c6754db commit dc19175

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

qemuafl/asan-giovese-inl.h

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,12 +1394,27 @@ int asan_giovese_report_and_crash(int access_type, target_ulong addr, size_t n,
13941394
* each block to allow functionality such as execution tracing (the -d exec
13951395
* argument)to work properly.
13961396
*/
1397-
env->exception.vaddress = fault_addr;
1398-
1397+
1398+
/*
1399+
* Queue a SIGSEGV representing our fault.
1400+
*/
1401+
target_siginfo_t info = {
1402+
.si_signo = TARGET_SIGSEGV,
1403+
.si_errno = 0,
1404+
.si_code = TARGET_SEGV_MAPERR,
1405+
._sifields._sigfault._addr = fault_addr
1406+
};
1407+
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
1408+
1409+
/*
1410+
* Set the CPU state to represent an interrupt. This is suffient to cause the
1411+
* cpu_loop to break out and handle the queued exceptions.
1412+
*/
13991413
CPUState *cs = env_cpu(env);
1400-
cs->exception_index = EXCP_DATA_ABORT;
1414+
cs->exception_index = EXCP_INTERRUPT;
14011415
cpu_loop_exit(cs);
1402-
1416+
1417+
14031418
return 0;
14041419
}
14051420

0 commit comments

Comments
 (0)