Because product schedule , I try to tidy out some useful message about kernel coding . Maybe we should change the ugly code.
this article is about proc system's copy_from/to_user:
1 . they should not be called in atomic context.
2 . you can use the atomic version (__copy_[to|from]_user) instead when in atomic. at the same time , you must check user address is valid with access_ok in user context.
3 . before processing the user data in write_proc, we'd better copy them into kernel context with copy_from_user.
阅读(539) | 评论(0) | 转发(0) |