fix REQ-19: some syscalls change how to access user space
This commit is contained in:
@ -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)
|
static int get_futex_value_locked(uint32_t *dest, uint32_t *from)
|
||||||
{
|
{
|
||||||
/* RIKEN: futexes are always on not swappable pages */
|
/* RIKEN: futexes are always on not swappable pages */
|
||||||
*dest = *from;
|
*dest = getint_user((int *)from);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1661,13 +1661,29 @@ SYSCALL_DECLARE(execve)
|
|||||||
argv_flat_len = flatten_strings_from_user(-1, (desc->shell_path[0] ?
|
argv_flat_len = flatten_strings_from_user(-1, (desc->shell_path[0] ?
|
||||||
desc->shell_path : NULL), argv, &argv_flat);
|
desc->shell_path : NULL), argv, &argv_flat);
|
||||||
if (argv_flat_len == 0) {
|
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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
envp_flat_len = flatten_strings_from_user(-1, NULL, envp, &envp_flat);
|
envp_flat_len = flatten_strings_from_user(-1, NULL, envp, &envp_flat);
|
||||||
if (envp_flat_len == 0) {
|
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;
|
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",
|
dkprintf("clone_flags & CLONE_PARENT_SETTID: 0x%lX\n",
|
||||||
parent_tidptr);
|
parent_tidptr);
|
||||||
|
|
||||||
*(int*)parent_tidptr = new->tid;
|
setint_user((int*)parent_tidptr, new->tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clone_flags & CLONE_CHILD_CLEARTID) {
|
if (clone_flags & CLONE_CHILD_CLEARTID) {
|
||||||
@ -4169,7 +4185,7 @@ SYSCALL_DECLARE(exit)
|
|||||||
|
|
||||||
dkprintf("exit clear_child!\n");
|
dkprintf("exit clear_child!\n");
|
||||||
|
|
||||||
*thread->clear_child_tid = 0;
|
setint_user((int*)thread->clear_child_tid, 0);
|
||||||
barrier();
|
barrier();
|
||||||
futex((uint32_t *)thread->clear_child_tid,
|
futex((uint32_t *)thread->clear_child_tid,
|
||||||
FUTEX_WAKE, 1, 0, NULL, 0, 0, 1);
|
FUTEX_WAKE, 1, 0, NULL, 0, 0, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user