Submit Search
Upload
Hello world 的一生
•
11 likes
•
6,403 views
Wen Liao
Follow
從 User mode和 kernel mode討論一個Hello world執行檔從產生到執行發生的事情
Read less
Read more
Technology
Report
Share
Report
Share
1 of 42
Download now
Download to read offline
Recommended
React for Non Techies
React for Non Techies
Jack Hoy
Floodmap Desktop for ArcGIS
Floodmap Desktop for ArcGIS
ewug
React - Start learning today
React - Start learning today
Nitin Tyagi
Android Internals
Android Internals
Opersys inc.
Introduction to Android Development
Introduction to Android Development
donnfelker
React + Redux. Best practices
React + Redux. Best practices
Clickky
Effectiveness Analysis of Agriculture BMPs by SWAT Model for Apropriate Contr...
Effectiveness Analysis of Agriculture BMPs by SWAT Model for Apropriate Contr...
Stankovic G
OpenLayers 3
OpenLayers 3
Camptocamp
Recommended
React for Non Techies
React for Non Techies
Jack Hoy
Floodmap Desktop for ArcGIS
Floodmap Desktop for ArcGIS
ewug
React - Start learning today
React - Start learning today
Nitin Tyagi
Android Internals
Android Internals
Opersys inc.
Introduction to Android Development
Introduction to Android Development
donnfelker
React + Redux. Best practices
React + Redux. Best practices
Clickky
Effectiveness Analysis of Agriculture BMPs by SWAT Model for Apropriate Contr...
Effectiveness Analysis of Agriculture BMPs by SWAT Model for Apropriate Contr...
Stankovic G
OpenLayers 3
OpenLayers 3
Camptocamp
from Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Works
National Cheng Kung University
Hcsm lect-20120913
Hcsm lect-20120913
lusecheng
運用 Docker 整合 Laravel 提升團隊開發效率
運用 Docker 整合 Laravel 提升團隊開發效率
Bo-Yi Wu
Build Your Own Android Toolchain from scratch
Build Your Own Android Toolchain from scratch
National Cheng Kung University
Introduce to Linux command line
Introduce to Linux command line
Wen Liao
Ch01
Ch01
jashliao
Continuous Delivery Workshop with Ansible x GitLab CI
Continuous Delivery Workshop with Ansible x GitLab CI
Chu-Siang Lai
Docker 基礎介紹與實戰
Docker 基礎介紹與實戰
Bo-Yi Wu
Cygwin intro
Cygwin intro
cri fan
Cygwin intro
Cygwin intro
cri fan
Continuous Delivery with Ansible x GitLab CI (2e)
Continuous Delivery with Ansible x GitLab CI (2e)
Chu-Siang Lai
容器與 Gitlab CI 應用
容器與 Gitlab CI 應用
Philip Zheng
2010 08-14 web-sitei18n
2010 08-14 web-sitei18n
tsunghaolee
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Chu-Siang Lai
軟體組裝心得分享
軟體組裝心得分享
Wen Liao
用 Drone 打造輕量級容器持續交付平台
用 Drone 打造輕量級容器持續交付平台
Bo-Yi Wu
IoT開發平台NodeMCU
IoT開發平台NodeMCU
承翰 蔡
Clonezilla tutorial.v7
Clonezilla tutorial.v7
hs1250
Docker容器微服務 x WorkShop
Docker容器微服務 x WorkShop
Philip Zheng
Jenkins x GitLab CI
Jenkins x GitLab CI
Yihsuan Chen
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
Wen Liao
開放街圖 自助旅行的好幫手
開放街圖 自助旅行的好幫手
Wen Liao
More Related Content
Similar to Hello world 的一生
from Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Works
National Cheng Kung University
Hcsm lect-20120913
Hcsm lect-20120913
lusecheng
運用 Docker 整合 Laravel 提升團隊開發效率
運用 Docker 整合 Laravel 提升團隊開發效率
Bo-Yi Wu
Build Your Own Android Toolchain from scratch
Build Your Own Android Toolchain from scratch
National Cheng Kung University
Introduce to Linux command line
Introduce to Linux command line
Wen Liao
Ch01
Ch01
jashliao
Continuous Delivery Workshop with Ansible x GitLab CI
Continuous Delivery Workshop with Ansible x GitLab CI
Chu-Siang Lai
Docker 基礎介紹與實戰
Docker 基礎介紹與實戰
Bo-Yi Wu
Cygwin intro
Cygwin intro
cri fan
Cygwin intro
Cygwin intro
cri fan
Continuous Delivery with Ansible x GitLab CI (2e)
Continuous Delivery with Ansible x GitLab CI (2e)
Chu-Siang Lai
容器與 Gitlab CI 應用
容器與 Gitlab CI 應用
Philip Zheng
2010 08-14 web-sitei18n
2010 08-14 web-sitei18n
tsunghaolee
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Chu-Siang Lai
軟體組裝心得分享
軟體組裝心得分享
Wen Liao
用 Drone 打造輕量級容器持續交付平台
用 Drone 打造輕量級容器持續交付平台
Bo-Yi Wu
IoT開發平台NodeMCU
IoT開發平台NodeMCU
承翰 蔡
Clonezilla tutorial.v7
Clonezilla tutorial.v7
hs1250
Docker容器微服務 x WorkShop
Docker容器微服務 x WorkShop
Philip Zheng
Jenkins x GitLab CI
Jenkins x GitLab CI
Yihsuan Chen
Similar to Hello world 的一生
(20)
from Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Works
Hcsm lect-20120913
Hcsm lect-20120913
運用 Docker 整合 Laravel 提升團隊開發效率
運用 Docker 整合 Laravel 提升團隊開發效率
Build Your Own Android Toolchain from scratch
Build Your Own Android Toolchain from scratch
Introduce to Linux command line
Introduce to Linux command line
Ch01
Ch01
Continuous Delivery Workshop with Ansible x GitLab CI
Continuous Delivery Workshop with Ansible x GitLab CI
Docker 基礎介紹與實戰
Docker 基礎介紹與實戰
Cygwin intro
Cygwin intro
Cygwin intro
Cygwin intro
Continuous Delivery with Ansible x GitLab CI (2e)
Continuous Delivery with Ansible x GitLab CI (2e)
容器與 Gitlab CI 應用
容器與 Gitlab CI 應用
2010 08-14 web-sitei18n
2010 08-14 web-sitei18n
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
軟體組裝心得分享
軟體組裝心得分享
用 Drone 打造輕量級容器持續交付平台
用 Drone 打造輕量級容器持續交付平台
IoT開發平台NodeMCU
IoT開發平台NodeMCU
Clonezilla tutorial.v7
Clonezilla tutorial.v7
Docker容器微服務 x WorkShop
Docker容器微服務 x WorkShop
Jenkins x GitLab CI
Jenkins x GitLab CI
More from Wen Liao
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
Wen Liao
開放街圖 自助旅行的好幫手
開放街圖 自助旅行的好幫手
Wen Liao
GNU AS簡介
GNU AS簡介
Wen Liao
UPnP 1.0 簡介
UPnP 1.0 簡介
Wen Liao
故事:自由軟體和 Richard Stallman
故事:自由軟體和 Richard Stallman
Wen Liao
Hello world在那邊?背景說明
Hello world在那邊?背景說明
Wen Liao
A successful git branching model 導讀
A successful git branching model 導讀
Wen Liao
GNU ld的linker script簡介
GNU ld的linker script簡介
Wen Liao
Trace 程式碼之皮
Trace 程式碼之皮
Wen Liao
淺談Debian套件打包
淺談Debian套件打包
Wen Liao
GNU Make, Autotools, CMake 簡介
GNU Make, Autotools, CMake 簡介
Wen Liao
A Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
A Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
Wen Liao
GNU gettext簡介 - 以C語言為範例
GNU gettext簡介 - 以C語言為範例
Wen Liao
Guide to GStreamer Application Development Manual: CH1 to CH10
Guide to GStreamer Application Development Manual: CH1 to CH10
Wen Liao
Testing in python 2.7.3
Testing in python 2.7.3
Wen Liao
從組裝軟體中談談軟體發展管理
從組裝軟體中談談軟體發展管理
Wen Liao
More from Wen Liao
(16)
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
開放街圖 自助旅行的好幫手
開放街圖 自助旅行的好幫手
GNU AS簡介
GNU AS簡介
UPnP 1.0 簡介
UPnP 1.0 簡介
故事:自由軟體和 Richard Stallman
故事:自由軟體和 Richard Stallman
Hello world在那邊?背景說明
Hello world在那邊?背景說明
A successful git branching model 導讀
A successful git branching model 導讀
GNU ld的linker script簡介
GNU ld的linker script簡介
Trace 程式碼之皮
Trace 程式碼之皮
淺談Debian套件打包
淺談Debian套件打包
GNU Make, Autotools, CMake 簡介
GNU Make, Autotools, CMake 簡介
A Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
A Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
GNU gettext簡介 - 以C語言為範例
GNU gettext簡介 - 以C語言為範例
Guide to GStreamer Application Development Manual: CH1 to CH10
Guide to GStreamer Application Development Manual: CH1 to CH10
Testing in python 2.7.3
Testing in python 2.7.3
從組裝軟體中談談軟體發展管理
從組裝軟體中談談軟體發展管理
Hello world 的一生
1.
Hello World 的一生 Wen
Liao Taiwan Linux Kernel Hackers 1
2.
About Wen /41
3.
● 測試環境 ● 懷胎九月及出生 ●
短暫的一生 ● QA 目錄 3
4.
測試環境 (1) 4
5.
測試環境 (2) 5
6.
● 測試環境 ● 懷胎九月及出生 ●
短暫的一生 ● QA 目錄 6
7.
cc 就搞定 7
8.
事情當然沒有我們憨人 想的那麼簡單 8
9.
● 現實是,除了執行檔以外,在編 譯的過程的副產品 ○ hello.i
// 展開巨集後的C 語言 ○ hello.s // 將C語言轉成組合語言 ○ hello.o // 將組合語言轉成ELF格式的object file GCC = GNU Compiler Collection 9
10.
hello.i 節錄 八百行 stdio.h 10
11.
hello.s 節錄 (1) 11
12.
hello.s 節錄 (2) 12
13.
hello.s 節錄 (2) 13
14.
hello.s 節錄 (1) 14
15.
hello.s 節錄 (2) https://software.intel.com/sites/default/files/article/402129/mpx-linux64-abi.pdf 15
16.
hello.s 節錄 (2) https://software.intel.com/sites/default/files/article/402129/mpx-linux64-abi.pdf 16
17.
囉唆的真實編譯 (1) 17
18.
囉唆的真實編譯 (2) 18
19.
囉唆的真實編譯 (3) ld 節錄
(1) 19
20.
囉唆的真實編譯 (3) ld 節錄
(2) 20
21.
Link時除了你的object外,還有 21
22.
/usr/lib/x86_64-linux-gnu/Scrt1.o /usr/lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/x86_64-linux-gnu/crtn.o ... 除了你的object外,還有 22
23.
Why? 23
24.
反組譯 參數 呼叫函數 24
25.
__libc_start_main (1) 25
26.
__libc_start_main (2) 26
27.
● 檢查權限,確保安全性 ● thread
subsystem初始化 (我可不知道什麼thread subsystem唷) ● 向rtld_fini註冊release callback function,當shared object結束時使用該 callback釋放資源 ● 呼叫init callback function ● 呼叫main callback function並且帶入參數 ● 當main callback function結束後,將回傳值作為參數呼叫exit __libc_start_main (3) 27
28.
● 測試環境 ● 懷胎九月及出生 ●
短暫的一生 ● QA 目錄 28
29.
linux/fs/exec.c 29
30.
do_execve() 30
31.
register_binfmt() 31
32.
binfmt 資料結構 32
33.
linux/fs/binfmt_elf.c 33
34.
linux/fs/exec.c /41
35.
load_elf_binary 35
36.
struct linux_binprm 省略版 36
37.
struct linux_binprm buf[128] struct vm_area_struct
*vma; unsigned long vma_pages struct mm_struct *mm struct file * file int argc, envc const char * filename const char * interp unsigned long loader, exec struct cred *cred ... 37
38.
load_elf_binary() 38
39.
load_elf_binary() 39
40.
● Load_elf_binary Trace ○
http://wen00072.github.io/blog/2019/08/03/load-elf-binary-trace/ Load_elf_binary Trace 40
41.
● Sections ○ text ○
bss ○ data ○ … ● ABI ● Link script ● ELF ● Binutils ● vDSO ● ASLR ● man proc 延伸關鍵字 41
42.
Q & A /41
Download now