sef: Add fault injection (and EDFI) support.

This commit is contained in:
Cristiano Giuffrida 2014-06-12 17:08:31 +02:00 committed by Lionel Sambuc
parent 9f6977d22d
commit d9cd49c332
7 changed files with 75 additions and 3 deletions

View file

@ -717,3 +717,8 @@ service pty
SYSTEM vfs rs vm
;
};
service edfictl
{
ipc ALL;
};

View file

@ -646,6 +646,9 @@
# define GCOV_BUFF_P m1_p1
# define GCOV_BUFF_SZ m1_i1
/* Common fault injection ctl request to all processes. */
#define COMMON_REQ_FI_CTL (COMMON_RQ_BASE+2)
/*===========================================================================*
* Messages for VM server *
*===========================================================================*/

View file

@ -691,6 +691,21 @@ typedef struct {
} mess_linputdriver_input_event;
_ASSERT_MSG_SIZE(mess_linputdriver_input_event);
typedef struct {
cp_grant_id_t gid;
size_t size;
uint8_t padding[48];
} mess_lsys_fi_ctl;
_ASSERT_MSG_SIZE(mess_lsys_fi_ctl);
typedef struct {
int status;
uint8_t padding[52];
} mess_lsys_fi_reply;
_ASSERT_MSG_SIZE(mess_lsys_fi_reply);
typedef struct {
int what;
vir_bytes where;
@ -1795,6 +1810,8 @@ typedef struct {
mess_linputdriver_input_event m_linputdriver_input_event;
mess_lsys_getsysinfo m_lsys_getsysinfo;
mess_lsys_fi_ctl m_lsys_fi_ctl;
mess_lsys_fi_reply m_lsys_fi_reply;
mess_lsys_krn_schedctl m_lsys_krn_schedctl;
mess_lsys_krn_schedule m_lsys_krn_schedule;

View file

@ -233,6 +233,17 @@ void sef_cb_signal_handler_posix_default(int signo);
#define sef_signal_debug_begin sef_debug_begin
#define sef_signal_debug_end sef_debug_end
/*===========================================================================*
* SEF Fault Injection *
*===========================================================================*/
/* What to intercept. */
#define INTERCEPT_SEF_FI_REQUESTS 1
#define IS_SEF_FI_REQUEST(mp, status) \
(m_ptr->m_type == COMMON_REQ_FI_CTL)
/* Fault injection tool support. */
#define SEF_FI_ALLOW_EDFI 1
#if !defined(USE_LIVEUPDATE)
#undef INTERCEPT_SEF_LU_REQUESTS
#undef SEF_LU_DEBUG

View file

@ -40,6 +40,7 @@ SRCS+= \
sched_start.c \
sched_stop.c \
sef.c \
sef_fi.c \
sef_init.c \
sef_liveupdate.c \
sef_ping.c \

View file

@ -27,9 +27,6 @@ char* sef_debug_header(void);
#endif
/* SEF Init prototypes. */
#ifdef USE_COVERAGE
EXTERN int do_sef_gcov_request(message *m_ptr);
#endif
EXTERN int do_sef_rs_init(endpoint_t old_endpoint);
EXTERN int do_sef_init_request(message *m_ptr);
@ -43,6 +40,14 @@ EXTERN int do_sef_lu_request(message *m_ptr);
/* SEF Signal prototypes. */
EXTERN int do_sef_signal_request(message *m_ptr);
/* SEF GCOV prototypes. */
#ifdef USE_COVERAGE
EXTERN int do_sef_gcov_request(message *m_ptr);
#endif
/* SEF Fault Injection prototypes. */
EXTERN int do_sef_fi_request(message *m_ptr);
/*===========================================================================*
* sef_startup *
*===========================================================================*/
@ -181,6 +186,15 @@ int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr)
}
#endif
#ifdef INTERCEPT_SEF_FI_REQUESTS
/* Intercept Fault injection requests. */
if(IS_SEF_FI_REQUEST(m_ptr, status)) {
if(do_sef_fi_request(m_ptr) == OK) {
continue;
}
}
#endif
/* If we get this far, this is not a valid SEF request, return and
* let the caller deal with that.
*/

21
lib/libsys/sef_fi.c Normal file
View file

@ -0,0 +1,21 @@
#include "syslib.h"
#include <assert.h>
#include <minix/sysutil.h>
EXTERN __attribute__((weak)) int edfi_ctl_process_request(void *ctl_request);
/*===========================================================================*
* do_sef_fi_request *
*===========================================================================*/
int do_sef_fi_request(message *m_ptr)
{
#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;
}