Tofu: fix ENABLE_TOFU switching
Change-Id: Ib33323d4b59ea8fb4f5f40dff7ea25a36773d5e2
This commit is contained in:
@ -220,7 +220,9 @@ long do_syscall(struct syscall_request *req, int cpu)
|
||||
req->ttid = 0;
|
||||
}
|
||||
res.req_thread_status = IHK_SCD_REQ_THREAD_SPINNING;
|
||||
#ifdef ENABLE_TOFU
|
||||
res.pde_data = NULL;
|
||||
#endif
|
||||
send_syscall(req, cpu, &res);
|
||||
|
||||
if (req->rtid == -1) {
|
||||
@ -381,6 +383,7 @@ long do_syscall(struct syscall_request *req, int cpu)
|
||||
|
||||
rc = res.ret;
|
||||
|
||||
#ifdef ENABLE_TOFU
|
||||
if ((req->number == __NR_ioctl && rc == 0) ||
|
||||
(req->number == __NR_openat && rc > 0)) {
|
||||
int fd = req->number == __NR_ioctl ? req->args[0] : rc;
|
||||
@ -407,6 +410,7 @@ long do_syscall(struct syscall_request *req, int cpu)
|
||||
res.pde_data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(req->number != __NR_exit_group){
|
||||
--thread->in_syscall_offload;
|
||||
@ -1528,7 +1532,9 @@ int process_cleanup_before_terminate(int pid)
|
||||
{
|
||||
struct process *proc;
|
||||
struct mcs_rwlock_node_irqsave lock;
|
||||
#ifdef ENABLE_TOFU
|
||||
int fd;
|
||||
#endif
|
||||
|
||||
proc = find_process(pid, &lock);
|
||||
if (!proc) {
|
||||
@ -1536,10 +1542,12 @@ int process_cleanup_before_terminate(int pid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TOFU
|
||||
/* Clean up PDE file descriptors */
|
||||
for (fd = 2; fd < MAX_FD_PDE; ++fd) {
|
||||
__process_cleanup_fd(proc, fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
process_unlock(proc, &lock);
|
||||
return 0;
|
||||
@ -3978,7 +3986,9 @@ SYSCALL_DECLARE(open)
|
||||
goto out;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TOFU
|
||||
cpu_local_var(current)->fd_path_in_open = pathname;
|
||||
#endif
|
||||
|
||||
dkprintf("open(): pathname=%s\n", pathname);
|
||||
if (!strncmp(pathname, XPMEM_DEV_PATH, len)) {
|
||||
@ -3987,15 +3997,21 @@ SYSCALL_DECLARE(open)
|
||||
rc = syscall_generic_forwarding(__NR_open, ctx);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TOFU
|
||||
cpu_local_var(current)->fd_path_in_open = NULL;
|
||||
#endif
|
||||
|
||||
out:
|
||||
#ifdef ENABLE_TOFU
|
||||
if (rc > 0 && rc < MAX_FD_PDE) {
|
||||
cpu_local_var(current)->proc->fd_path[rc] = pathname;
|
||||
}
|
||||
else {
|
||||
kfree(pathname);
|
||||
}
|
||||
#else
|
||||
kfree(pathname);
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -4023,7 +4039,9 @@ SYSCALL_DECLARE(openat)
|
||||
goto out;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TOFU
|
||||
cpu_local_var(current)->fd_path_in_open = pathname;
|
||||
#endif
|
||||
|
||||
dkprintf("openat(): pathname=%s\n", pathname);
|
||||
if (!strncmp(pathname, XPMEM_DEV_PATH, len)) {
|
||||
@ -4032,15 +4050,21 @@ SYSCALL_DECLARE(openat)
|
||||
rc = syscall_generic_forwarding(__NR_openat, ctx);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TOFU
|
||||
cpu_local_var(current)->fd_path_in_open = NULL;
|
||||
#endif
|
||||
|
||||
out:
|
||||
#ifdef ENABLE_TOFU
|
||||
if (rc > 0 && rc < MAX_FD_PDE) {
|
||||
cpu_local_var(current)->proc->fd_path[rc] = pathname;
|
||||
}
|
||||
else {
|
||||
kfree(pathname);
|
||||
}
|
||||
#else
|
||||
kfree(pathname);
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user