add memory debug (kmalloc/kfree)

* support "memdebug" mckernel option
* check buffer overrun when memory free and next mcexec run
* check double free
* check memory leak when next mcexec run
This commit is contained in:
Tomoki Shirasawa
2014-10-07 15:45:16 +09:00
parent f3ea226d91
commit 658aa18ade
5 changed files with 348 additions and 8 deletions

View File

@@ -500,6 +500,9 @@ extern unsigned long do_kill(int, int, int, struct siginfo *);
extern void settid(struct process *proc, int mode, int newcpuid, int oldcpuid);
extern void process_procfs_request(unsigned long rarg);
extern int memcheckall();
extern int freecheck(int runcount);
extern int runcount;
static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
void *__packet, void *ihk_os)
@@ -524,6 +527,14 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
return 0;
case SCD_MSG_PREPARE_PROCESS:
if (find_command_line("memdebug")) {
memcheckall();
if (runcount)
freecheck(runcount);
runcount++;
}
if((rc = process_msg_prepare_process(packet->arg)) == 0){
pckt.msg = SCD_MSG_PREPARE_PROCESS_ACKED;
pckt.err = 0;