Entry points for execution

From: john moser
Date: Wed Jan 07 2004 - 15:17:33 EST


I need to make a slight alteration to every task_struct for every task. I've put my code into do_fork() but it seems that init (pid 1) has a parent process, as I checked for if (p->parent) and it evidently connected to. . . something.

#ifdef CONFIG_LINUX_JAIL
/*
* If we have no parent (parent == 0, i.e. init), then NULL our
* jail. Else, connect to the jail of the parent.
*/
p->pjail = NULL;
if (p->parent)
linux_jail_attatch(p->parent->pjail, p);
#endif

The thing is, it denies me chroot when I try to choot with restricted chroot (no chroot in chroot). Now, the code I have all looks correct, so I'm thinking, it has to be that init is the child of pid 0, and that pid 0 is started in some other way, and thus I'm not clipping the tsk->pjail.

My new code is:

#ifdef CONFIG_LINUX_JAIL
/*
* If we have no parent (parent == 0, i.e. init), then NULL our
* jail. Else, connect to the jail of the parent.
*/
p->pjail = NULL;
if (p->pid != 1 && p->parent)
linux_jail_attatch(p->parent->pjail, p);
#endif

I'm thinking, the idle task maybe? Or does that "not exist" physically? If init has a parent then I'd PREFER to set that parent's pjail to NULL, not because it's magic and might blow up, but because I want things done *cleanly*, and even if the pointer will *NEVER* be examined, having a pointer pointing to something that doesn't belong to the struct is NOT my style.

Can anyone give me all of the lowest level entry points for tasks (i.e. all the places where I can modify a task_struct->* before the task begins execution at its earliest point in creation)?

--Bluefox

_____________________________________________________________
Linux.Net -->Open Source to everyone
Powered by Linare Corporation
http://www.linare.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/