owned this note changed 6 years ago
Linked with GitHub

淺入淺出 ELF - 郭燁廷

由於場地問題,第二天我們移動到另一棟大樓啦!議程教室變動請見網站上的議程表

歡迎來到 https://hackmd.io/@coscup/2019 共筆

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

點擊本頁上方的 開始用 Markdown 一起寫筆記!
手機版請點選上方 按鈕展開議程列表。

請從這裡開始

投影片

介紹 ELF

學習動機:想寫的簡單的編譯器後端

連結器的功能:可將多個目的檔轉成執行檔

前身:a.out

動態連結函式庫

  • 執行檔不需要函數的細節 -> 減少硬碟使用
  • 允許多隻不同的城市使用同份 library call -> 減少記憶體使用
  • 修改動態連結函式庫,不需要重新編譯整支程式 -> 降低各種時間花費

ELF 格式

  • ELF header readelf -h /bin/sh
    • 是否為 ELF
    • 適用於怎樣的平台
    • 程式的入口位置
    • SHT 與 PHT 的資訊
    • 字串索引區位置
  • program header 展示的資料 readelf -l /bin/ls
    • 類型(標頭檔、直譯器資料、動態連結所需的資料)
    • 允許的操作(可讀、可寫、可執行)
    • 記憶體位置
    • 對齊
  • ELF Section Header readelf -S /bin/ls
    • 區段名字
    • 區段大小
    • 區段類型
    • 執行時期特性
    • 對齊

ltrace:可用來追蹤程式的所用的 library call

動態連結 - GOT

動態連結 - PLT

strip

GOT Hijacking

  • 使用 RELRO 解決
tags: COSCUP2019 Other OSS Topics IB304
Select a repo