4 ms·
> For some reason that might be obvious but that I don’t understand yet (??) people don’t want to do key exchange in the kernel. It took me years to figure out
by cbhl 8y ago
> For some reason that might be obvious but that I don’t understand yet (??) people don’t want to do key exchange in the kernel.
It took me years to figure out that "user space" literally means a regular program running on the computer. Like, when you go "gcc -o hello hello.cc" that means "user space".
Whereas "kernel space" means downloading the kernel, make, copying it to /boot (or installing it in a VM), rebooting the computer, switching back to your stable kernel, repeat. So much more work, and security bugs mean that some attacker can access kernel memory space and methods (eek!).
- mav3rick 8y ago"user space" programs regularly transition to "kernel space" via syscalls. That's how they access resources and "get things done".
- cbhl 8y agoAh, yes, I was thinking about this in terms of "how does a developer iterate on this" and not in terms of execution. But yes, of course even "hello world" needs to execute a syscall in kernel space to display anything.
- kbenson 8y agoNo, that's not kernel space what that means. Kernel space means the code is implemented by the kernel and is executed in this privileged context (with its own memory region). Other kernel level actions (such as the actual methods for most disk and network access) can be used and instead of copying memory over to user space (because user code can't access kernel memory for security reasons). Because of this, all system calls (kernel routines) that return data use copying extensively. Every byte you read from the network or disk through a syscall is generally at least read into kernel memory then copied to user memory. As you can imagine, providing higher level routines where more is handled in kernel space eliminates a lot of memory copying, and thus can achieve better performance.
- TickleSteve 8y agouserspace==unprivileged execution, i.e. cannot directly access i/o ports, devices, etc. Normal applications execute like this. kernelspace==privileged execution, i.e. has access to all the resources of the machine, all RAM, all devices, etc. The kernel by definition requires control of the machine because its primary job is to manage resources on behalf of the userspace applications.