linux-lts-quantal-3.5.0/kernel/replay.c
// This is called with interrupts disabled so there is little we can do
// If signal is to be deferred, we do that since we can use atomic allocation.
// mcc: Called with current->sighand->siglock held and local interrupts disabled
This is called with interrupts disabled so there is little we can do
If signal is to be deferred, we do that since we can use atomic allocation.
mcc: Called with current->sighand->siglock held and local interrupts disabled
This is called with interrupts disabled so there is little we can do If signal is to be deferred we do that since we can use atomic allocation . mcc : Called with current - > sighand - > siglock held and local interrupts disabled
long
check_signal_delivery (int signr, siginfo_t* info, struct k_sigaction* ka, int ignore_flag)
{
	struct record_thread* prt = current->record_thrd;
	int sysnum = syscall_get_nr(current, get_pt_regs(NULL));
	struct syscall_result* psr;
	if (prt->rp_in_ptr == 0) {
		SIGPRINT ("Pid %d - no syscall records yet - signal %d\n", current->pid, signr);
		if (sig_fatal(current, signr)) {
			SIGPRINT ("Fatal signal sent w/o recording - replay broken?\n");
			return 0; 
		}
		return defer_signal (prt, signr, info);
	}
	psr = &prt->rp_log[(prt->rp_in_ptr-1)]; 
        SIGPRINT ("Pid %d check signal delivery signr %d fatal %d - clock is currently %d ignore flag %d sysnum %d psr->sysnum %d handler %p\n", 
		  current->pid, signr, sig_fatal(current, signr), atomic_read(prt->rp_precord_clock), ignore_flag, sysnum, psr->sysnum, ka->sa.sa_handler);
	if (ignore_flag && sysnum >= 0) {
		return 0;
	} else if (!sig_fatal(current,signr) && sysnum != psr->sysnum && sysnum != 0 ) {
		SIGPRINT ("Pid %d: not a safe place to record a signal - syscall is %d but last recorded syscall is %d ignore flag %d\n", current->pid, sysnum, psr->sysnum, ignore_flag);
		return defer_signal (prt, signr, info);
	}
	return 0; 
}
long check_signal_delivery ( int signr , siginfo_t * info , struct k_sigaction * ka , int ignore_flag ) { struct record_thread * prt = current -> record_thrd ; int sysnum = syscall_get_nr ( current , get_pt_regs ( NULL ) ) ; struct syscall_result * psr ; if ( prt -> rp_in_ptr == 0 ) { SIGPRINT ( " \n " , current -> pid , signr ) ; if ( sig_fatal ( current , signr ) ) { SIGPRINT ( " \n " ) ; return 0 ; } return defer_signal ( prt , signr , info ) ; } psr = & prt -> rp_log [ ( prt -> rp_in_ptr - 1 ) ] ; SIGPRINT ( " \n " , current -> pid , signr , sig_fatal ( current , signr ) , atomic_read ( prt -> rp_precord_clock ) , ignore_flag , sysnum , psr -> sysnum , ka -> sa . sa_handler ) ; if ( ignore_flag && sysnum >= 0 ) { return 0 ; } else if ( ! sig_fatal ( current , signr ) && sysnum != psr -> sysnum && sysnum != 0 ) { SIGPRINT ( " \n " , current -> pid , sysnum , psr -> sysnum , ignore_flag ) ; return defer_signal ( prt , signr , info ) ; } return 0 ; }
This is called with interrupts disabled so there is little we can do
If signal is to be deferred, we do that since we can use atomic allocation.
This is called with interrupts disabled so there is little we can do If signal is to be deferred we do that since we can use atomic allocation .
/* restarted syscall */ // This is an unrecorded system call or a trap.  Since we cannot guarantee that the signal will not delivered // at this same place on replay, delay the delivery until we reach such a safe place.  Signals that immediately // terminate the program should not be delayed, however. // Will handle this signal later