From 4159713ef941112227b674c0cf758dee5947ef21 Mon Sep 17 00:00:00 2001 From: forever-learner <2360561713@qq.com> Date: Sat, 25 Jun 2022 20:27:06 +0800 Subject: [PATCH] small changes to do_execve2 --- mm/memory.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 2172bd4..d2301ee 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -372,7 +372,7 @@ void do_no_page(unsigned long error_code,unsigned long address) int block,i; /* if (current->pid > 5) - printk(" --do_no_page: address=%x, pid=%d\n", address, current->pid); */ + printk(" --do_no_page: address=%x, pid=%d\n", address, current->pid); */ address &= 0xfffff000; tmp = address - current->start_code; @@ -426,14 +426,13 @@ int do_execve2(unsigned long * eip,long tmp,char * filename, unsigned long page; int block,i; unsigned long address=current->start_code; - + //this part comes from do_no_page as achievement of immediate loading of cs and ds while(address<=current->brk+current->start_code) { - address &= 0xfffff000; temp = address - current->start_code; if (share_page(temp)) - return; + return -1; if (!(page = get_free_page())) oom(); block = 1 + temp/BLOCK_SIZE; @@ -444,8 +443,6 @@ int do_execve2(unsigned long * eip,long tmp,char * filename, { free_page(page); oom(); - printk("error"); - return -1; } address+=PAGE_SIZE; }