Timeline for Changing from Kernel mode to User mode (and vice versa)
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 16, 2014 at 0:28 | comment | added | user4577 | Having a drop-privileges not require privilege may introduce virtualization issues and fails to catch what is most likely a bug (or memory corruption) in code intended not to be privileged. | |
Apr 13, 2013 at 7:24 | comment | added | avi | I found this lecture file - cse.ohio-state.edu/~teodores/download/teaching/cse675.au08/… in which (3rd slide) its clearly mentioned that Kernel mode to user mode is done via an instruction. So I can safely remove out the first two options. Now it boils down to only two options, privileged or non-privileged. btw thank you very much for helping me out & answering my doubts patiently. | |
Apr 12, 2013 at 18:10 | comment | added | avi | "As this operation's effect (whatever the mode may be) is to end in non-privileged mode" - agreed. "it isn't necessary to be privileged to invoke it" - this is what I am not able to get. If it is a non-privileged instruction, then wouldn't be a process in user mode run it & preempt a kernel mode process ? | |
Apr 12, 2013 at 11:58 | comment | added | vonbrand | As this operation's effect (whatever the mode may be) is to end in non-privileged mode, it isn't necessary to be privileged to invoke it. There is no possible harm in userland code "dropping" to userland privileges. Useless to be able to do it? You bet. | |
Apr 12, 2013 at 10:55 | comment | added | avi | I have spent a lot of time on this single question. Read so many lecture slides online and gone through everything again & again. And I am still not able to come with different answer. My answer to the question posted is (C.) Privileged instruction. Please tell me if it is right or wrong and also the correct answer. Thank you ! | |
Apr 11, 2013 at 15:58 | comment | added | avi | btw when I say 'user', I mean some program in 'user mode'. | |
Apr 11, 2013 at 15:57 | comment | added | avi | "It can't be privileged (if it was, no user could do it ;-)" - this is what I am not understanding. If user could change from kernel mode to user mode, then whats the point in having a kernel mode ? I think user shouldn't be allowed to do that. | |
Apr 11, 2013 at 15:54 | comment | added | vonbrand | It can be done with an interrupt, but there are other possibilities. It can't be privileged (if it was, no user could do it ;-). | |
Apr 11, 2013 at 15:25 | comment | added | avi | Damn, I also didn't understood why user mode to kernel mode wrong ? In your explanation, in first few lines you mentioned user to kernel mode can be done via INT instructions & lastly you mentioned : 'The means of going to supervisor mode can't be privileged'. Isn't this all I mentioned ? H/W interrupt (which is obvious, eg. I/O requests), S/W interrupt (INT instruction) & non-privileged instruction. | |
Apr 11, 2013 at 15:25 | comment | added | avi | I am not getting it right. Your previous comment & answer contradicting itself. In comment you said, 'a "normal user" just can't get into kernel mode', but in answer, you mentioned ' "No need for the "drop privileges" operation to be privileged"'. What I am missing ? :S To simply say, in order to change Kernel to User mode, mode bit has to be changed. Which cannot be done in user mode right ? Thus it cannot be non-privileged instruction. | |
Apr 11, 2013 at 15:09 | comment | added | vonbrand | Yes, a "normal user" just can't get into kernel mode. Besides, dropping privileges can't do any harm, so it doesn't need to be privileged (by itself). If doing this on some machine means for example frobbing privileged registers, it will be privileged there. But it doesn't have to be privileged. | |
Apr 11, 2013 at 15:04 | comment | added | avi | "No need for the "drop privileges" operation to be privileged". So you mean to say, to change from Kernel to User mode, a non-privileged instruction will do. If it is a non-privileged instruction, then even a user can execute it & change from kernel to user mode ? Or did I interpret it wrong ? | |
Apr 11, 2013 at 14:53 | history | answered | vonbrand | CC BY-SA 3.0 |