Protection Mode in Minix - Minix

This is a discussion on Protection Mode in Minix - Minix ; Hello, I'm trying to understand the implementation of Protection Mode in Minix. Have few doubts on the same. Understood that all the servers run in level3 (USER_PRIVILEGE), which means that the system calls also run in level 3. But system ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Protection Mode in Minix

  1. Protection Mode in Minix

    Hello,

    I'm trying to understand the implementation of Protection Mode in
    Minix. Have few doubts on the same.

    Understood that all the servers run in level3 (USER_PRIVILEGE), which
    means that the system calls also run in level 3. But system calls in
    turn make few kernel calls - like sys_fork, sys_exit, sys_trace, which
    I presume has to run in level 0 (TASK_PRIVILEGE) for them to access
    kernel data structures.

    What I don't see is that, where exactly does the call to kernel call
    changes itself to run in level 0. sys_task() which basically checks
    privileges (I mean if its a valid call) and dispatches to the
    respective function when a kernel call is made, also does not change
    itself to level 0. I also had a look at IPC mechanism, which also
    doesn't seem to change any caller/callee to another level.

    level0() function, which is basically used to run a specific function
    in level 0 is also not being called for a kernel call.

    Any help is appreciated.

    Thanks
    Sudheer


  2. Re: Protection Mode in Minix

    On 15 Mar 2007 18:58:49 -0700, sudheer.gupta@gmail.com
    wrote:
    > What I don't see is that, where exactly does the call to kernel call
    > changes itself to run in level 0.


    I'm not deeply familiar with Minix, but this is how it _usually_ goes:
    The syscall is implemented as a software interrupt, and the interrupt
    handler (which has been previously set up by privileged code) is
    automatically run at privileged mode by the CPU. The change in privilege
    is implicit in the call.

    I doubt Minix does something completely different from that, but a
    confirm from somebody who's less of a bystander would be nice, of
    course

    --
    Mikko Rauhala - mjr@iki.fi - http://www.iki.fi/mjr/ >
    Eduskuntaehdokas 30, Helsinki - http://rauhala.name/ >
    Vaalimasinaattori - http://vaalimasinointi.org/ >


  3. Re: Protection Mode in Minix

    Mikko Rauhala wrote:
    > On 15 Mar 2007 18:58:49 -0700, sudheer.gupta@gmail.com
    > wrote:
    >> What I don't see is that, where exactly does the call to kernel call
    >> changes itself to run in level 0.


    > I'm not deeply familiar with Minix, but this is how it _usually_ goes:
    > The syscall is implemented as a software interrupt, and the interrupt
    > handler (which has been previously set up by privileged code) is
    > automatically run at privileged mode by the CPU. The change in privilege
    > is implicit in the call.


    > I doubt Minix does something completely different from that, but a
    > confirm from somebody who's less of a bystander would be nice, of
    > course


    I cannot confirm your suspicion, but I wholeheartedly support it

    Jens

    --
    Jens de Smit
    Student Computer Science | Vrije Universiteit Amsterdam
    jfdsmit@few.vu.nl | http://www.few.vu.nl/~jfdsmit
    "[In the end, people] get furious at IT that the goddamn magic isn't working"
    -- Stewart Dean

  4. Re: Protection Mode in Minix

    All,

    On 2007-03-16, Mikko Rauhala wrote:
    > On 15 Mar 2007 18:58:49 -0700, sudheer.gupta@gmail.com
    > wrote:
    >> What I don't see is that, where exactly does the call to kernel call
    >> changes itself to run in level 0.

    >
    > I'm not deeply familiar with Minix, but this is how it _usually_ goes:
    > The syscall is implemented as a software interrupt, and the interrupt
    > handler (which has been previously set up by privileged code) is
    > automatically run at privileged mode by the CPU. The change in privilege
    > is implicit in the call.
    >
    > I doubt Minix does something completely different from that, but a
    > confirm from somebody who's less of a bystander would be nice, of
    > course


    You're more or less right, but it's a bit more subtle. The only
    syscalls, as you describe them, in minix are the IPC functions
    (currently send, receive, sendrec, notify). These are indeed called by
    software interrupts.

    Because it's awkward to talk about such low-level functions as syscalls,
    the MINIX book calls (!) sending messages (calls) to PM and FS system
    calls, as they look and behave just like system calls on other unix
    lookalikes, and messages (calls) to SYSTEM are called kernel calls,
    which have no counterpart in other unices as all that functionality is
    internal to the kernel there.

    To make a call, a message is constructed and sent to the right recipient
    (usually FS or PM for application processes, and usually SYSTEM for
    drivers, or FS, or PM). Anybody can invoke the IPC system calls; control
    then ends up in proc.c, which is where some higher-level access checks
    are done.

    SYSTEM runs in the kernel address space, so gets to touch kernel data
    structures once it's received the request and verified that the process
    is actually allowed to make that call.

    =Ben



+ Reply to Thread