patch-2.4.0-test6 linux/fs/exec.c
Next file: linux/fs/ext2/balloc.c
Previous file: linux/fs/devices.c
Back to the patch index
Back to the overall index
- Lines: 78
- Date:
Sun Aug 6 11:43:18 2000
- Orig file:
v2.4.0-test5/linux/fs/exec.c
- Orig date:
Mon Jul 10 16:47:25 2000
diff -u --recursive --new-file v2.4.0-test5/linux/fs/exec.c linux/fs/exec.c
@@ -223,6 +223,7 @@
memset(kaddr+offset+len, 0, PAGE_SIZE-offset-len);
}
err = copy_from_user(kaddr + offset, str, bytes_to_copy);
+ flush_dcache_page(page);
flush_page_to_ram(page);
kunmap(page);
@@ -320,9 +321,11 @@
}
for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
- if (bprm->page[i]) {
+ struct page *page = bprm->page[i];
+ if (page) {
+ bprm->page[i] = NULL;
current->mm->rss++;
- put_dirty_page(current,bprm->page[i],stack_base);
+ put_dirty_page(current,page,stack_base);
}
stack_base += PAGE_SIZE;
}
@@ -555,7 +558,7 @@
/*
* Fill the binprm structure from the inode.
- * Check permissions, then read the first 512 bytes
+ * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes
*/
int prepare_binprm(struct linux_binprm *bprm)
{
@@ -646,8 +649,8 @@
}
}
- memset(bprm->buf,0,sizeof(bprm->buf));
- return kernel_read(bprm->file,0,bprm->buf,128);
+ memset(bprm->buf,0,BINPRM_BUF_SIZE);
+ return kernel_read(bprm->file,0,bprm->buf,BINPRM_BUF_SIZE);
}
/*
@@ -819,15 +822,15 @@
int retval;
int i;
- bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
- memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0]));
-
file = open_exec(filename);
retval = PTR_ERR(file);
if (IS_ERR(file))
return retval;
+ bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
+ memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0]));
+
bprm.file = file;
bprm.filename = filename;
bprm.sh_bang = 0;
@@ -873,11 +876,11 @@
if (bprm.file)
fput(bprm.file);
- /* Assumes that free_page() can take a NULL argument. */
- /* I hope this is ok for all architectures */
- for (i = 0 ; i < MAX_ARG_PAGES ; i++)
- if (bprm.page[i])
- __free_page(bprm.page[i]);
+ for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
+ struct page * page = bprm.page[i];
+ if (page)
+ __free_page(page);
+ }
return retval;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)