# 2021q3 Homework1 (quiz1) contributed by < `nella17` > ###### tags: `2021 年暑期「Linux 核心」` > [GitHub](https://github.com/nella17/2021-summer-linux-kernel/tree/main/hideproc) ## 程式碼運作原理 使用 `device_create` 建立 `/dev/hideproc` 裝置,透過 character device I/O 操作,變更核心內部行程管理的 linked list。 並使用 ftrace callback,在呼叫 `find_ge_pid` 時,將進入點換成 hook_find_ge_pid,跳過存在 linked list 裡的 PID。 - [ftrace - Function Tracer](https://www.kernel.org/doc/Documentation/trace/ftrace.txt) - [Using ftrace to hook to functions](https://www.kernel.org/doc/html/latest/trace/ftrace-uses.html) ## 程式碼改進 ### 沒有移除相關資源 在 `_hideproc_exit` 時,沒有移除相關資源,讓系統出現以下錯誤,而且無法直接 reboot,需要硬關機再開機。 ``` BUG: kernel NULL pointer dereference, address: 0000000000000010 ``` [commit 0291e18](https://github.com/nella17/2021-summer-linux-kernel/commit/0291e183d3e1570bad6a57b7b4a417bcff1b5f3a) ### del 會將所有 pid unhide `unhide_process` 沒有判斷目前的 node 是否為要移除的 pid。 [commit d8de1c0](https://github.com/nella17/2021-summer-linux-kernel/commit/d8de1c05f2d83841a84d156dd629fbce4bb91bdc) ### `device_read` 存在 buffer overflow 對於字串操作沒有使用 length-limited string 的函式。 [commit 3a0b455](https://github.com/nella17/2021-summer-linux-kernel/commit/3a0b4558b3b0c253b74698540b72a2c73add466b) ### 隱藏 PPID [commit 4ff4479](https://github.com/nella17/2021-summer-linux-kernel/commit/4ff4479d70084292207c560e0c699c4a41beaf12) ### 允許給定 PID 列表 [commit cdd7696](https://github.com/nella17/2021-summer-linux-kernel/commit/cdd7696e8dae2db9b0e8f9fe52bf78dd32766977)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up