문제

As we all know that kernel has access to user space also. Thus, it doesn't need the special function - copy_to_user(). Why is it required then? The kernel can access the user space address directly. Isn't it?

도움이 되었습니까?

해결책

Because kernel does not want userspace to modify the passed data while it process the same data.

Copy from/to user

  1. Validates buffer

  2. Copy buffer to/from user so it does not have worry about data being updated in user space.

다른 팁

Note that on some architectures, it's not implemented with a simple memcpy():

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top