Add trusted check

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@783 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
jessicag.feedback@gmail.com 2011-03-22 00:29:37 +00:00
parent a4a9922512
commit 322818287c

View file

@ -329,8 +329,13 @@ bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) {
if (filter_ && !filter_(callback_context_))
return false;
// Allow ourselves to be dumped.
sys_prctl(PR_SET_DUMPABLE, 1);
// Allow ourselves to be dumped if the signal is trusted.
bool signal_trusted = info->si_code > 0;
bool signal_pid_trusted = info->si_code == SI_USER ||
info->si_code == SI_TKILL;
if (signal_trusted || (signal_pid_trusted && info->si_pid == getpid())) {
sys_prctl(PR_SET_DUMPABLE, 1);
}
CrashContext context;
memcpy(&context.siginfo, info, sizeof(siginfo_t));
memcpy(&context.context, uc, sizeof(struct ucontext));