kernel - Why is the setup syscall not callable by any user? -
http://linux.die.net/man/2/setup
i didn't find reason on man page.
first off, syscall no longer exists:
since linux
2.1.121
, no such function exists anymore.
from can see in 2.1.120
, used in init of kernel (and in fact has syscall number 0
). called twice: first call freed initial memory (from initram) , second call sets devices, filesystems , mounted root. bad if program run syscall (it cause segmentation violations or other bad things).
why it's syscall in first place question. downloaded 1.0.0
, , even then syscall not used init (which first guess why syscall). in 0.01
used inside kernel. since there's no usage int 0x80
, i'm perplexed why linus did this.
i've sent email linus & lkml , asked on irc (although it's unlikely other linus know, , he's busy answering emails mitochondrial dna of linux).
edit: okay, looking further, turns out kernel calling process context (the setup
call acts syscall, int 0x80
, all). initialisation of kernel not done within process context, , (according linus):
so code goes user space, initial user space shared kernel (until first fork()). initial user mode transition switching user segments [...] in init/main.c, magic that
move_to_user_mode(); if (!fork()) { /* count on going ok */ init(); } for(;;) pause(); /* [this idle task] */
where "move_to_user_mode()" reload segments (some hand, cs/ss doing "iret"). first fork() done in user space, , before happens kernel cannot sleep (because there no idle task). [...] "setup()" system call because needs sleep (to io), , kernel couldn't sleep before got user-mode , first fork thing.
could have been done differently? sure. don't way more, , create idle tasks separately , not "fork()" more. kind of made sense @ time.
Comments
Post a Comment