Linux Kernel - Adding field to task_struct
Posted
by Drex
on Stack Overflow
See other posts from Stack Overflow
or by Drex
Published on 2010-04-23T03:59:54Z
Indexed on
2010/04/23
4:03 UTC
Read the original article
Hit count: 247
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?
© Stack Overflow or respective owner