patch-2.0.18 linux/fs/binfmt_elf.c

Next file: linux/fs/buffer.c
Previous file: linux/drivers/sound/lowlevel/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.17/linux/fs/binfmt_elf.c linux/fs/binfmt_elf.c
@@ -258,7 +258,7 @@
 			    eppnt->p_filesz + ELF_PAGEOFFSET(eppnt->p_vaddr),
 			    elf_prot,
 			    elf_type,
-			    ELF_PAGESTART(eppnt->p_offset));
+			    eppnt->p_offset - ELF_PAGEOFFSET(eppnt->p_vaddr));
 	    
 	    if (error > -1024UL) {
 	      /* Real error */
@@ -585,7 +585,8 @@
 					elf_prot,
 					(MAP_FIXED | MAP_PRIVATE |
 					 MAP_DENYWRITE | MAP_EXECUTABLE),
-					ELF_PAGESTART(elf_ppnt->p_offset));
+					(elf_ppnt->p_offset -
+					 ELF_PAGEOFFSET(elf_ppnt->p_vaddr)));
 			
 #ifdef LOW_ELF_STACK
 			if (ELF_PAGESTART(elf_ppnt->p_vaddr) < elf_stack) 
@@ -802,10 +803,12 @@
 	/* Now use mmap to map the library into memory. */
 	error = do_mmap(file,
 			ELF_PAGESTART(elf_phdata->p_vaddr),
-			elf_phdata->p_filesz + ELF_PAGEOFFSET(elf_phdata->p_vaddr),
+			(elf_phdata->p_filesz +
+			 ELF_PAGEOFFSET(elf_phdata->p_vaddr)),
 			PROT_READ | PROT_WRITE | PROT_EXEC,
 			MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE,
-			ELF_PAGESTART(elf_phdata->p_offset));
+			(elf_phdata->p_offset -
+			 ELF_PAGEOFFSET(elf_phdata->p_vaddr)));
 
 	k = elf_phdata->p_vaddr + elf_phdata->p_filesz;
 	if (k > elf_bss) elf_bss = k;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov