Page 1 of 1

grsecurity-3.1-4.6.3-201607051723 doesn't compile

PostPosted: Wed Jul 06, 2016 1:27 am
by adminwset
Hello
I just try compile Kernel 4.6.3 with grsecurity-3.1-4.6.3-201607051723.patch and got crash:

root@taken:/usr/src/linux# make
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/bin2c
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
HOSTCXX -fPIC scripts/gcc-plugins/colorize_plugin.o
HOSTLLD -shared scripts/gcc-plugins/colorize_plugin.so
HOSTCXX -fPIC scripts/gcc-plugins/initify_plugin.o
HOSTLLD -shared scripts/gcc-plugins/initify_plugin.so
CC kernel/bounds.s
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CC arch/x86/kernel/asm-offsets.s
In file included from include/linux/kasan.h:4:0,
from include/linux/slab.h:136,
from include/linux/crypto.h:24,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/sched.h: In function 'current_is_ptracer':
include/linux/sched.h:2453:27: error: 'struct task_struct' has no member named 'exec_id'
*exec_id = task->parent->exec_id;
^
Kbuild:80: recipe for target 'arch/x86/kernel/asm-offsets.s' failed
make[1]: *** [arch/x86/kernel/asm-offsets.s] Error 1
Makefile:1010: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2


Best Regards
TaKeN

Re: grsecurity-3.1-4.6.3-201607051723 doesn't compile

PostPosted: Wed Jul 06, 2016 1:58 am
by x14sg1
I looked at this since I was bored (and curious) and the compile failure seems to be a missing "#ifdef CONFIG_GRKERNSEC_PROC_MEMMAP" in include/linux/sched.h:2452 in current_is_ptracer() (not sure if this is an entirely correct or complete fix but it does let the kernel compile):

read_lock(&tasklist_lock);
if (task->parent && task->parent == current) {
ret = true;
#ifdef CONFIG_GRKERNSEC_PROC_MEMMAP
if (exec_id)
*exec_id = task->parent->exec_id;
#endif
}
read_unlock(&tasklist_lock);
rcu_read_unlock();

Re: grsecurity-3.1-4.6.3-201607051723 doesn't compile

PostPosted: Wed Jul 06, 2016 2:57 am
by adminwset
Hey
I just check and after add: #ifdef CONFIG_GRKERNSEC_PROC_MEMMAP to include/linux/sched.h compile complete without errors.

Setup is 15772 bytes (padded to 15872 bytes).
System is 7928 kB
CRC 833f7b53
Kernel: arch/x86/boot/bzImage is ready (#1)

Best Regards
TaKeN

Re: grsecurity-3.1-4.6.3-201607051723 doesn't compile

PostPosted: Wed Jul 06, 2016 3:13 am
by x14sg1
Glad to hear it ... but you might want to wait for an official patch from spender or one of his colleagues ... like I said, I do not know if the patch is complete/correct.

Re: grsecurity-3.1-4.6.3-201607051723 doesn't compile

PostPosted: Wed Jul 06, 2016 5:37 am
by adminwset
I know but i just check Your "sugesstion it`s working or not" so Spender or someone else just use your patch in official release.

BR
TaKeN