Merge branch 'master' of postpeta.pccluster.org:mckernel
This commit is contained in:
@ -347,6 +347,7 @@ int update_process_page_table(struct process *process,
|
||||
|
||||
attr = flag | PTATTR_USER | PTATTR_FOR_USER;
|
||||
attr |= (range->flag & VR_PROT_WRITE)? PTATTR_WRITABLE: 0;
|
||||
attr |= (range->flag & VR_PROT_EXEC)? 0: PTATTR_NO_EXECUTE;
|
||||
|
||||
p = range->start;
|
||||
while (p < range->end) {
|
||||
@ -689,6 +690,10 @@ enum ihk_mc_pt_attribute vrflag_to_ptattr(unsigned long flag)
|
||||
attr |= PTATTR_WRITABLE;
|
||||
}
|
||||
|
||||
if (!(flag & VR_PROT_EXEC)) {
|
||||
attr |= PTATTR_NO_EXECUTE;
|
||||
}
|
||||
|
||||
return attr;
|
||||
}
|
||||
|
||||
@ -1197,7 +1202,9 @@ static int do_page_fault_process(struct process *proc, void *fault_addr0, uint64
|
||||
|
||||
if (((range->flag & VR_PROT_MASK) == VR_PROT_NONE)
|
||||
|| ((reason & PF_WRITE)
|
||||
&& !(range->flag & VR_PROT_WRITE))) {
|
||||
&& !(range->flag & VR_PROT_WRITE))
|
||||
|| ((reason & PF_INSTR)
|
||||
&& !(range->flag & VR_PROT_EXEC))) {
|
||||
error = -EFAULT;
|
||||
kprintf("[%d]do_page_fault_process(%p,%lx,%lx):"
|
||||
"access denied. %d\n",
|
||||
@ -1325,8 +1332,8 @@ int init_process_stack(struct process *process, struct program_load_desc *pn,
|
||||
start = end - size;
|
||||
|
||||
vrflag = VR_STACK | VR_DEMAND_PAGING;
|
||||
vrflag |= VR_PROT_READ | VR_PROT_WRITE | VR_PROT_EXEC;
|
||||
vrflag |= VRFLAG_PROT_TO_MAXPROT(vrflag);
|
||||
vrflag |= PROT_TO_VR_FLAG(pn->stack_prot);
|
||||
vrflag |= VR_MAXPROT_READ | VR_MAXPROT_WRITE | VR_MAXPROT_EXEC;
|
||||
#define NOPHYS ((uintptr_t)-1)
|
||||
if ((rc = add_process_memory_range(process, start, end, NOPHYS,
|
||||
vrflag, NULL, 0)) != 0) {
|
||||
|
||||
Reference in New Issue
Block a user