SuNsHiNe-75

@SuNsHiNe-75

Joined on Feb 23, 2024

  • 正式期末專題筆記,公開於 Linux 核心專題: 以 eBPF 打造 TCP 伺服器。 參考 2023 年開發紀錄 之筆記 eBPF (Extended Berkeley Packet Filter) 圖片 使用者在 User space 中撰寫 BPF 程式(C 語言),並透過特殊編譯工具(常見的 BPF 編譯工具包括 LLVM/Clang 和一些專用的 BPF 編譯器 (如 BCC 和 bpftrace))將其轉換為 BPF Bytecode,並注入到 Kernel。 此 Bytecode 是一種經過優化的程式碼,以利在 Kernel 中的效率執行;另外,其有特定格式,以讓 Verifier 能夠有效進行靜態分析。
     Like  Bookmark
  • 資料來源:NCKU 黃敬群(Jserv)教授編撰之 Demystifying the Linux CPU Scheduler。 「核心除錯」即使對於經驗豐富的核心開發者來說也是一個重大挑戰。 例如,如果系統出現延遲或同步問題(如 undetected Race conditions),很難精確找到問題的根源-哪些子系統涉及其中?在什麼條件下問題會出現? Ftrace 是專門為了解決這類問題而設計的除錯工具,不僅能用來觀察核心發生的事情,還能透過「觀察函式的運作流程」來接近原始碼。 Ftrace 的名稱來自「函式追蹤器(function tracer)」,這是其多個功能中的一個。每種追蹤模式都稱為追蹤器(tracer),每個追蹤器都帶有許多可以調整的選項。它們可以進行函式追蹤、事件追蹤,測量 Context-switch 的時間,或測量中斷被禁用的時間;Ftrace 也非常具有擴展性,因為可以像模組一樣添加新的追蹤器。
     Like  Bookmark
  • contributed by <SuNsHiNe-75> Quiz 1 - Problem C :::danger Choose one problem (A, B, or C) from Quiz1, translate it from C code to a complete RISC-V assembly program, and include the relevant test data. ::: C Code The C code for the __builtin_clz function mentioned in Problem C is as follows:
     Like  Bookmark
  • 資料來源:NCKU Jserv 教授開設之計算機結構課程-RISC-V Procedures。 :::info 可回來查閱 RISC-V Symbolic Register Names。 ::: RISC-V Function Call Six Fundamental Steps in Calling a Function 將 arguments 放在函式可以存取的位置。 將「控制權」轉交給函式。
     Like  Bookmark
  • 資料來源:NCKU Jserv 教授開設之計算機結構課程-RISC-V Instructions。 更詳細閱讀,可參照 RISC-V Assembly Programmer’s Manual 及 The RISC-V Instruction Set Manual: Volume I: Unprivileged ISA。 :::info 大部分都學過,特別標記: RISC-V 提供 32 個整數暫存器(x0:必 0;x1-x31:可用)。 Addition / Subtraction:add / sub / addi。 Bitwise:and / or / xor / andi / ori / xori。
     Like  Bookmark
  • 資料來源:NCKU 李南逸教授之密碼學課程-密碼學應用 3。 Increase Efficiency On-line/Off-line Signature Scheme based on RSA 優點:速度快、效率佳; 缺點:One-time。 在線/離線簽名在需要快速生成簽名的環境中非常有用,無論是由於大量請求,還是因為執行簽名的設備計算能力不足。 Off-Line Computation
     Like  Bookmark
  • 資料來源:NCKU 李南逸教授之密碼學課程-密碼學應用 1。 金鑰分配(Key Distribution) Symmetric Key Distribution Key Distribution Center(KDC)用以分發金鑰給使用者。 其有兩大使用場景: Flat Multiple KDCs ![圖片](https://hackmd.io/_uploads/rkyjcf2AR.png =60%x)
     Like  Bookmark
  • 資料來源:NCKU 李南逸教授之密碼學課程-密碼學應用 2。 Homomorphic Encryption :::info 本人專題題目,故不詳細記錄。 ::: Concept ![圖片](https://hackmd.io/_uploads/S1MvmQnRC.png =50%x)
     Like  Bookmark
  • 資料來源:NCKU 李南逸教授之密碼學課程-密碼學應用 1。 訊息確認(Message Authentication) Message Integrity 到目前為止,我們所研究的加密系統提供了 secrecy 或 confidentiality,但沒有提供 integrity。 然而,有時我們可能甚至不需要 secrecy,而是必須確保 integrity。 檢查 Integrity 大略如下圖: ![圖片](https://hackmd.io/_uploads/HJdXrWnCR.png =70%x)
     Like  Bookmark
  • 資料來源:NCKU 李南逸教授之密碼學課程-密碼學概論。 密碼系統(Cryptographic System) ![image](https://hackmd.io/_uploads/r1YMLtiAC.png =80%x) Kerckhoff's principle:密碼系統的安全性,需「僅依賴其秘密金鑰」,而非其密碼演算法的隱藏。 可提供之安全服務種類:機密性(Confidentiality)、確認性(Authentication)、完整性(Integrity)、不可否認性(Non-repudiation)、存取控制(Access Control)、可使用性(Availability)。 安全密碼系統之定義:無條件安全(Unconditionally Secure):攻擊者計算能力多強都無法破密。只有 One-time pad system 可達成,但並無真正的系統存在。 計算安全(Computationally Secure)破解密碼系統的「代價」超過獲益。
     Like  Bookmark
  • 參考資源:科技下午茶 - RTOS-01。 OS v.s. Micro Kernel Linux 架構及名詞解釋 ![圖片](https://hackmd.io/_uploads/rkezF6I0A.png =70%x) Open System:隨時能下載新的應用程式(如 Linux、Windows、Android)。 Closed System:產品出貨之後,Application 就定了,不能再下載新的應用程式(如大部分的嵌入式系統)。 Dynamic Linking:OS 本身所提供的 API 或服務可以在出貨之後「再更新」(如 Windows Update)。於 Windows 可用 DLL 達成;在 Linux 則有 Shell library 的概念。 Static Linking:大部分簡單的 OS。API 無法再增加。
     Like  Bookmark
  • 資料來源:PUFsecurity Corp. Hardware Security Theory and Practices 課程。 Hardware Root-of-Trust 硬體資安 ![圖片](https://hackmd.io/_uploads/BJQNuhv0R.png =80%x) 舉例-Side-Channel Attack Using Power Analysis: ![圖片](https://hackmd.io/_uploads/r1lcunD0R.png =90%x) 為何需要硬體資安,有不同面向:
     Like  Bookmark
  • 參考資源:科技下午茶 - RTOS-03。 FreeRTOS Configuration About FreeRTOS 2003 found by Richard Barry, 當時任職於 WHIS。 v1.2.3 (2003) change from Open Software license to GNU GPL。 V10.0.0 (2017) change to MIT licensed, AWS 為主要管理者。 v10.5.1 (2022 Nov.) 僅 GCC 部分可支援 49 個架構(portable / GCC)。 下載:
     Like  Bookmark
  • 參考資源:科技下午茶 - RTOS-02。 Thread v.s. Task(Process) Single Core (1970~1980) Multitasking(多工處理 / IPC)。任何時刻,僅有 1 個 Task / ISR 正在執行。 概念:Create Task(main / none Bare-metal)。 MMU (1980~1990) ![圖片](https://hackmd.io/_uploads/SJC7_xwRR.png =35%x)
     Like  Bookmark
  • Sobel Edge Operation with Shift-Register-Based Line Buffer GitHub:HDL_hw4 It mainly covers the following tasks: Three multiplication-accumulation operations are required to compute the intensity of an image pixel. Use the Sobel convolution masks to find the vertical edges and horizontal edges from the intensity image. Write RTL code to fetch the original colored image from memory unit in the test bench, one pixel per cycle, and generate the corresponding intensity value which is stored in a line buffer (constructed with shift registers). Model the edge convolution hardware using RTL code and generate the edge map pixels (one pixel per cycle) which are sent to memory unit in testbench. Verify my Verilog codes both in the RTL level and in the gate level where the gate-level netlists are synthesized by Design Compiler.
     Like  Bookmark
  • Design Compiler Optimization Commands for pipelined THUMB CPU GitHub:HDL_hw3 It mainly covers the following tasks: Trace the given Verilog RTL codes of the 16-bit pipelined THUMB processor, and use the given test bench tb_thumb.v to verify the RTL code. In the original Verilog, all the four pipelined stages (IF stage, ID stage, EX stage, WB stage) are in a single module. Modify the code so that each pipelined stage is in a separate module, so that the critical path delay of each pipelined stage can be easily measured from the synthesis results of the Synopsys Design Compiler. Generate three different synthesis results using different design constraints: area-optimized result, delay-optimized result, and in-between using different constraints in the Synopsys DC. Compare the differences of critical path delays, area, and power for the three different synthesis results. Measure the critical path delay of each pipelined stage in the synthesis results. Use Synospys PrimeTime to measure the delay and power by providing a sequence of inputs. Compare the delay and power with those obtained from Synospsy Design Compiler.
     Like  Bookmark
  • Adder/Subtractor/Multiplier Designs: Non-Pipelined versus Pipelined GitHub:HDL_hw2 It mainly covers the following tasks: Adder/Subtractor/Multiplier Designs: Non-Pipelined RTL Simulation of Non-Pipelined Design Logic Synthesis with Synopsys Design Compiler Adder/Subtractor/Multiplier Designs: Pipelined Simulation of the Pipelined Design
     Like  Bookmark
  • Adder Designs Using Verilog Structural, Dataflow, and Behavioral Modeling GitHub:HDL_hw1 It mainly covers the following tasks: Designing a 32-bit adder using different Verilog modeling methods (Structural Modeling, Dataflow Modeling, Behavioral Modeling). Storing outputs in registers. Pre/post-synthesis simulation (using Ncverilog for pre/post-simulation, using Design Compiler for synthesis). Comparison of synthesis results.
     Like  Bookmark
  • contributed by < SuNsHiNe-75 > 閱讀〈因為自動飲料機而延畢的那一年〉的啟發與心得 記錄每篇大意(方便回憶): (1) 前言與為何決定研發「自動飲料機」。 (2) 自動飲料機願景發想-描述天真的他們對現實的無知。 (3) 自動落杯器之製作辛酸史-衍伸對專案實現時間的焦慮,並決定找尋幫手。 「大多數人一直活在本來就應該這樣嗎的童話世界裡,電視打開就可以看,機車買來就可以騎,手機買來就可以用,一切都理所當然,本來就應該這樣。偶爾買到不好用的商品我們就抱怨幾句,丟掉換其他更好用的牌子,卻很少意識到那個本來就該這樣,背後需要經過多少人月的投入與研發。」
     Like  Bookmark
  • contributed by < SuNsHiNe-75 > 有關〈Linux 核心模組運作原理〉 解釋 insmod 後,Linux 核心模組的符號 (symbol) 如何被 Linux 核心找到 首先要知道,insmod 程式的主要目的是「將模組 (module) 掛載至核心」。 可用 strace 來追蹤執行 insmod 時,會執行哪些系統呼叫,會發現其呼叫 idempotent_init_module 後在該函式當中還會呼叫 init_module_from_file ,在 init_module_from_file 才真正呼叫到 load_module。 load_module:大致就是 Linux 核心為模組配置記憶體和載入模組相關資料的地方。
     Like  Bookmark