Linux Kernel - Adding field to task_struct
- by Drex
I'm playing around with the linux kernel and added a struct field to the task_struct in sched.h. I know that can be costly but my struct is very small.
I then initialize the new struct in INIT_TASK() and also re-initialize in fork.c copy_process() function so that when the INIT task or any other task creates a new process the process gets the init values.
What then happens is when I try to run the kernel I get a SEGFAULT.
The gdb error is:
Locating the bottom of the address space ...
Program received signal SIGSEGV, Segmentation fault.
0x08066ad7 in page_ok (page=) at arch/um/os-Linux/sys-i386/task_size.c:31
31 n = *address;
It looks like it fails out in task_size. Is there anything else I need to do to add a field to task_struct?