WOLK v4.16s: Grsecurity compile error/bug?
Carl Hagmueller <[email protected]> Tue, 26 Oct 2004 14:55:46 -0400
| Newsgroups | gmane.linux.wolk.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Marc,
I ran into the following compile error in linux-2.4.20-wolk4.16s, with
Grsecurity/Pax options enabled. Specifically, CONFIG_PAX_PAGEEXEC=y
gcc -D__KERNEL__
-I/home/chagmuel/devel/RPM/BUILD/wolk-4.16/linux-2.4.20/include -Wall
-Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -g
-Wno-unused -Os -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2
-march=i686 -nostdinc -iwithprefix include -DKBUILD_BASENAME=binfmt_elf
-c -o binfmt_elf.o binfmt_elf.c
binfmt_elf.c: In function `load_elf_binary':
binfmt_elf.c:1006: warning: passing arg 2 of `__do_mmap_pgoff' makes pointer
from integer without a cast
binfmt_elf.c:1006: too few arguments to function `__do_mmap_pgoff'
make[2]: *** [binfmt_elf.o] Error 1
make[2]: Leaving directory
`/home/chagmuel/devel/RPM/BUILD/wolk-4.16/linux-2.4.20/fs'
Looking at the offending code in fs/binfmt_elf.c there seems to be an
inconsistancy in the call to __do_mmap_pgoff. Every other call to this
function includes current->mm as the first argument except the call which
caused the error:
#ifdef CONFIG_GRKERNSEC_PAX_PAGEEXEC
if (current->flags & PF_PAX_PAGEEXEC)
load_addr_random = __do_mmap_pgoff(NULL,
ELF_PAGESTART(load_bias_random + vaddr), 0UL, elf_prot, elf_flags |
MAP_MIRROR, error);
#endif
#ifdef CONFIG_GRKERNSEC_PAX_SEGMEXEC
if (current->flags & PF_PAX_SEGMEXEC) {
if (elf_prot & PROT_EXEC) {
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(current->mm, NULL,
ELF_PAGESTART(load_bias_random + vaddr + SEGMEXEC_TASK_SIZE), 0UL,
lf_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(current->mm, NULL,
ELF_PAGESTART(load_bias_random + vaddr), 0UL, elf_prot, elf_flags |
MAP_MIRROR, error);
}
#endif
The prototype for __do_mmap_pgoff in include/linux/mm.h is as follows:
extern unsigned long __do_mmap_pgoff(struct mm_struct *mm, struct file
*file, unsigned long addr,
unsigned long len, unsigned long prot,
unsigned long flag, unsigned long pgoff);
This leads me to believe that the proper call should be as follows:
#ifdef CONFIG_GRKERNSEC_PAX_PAGEEXEC
if (current->flags & PF_PAX_PAGEEXEC)
load_addr_random = __do_mmap_pgoff(current->mm, NULL,
ELF_PAGESTART(load_bias_random + vaddr), 0UL, elf_prot, elf_flags |
MAP_MIRROR, error);
^^^^^^^^^^^
#endif
I realize this is probably a Grsecurity issue, but I wanted to run it by you
first, since I'm very fuzzy on the mmap/rmap issues, and I'm not really a
kernel hacker! I'm also new to Grsecurity and Pax. In retrospect, I
probably don't need this option (that's why the issue has never come up
before?) but I need to learn more about the various options. This was a
first cut following the Grsecurity 'QuickStart Guide'
Let me know what you think.
-- Carl
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
WOLK - Working Overloaded Linux Kernel
[email protected]
https://lists.sourceforge.net/lists/listinfo/wolk-devel