diff --git a/kernel/futex.c b/kernel/futex.c index a822a79e..5e9ddcca 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -251,7 +251,7 @@ static int cmpxchg_futex_value_locked(uint32_t __user *uaddr, uint32_t uval, uin static int get_futex_value_locked(uint32_t *dest, uint32_t *from) { /* RIKEN: futexes are always on not swappable pages */ - *dest = *from; + *dest = getint_user((int *)from); return 0; } diff --git a/kernel/syscall.c b/kernel/syscall.c index ff707112..5a245e37 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -1661,13 +1661,29 @@ SYSCALL_DECLARE(execve) argv_flat_len = flatten_strings_from_user(-1, (desc->shell_path[0] ? desc->shell_path : NULL), argv, &argv_flat); if (argv_flat_len == 0) { - kprintf("ERROR: no argv for executable: %s?\n", filename); + char *kfilename; + int len = strlen_user(filename); + + kfilename = kmalloc(len + 1, IHK_MC_AP_NOWAIT); + if(kfilename) + strcpy_from_user(kfilename, filename); + kprintf("ERROR: no argv for executable: %s?\n", kfilename? kfilename: ""); + if(kfilename) + kfree(kfilename); return -EINVAL; } envp_flat_len = flatten_strings_from_user(-1, NULL, envp, &envp_flat); if (envp_flat_len == 0) { - kprintf("ERROR: no envp for executable: %s?\n", filename); + char *kfilename; + int len = strlen_user(filename); + + kfilename = kmalloc(len + 1, IHK_MC_AP_NOWAIT); + if(kfilename) + strcpy_from_user(kfilename, filename); + kprintf("ERROR: no envp for executable: %s?\n", kfilename? kfilename: ""); + if(kfilename) + kfree(kfilename); return -EINVAL; } @@ -1845,7 +1861,7 @@ unsigned long do_fork(int clone_flags, unsigned long newsp, dkprintf("clone_flags & CLONE_PARENT_SETTID: 0x%lX\n", parent_tidptr); - *(int*)parent_tidptr = new->tid; + setint_user((int*)parent_tidptr, new->tid); } if (clone_flags & CLONE_CHILD_CLEARTID) { @@ -4169,7 +4185,7 @@ SYSCALL_DECLARE(exit) dkprintf("exit clear_child!\n"); - *thread->clear_child_tid = 0; + setint_user((int*)thread->clear_child_tid, 0); barrier(); futex((uint32_t *)thread->clear_child_tid, FUTEX_WAKE, 1, 0, NULL, 0, 0, 1);