2024/6/11 To interviewee === 目的:Code review interviewee 的作業 - 關於本次作業如果能重來,你會如何改進你的程式。你可以假定自己重來的時候,具有第一次寫完這份作業的 knowledge,換句話說,你可以保留經過這份作業所習得的知識,重寫一遍,你會如何改進? - 在所謂軟體工程的世界,團隊合作是相當重要的。所以你這份作業,會如何展現你在團隊合作,以及前後版本變更當中,所提供的價值? - 沒有要嚴厲批判,我們也歡迎擅長使用現代化工具的人。但我想請你誠實面對自己來說,有多少比例是藉由 LLM 輔助你完成的?LLM 讓你在這份作業當中學到了什麼? - evidence: - connect()、accept()、recv()與send()等系統呼叫 - 「或監測mprotect()調用」<-> 「ptrace相關功能呼叫」 - rootkit hook read()這個system call - 數據結構 - 「必須有良好的log來追蹤所有eBPF的行為,以維持可追朔性。」據你所知有沒有 log 不可使用的情況?對 re-entrancy, concurrent programming 的認知? - 不簡單的 printk - Real World Debugging with eBPF (SRECON 2023) - 「備註:perf buffer如果監測fork()->execve()->exit() 會有order問題」 - 什麼問題? - 「記得要用alwasys inline(verifier 對於stack的有嚴謹控制(512 bytes),函數內不能有太多associated function,不然會一直疊加stack)」 - 432 bytes and (bpf: introduce function calls) - How does the eBPF practice a function call? ```c struct execve_event_t { uint32_t pid; uint32_t ppid; uint32_t gid; uint32_t uid; char processname[50]; char filename[256]; char argv[MAX_ARG_NUM][MAX_ARG_LEN]; uint64_t timestamp; }; ``` - processStatusCheck ```cpp std::string processStatus; statusFile >> processStatus; statusFile >> processStatus; ``` bug, 應該讀三次 3319 (zsh) S 3310 ... - The memory_user.cpp - Large main function - RAII - jsonFile.is_open() 很多不可能 - `1 && !breakFlag` - Is your BPFInstance.obj leaked? ## Further reading: - [Hello eBPF: Tail calls and your first eBPF application (4)](https://mostlynerdless.de/blog/2024/02/12/hello-ebpf-tail-calls-and-your-first-ebpf-application-4/) - [Real World Debugging with eBPF (SRECON 2023)](https://www.youtube.com/watch?v=nggZEwGLC-Q) ## Time costs ~ 2hr