David van Moolenbroek 6c7e614940 SEF: identity transfer only after controlled crash
Transparent (endpoint-preserving) restarts with identity transfer
are meant to exercise the crash recovery system only.  After *real*
crashes, such restarts are useless at best and dangerous at worst,
because no state integrity can be guaranteed afterwards.  Thus,
except after a controlled crash, it is best not to perform such
restarts at all.  This patch changes SEF such that identity transfer
is successful only if the old process was the subject of a crash
induced through "service fi".  As a result, testrelpol.sh should
continue to be able to use identity transfers for testing purposes,
but any real crash will be handled more appropriately.

This fixes #126.

Change-Id: Idc17ac7b3dfee05098529cb889ac835a0cd03ef0
2016-06-17 18:19:25 +00:00

32 lines
873 B
C

#include "syslib.h"
#include <assert.h>
#include <minix/sysutil.h>
EXTERN __attribute__((weak)) int edfi_ctl_process_request(void *ctl_request);
EXTERN int do_sef_fi_request(message *m_ptr);
EXTERN int sef_controlled_crash;
/*===========================================================================*
* do_sef_fi_request *
*===========================================================================*/
int do_sef_fi_request(message *m_ptr)
{
/* See if we are simply asked to crash. */
if (m_ptr->m_lsys_fi_ctl.subtype == RS_FI_CRASH) {
sef_controlled_crash = TRUE;
panic("Crash!");
}
#if SEF_FI_ALLOW_EDFI
/* Forward the request to the EDFI fault injector, if linked in. */
if(edfi_ctl_process_request)
return edfi_ctl_process_request(m_ptr);
#endif
return ENOSYS;
}