load_elf: check mckernel execution

refs #758
This commit is contained in:
Tomoki Shirasawa
2017-09-12 13:15:22 +09:00
parent a05b6e1ba8
commit cdfa4015b7
3 changed files with 15 additions and 0 deletions

View File

@ -78,6 +78,9 @@ static int load_elf(struct linux_binprm *bprm
char *pbuf;
const char *path;
if (mcctrl_os_alive() == -1)
return -ENOEXEC;
if(bprm->envc == 0)
return -ENOEXEC;
if(memcmp(elf_ex->e_ident, ELFMAG, SELFMAG) != 0)

View File

@ -185,6 +185,16 @@ int mcctrl_os_shutdown_notifier(int os_index)
return 0;
}
int mcctrl_os_alive()
{
int i;
for (i = 0; i < OS_MAX_MINOR; i++)
if (os[i])
return i;
return -1;
}
static struct ihk_os_notifier_ops mcctrl_os_notifier_ops = {
.boot = mcctrl_os_boot_notifier,
.shutdown = mcctrl_os_shutdown_notifier,

View File

@ -408,6 +408,8 @@ inline struct mcctrl_per_thread_data *mcctrl_get_per_thread_data(
void __return_syscall(ihk_os_t os, struct ikc_scd_packet *packet,
long ret, int stid);
int mcctrl_os_alive(void);
#define PROCFS_NAME_MAX 768
struct procfs_read {