sys_getrlimit: modified to return mcexec's RLIMIT_STACK
This commit is contained in:
@ -81,6 +81,8 @@ static int process_msg_prepare_process(unsigned long rphys)
|
||||
proc->pid = pn->pid;
|
||||
proc->vm->region.user_start = pn->user_start;
|
||||
proc->vm->region.user_end = pn->user_end;
|
||||
proc->rlimit_stack.rlim_cur = pn->rlimit_stack_cur;
|
||||
proc->rlimit_stack.rlim_max = pn->rlimit_stack_max;
|
||||
|
||||
/* TODO: Clear it at the proper timing */
|
||||
cpu_local_var(scp).post_idx = 0;
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
|
||||
#include <waitq.h>
|
||||
#include <futex.h>
|
||||
#include <rlimit.h>
|
||||
|
||||
struct vm_range {
|
||||
struct list_head list;
|
||||
@ -90,6 +91,7 @@ struct process {
|
||||
char sigstack[512];
|
||||
// TODO: backup FR and MMX regs
|
||||
unsigned long sigrc; // return code of rt_sigreturn (x86_64: rax reg.)
|
||||
struct rlimit rlimit_stack;
|
||||
};
|
||||
|
||||
struct process_vm {
|
||||
|
||||
@ -107,6 +107,8 @@ struct program_load_desc {
|
||||
unsigned long args_len;
|
||||
char *envs;
|
||||
unsigned long envs_len;
|
||||
unsigned long rlimit_stack_cur;
|
||||
unsigned long rlimit_stack_max;
|
||||
struct program_image_section sections[0];
|
||||
};
|
||||
|
||||
|
||||
@ -106,6 +106,7 @@ struct process *clone_process(struct process *org, unsigned long pc,
|
||||
|
||||
ihk_atomic_inc(&org->vm->refcount);
|
||||
proc->vm = org->vm;
|
||||
proc->rlimit_stack = org->rlimit_stack;
|
||||
|
||||
proc->sighandler = org->sighandler;
|
||||
ihk_atomic_inc(&org->sighandler->use);
|
||||
|
||||
@ -1106,14 +1106,14 @@ SYSCALL_DECLARE(getrlimit)
|
||||
int ret;
|
||||
int resource = ihk_mc_syscall_arg0(ctx);
|
||||
struct rlimit *rlm = (struct rlimit *)ihk_mc_syscall_arg1(ctx);
|
||||
struct process *proc = cpu_local_var(current);
|
||||
|
||||
switch (resource) {
|
||||
|
||||
case RLIMIT_STACK:
|
||||
|
||||
dkprintf("[%d] getrlimit() RLIMIT_STACK\n", ihk_mc_get_processor_id());
|
||||
rlm->rlim_cur = (512*4096); /* Linux provides 8MB */
|
||||
rlm->rlim_max = (1024*1024*1024);
|
||||
rlm->rlim_cur = proc->rlimit_stack.rlim_cur;
|
||||
rlm->rlim_max = proc->rlimit_stack.rlim_max;
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user