What is need of copy_from_user
kernel, kernel-module, linux-kernel
Solution
Kernel and user space do not necessarily have the same address space. They can be entirely separate, requiring special CPU instructions to move data between them.
The other important point is that the kernel needs to access user space with user permissions, i.e. if the user space program accessing that address would fail, then `copy_from_user()` will also fail, even if the kernel could access that address by itself.
Apart from general access violations, permission failure can also include a page not being in memory because it resides on disk. This may require some kind of special set up since normally the kernel does not use swappable memory.
Problem
If kernel can access user space why do we need copy_from_user to copy data in kernel memory, why it just cant access user space data? is it for performance?