include/linux/mm.h lines 705-712: #ifdef CONFIG_GRKERNSEC_PAX_MPROTECT && (!(current->flags & PF_PAX_MPROTECT) || (file && !(prot & PROT_WRITE$ #endif ) { unsigned long ret_m; ret_m = do_mmap_pgoff(NULL, ret + SEGMEXEC_TASK_SIZE, 0UL, prot, flag | MAP_MIRROR | MAP_FIXED, ret); --end code-- The do_mmap_pgoff contains only six arguments to the function, whereas seven is the new requirement. I fixed the issue by adding a parameter of 'current->mm' at the begining of the list. I assume this is the correct argument to pass since it appears as thought it is being passed to the function at other places in this include file. Unable to verify whether it works or not, yet, as I am also affected by <A HREF="http://bugs.gentoo.org/show_bug.cgi?id=42101">bug #42101</A>. My resultant code looked like: ret_m = do_mmap_pgoff(current->mm, NULL, ret + SEGMEXEC_TASK_SIZE, 0UL, prot, flag | MAP_MIRROR | MAP_FIXED, ret);
Fixed in CVS along with #42101, should hit Portage within an hour, so if you rsync and re-merge -r13 it should work. Thanks.
I think these changes also need to be made to fs/binfmt_elf.c: --- fs/binfmt_elf.c.bak 2004-02-24 19:55:14.000000000 -0500 +++ fs/binfmt_elf.c 2004-02-24 20:26:46.000000000 -0500 @@ -93,7 +93,7 @@ #ifdef CONFIG_GRKERNSEC_PAX_RANDEXEC if (current->flags & PF_PAX_RANDEXEC) - do_mmap_pgoff(NULL, ELF_PAGEALIGN(start + current->mm->delta_exec), 0UL, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED | MAP_MIRROR, start); + do_mmap_pgoff(current->mm, NULL, ELF_PAGEALIGN(start + current->mm->delta_exec), 0UL, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED | MAP_MIRROR, start); #endif } @@ -772,7 +772,7 @@ if (len > SEGMEXEC_TASK_SIZE || addr > SEGMEXEC_TASK_SIZE-len) continue; down_write(¤t->mm->mmap_sem); - error = do_mmap_pgoff(bprm->file, addr, len, elf_prot, elf_flags, (elf_ppnt->p_offset - ELF_PAGEOFFSET(elf_ppnt->p_vaddr)) >> PAGE_SHIFT); + error = do_mmap_pgoff(current->mm, bprm->file, addr, len, elf_prot, elf_flags, (elf_ppnt->p_offset - ELF_PAGEOFFSET(elf_ppnt->p_vaddr)) >> PAGE_SHIFT); up_write(¤t->mm->mmap_sem); } #endif @@ -800,14 +800,14 @@ #ifdef CONFIG_GRKERNSEC_PAX_SEGMEXEC if (current->flags & PF_PAX_SEGMEXEC) { if (elf_prot & PROT_EXEC) { - load_addr_random = do_mmap_pgoff(NULL, ELF_PAGESTART(load_bias_random + vaddr), elf_ppnt->p_memsz + ELF_PAGEOFFSET(elf_ppnt->p_vaddr), PROT_NONE, MAP_PRIVATE | MAP_FIXED, 0UL); + load_addr_random = do_mmap_pgoff(current->mm, NULL, ELF_PAGESTART(load_bias_random + vaddr), elf_ppnt->p_memsz + ELF_PAGEOFFSET(elf_ppnt->p_vaddr), PROT_NONE, MAP_PRIVATE | MAP_FIXED, 0UL); if (!BAD_ADDR(load_addr_random)) { - load_addr_random = do_mmap_pgoff(NULL, ELF_PAGESTART(load_bias_random + vaddr + SEGMEXEC_TASK_SIZE), 0UL, elf_prot, elf_flags | MAP_MIRROR, error); + load_addr_random = do_mmap_pgoff(current->mm, NULL, ELF_PAGESTART(load_bias_random + vaddr + SEGMEXEC_TASK_SIZE), 0UL, elf_prot, elf_flags | MAP_MIRROR, error); if (!BAD_ADDR(load_addr_random)) load_addr_random -= SEGMEXEC_TASK_SIZE; } } else - load_addr_random = do_mmap_pgoff(NULL, ELF_PAGESTART(load_bias_random + vaddr), 0UL, elf_prot, elf_flags | MAP_MIRROR, error); + load_addr_random = do_mmap_pgoff(current->mm, NULL, ELF_PAGESTART(load_bias_random + vaddr), 0UL, elf_prot, elf_flags | MAP_MIRROR, error); } #endif
ehhh . . . maybe not. I can't get my kernel to boot with these changes -- PAX just goes crazy and kills everything. Nor can I get it to compile with just your changes due to that file.
Can you sync your Portage tree, remerge your sources, and try then? You might want to run a "make clean" since bad object files would be left behind. If it still fails, can you please paste in the compiler errors?
`make bzImage` on freshly installed copy of gentoo-sources-2.4.20-r13: make[2]: Entering directory `/usr/src/linux-2.4.20-gentoo-r13/fs' gcc -D__KERNEL__ -I/usr/src/linux-2.4.20-gentoo-r13/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=pentium4 -nostdinc -iwithprefix include -DKBUILD_BASENAME=imon -c -o imon/imon.o imon/imon.c gcc -D__KERNEL__ -I/usr/src/linux-2.4.20-gentoo-r13/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=pentium4 -nostdinc -iwithprefix include -DKBUILD_BASENAME=binfmt_elf -c -o binfmt_elf.o binfmt_elf.c binfmt_elf.c: In function `set_brk': binfmt_elf.c:96: warning: passing arg 2 of `do_mmap_pgoff' makes pointer from integer without a cast binfmt_elf.c:96: error: too few arguments to function `do_mmap_pgoff' binfmt_elf.c: In function `load_elf_binary': binfmt_elf.c:775: warning: passing arg 1 of `do_mmap_pgoff' from incompatible pointer type binfmt_elf.c:775: warning: passing arg 2 of `do_mmap_pgoff' makes pointer from integer without a cast binfmt_elf.c:775: error: too few arguments to function `do_mmap_pgoff' binfmt_elf.c:803: warning: passing arg 2 of `do_mmap_pgoff' makes pointer from integer without a cast binfmt_elf.c:803: error: too few arguments to function `do_mmap_pgoff' binfmt_elf.c:805: warning: passing arg 2 of `do_mmap_pgoff' makes pointer from integer without a cast binfmt_elf.c:805: error: too few arguments to function `do_mmap_pgoff' binfmt_elf.c:810: warning: passing arg 2 of `do_mmap_pgoff' makes pointer from integer without a cast binfmt_elf.c:810: error: too few arguments to function `do_mmap_pgoff' make[2]: *** [binfmt_elf.o] Error 1 make[2]: Leaving directory `/usr/src/linux-2.4.20-gentoo-r13/fs' make[1]: *** [first_rule] Error 2 make[1]: Leaving directory `/usr/src/linux-2.4.20-gentoo-r13/fs' make: *** [_dir_fs] Error 2
I've released 2.4.20-gentoo-r14 without the SKAS patch that was causing these issues, if you emerge sync in half-an-hour and merge those everything should compile well. Thanks!
Works great. Thanks, plasmaroo.