Submit Search
Upload
Hello world 的一生
•
11 likes
•
6,383 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
Eclipse Iceoryx Overview
Eclipse Iceoryx Overview
Tomoya Fujita
「世界最大LoRaWANコミュニティ The Things Networkと国内外ユースケース 〜地産地消IoTの実践」
「世界最大LoRaWANコミュニティ The Things Networkと国内外ユースケース 〜地産地消IoTの実践」
CRI Japan, Inc.
C11,12 SQL Server 2012 Performance Tuning by Yukio Kumazawa
C11,12 SQL Server 2012 Performance Tuning by Yukio Kumazawa
Insight Technology, Inc.
DockerからKubernetesへのシフト
DockerからKubernetesへのシフト
masaki nakayama
大規模ソーシャルゲーム開発から学んだPHP&MySQL実践テクニック
大規模ソーシャルゲーム開発から学んだPHP&MySQL実践テクニック
infinite_loop
(독서광) 1일 1로그 100일 완성 IT 지식
(독서광) 1일 1로그 100일 완성 IT 지식
Jay Park
ClickHouse導入事例紹介
ClickHouse導入事例紹介
Geniee, Inc. / 株式会社ジーニー
TLS 1.3 と 0-RTT のこわ〜い話
TLS 1.3 と 0-RTT のこわ〜い話
Kazuho Oku
Recommended
Eclipse Iceoryx Overview
Eclipse Iceoryx Overview
Tomoya Fujita
「世界最大LoRaWANコミュニティ The Things Networkと国内外ユースケース 〜地産地消IoTの実践」
「世界最大LoRaWANコミュニティ The Things Networkと国内外ユースケース 〜地産地消IoTの実践」
CRI Japan, Inc.
C11,12 SQL Server 2012 Performance Tuning by Yukio Kumazawa
C11,12 SQL Server 2012 Performance Tuning by Yukio Kumazawa
Insight Technology, Inc.
DockerからKubernetesへのシフト
DockerからKubernetesへのシフト
masaki nakayama
大規模ソーシャルゲーム開発から学んだPHP&MySQL実践テクニック
大規模ソーシャルゲーム開発から学んだPHP&MySQL実践テクニック
infinite_loop
(독서광) 1일 1로그 100일 완성 IT 지식
(독서광) 1일 1로그 100일 완성 IT 지식
Jay Park
ClickHouse導入事例紹介
ClickHouse導入事例紹介
Geniee, Inc. / 株式会社ジーニー
TLS 1.3 と 0-RTT のこわ〜い話
TLS 1.3 と 0-RTT のこわ〜い話
Kazuho Oku
Application Re-Architecture Technology ~ StrutsからSpring MVCへ ~
Application Re-Architecture Technology ~ StrutsからSpring MVCへ ~
Yuichi Hasegawa
DockerCon EU 2015: Day 1 General Session
DockerCon EU 2015: Day 1 General Session
Docker, Inc.
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
Kazuho Oku
Spring Framework勉強会
Spring Framework勉強会
Masakazu Matsushita
Software engineering 101 - The basics you should hear about at least once
Software engineering 101 - The basics you should hear about at least once
Alexey (Mr_Mig) Migutsky
ランサムウェアのおはなし
ランサムウェアのおはなし
Shiojiri Ohhara
PostgreSQL 15 開発最新情報
PostgreSQL 15 開発最新情報
Masahiko Sawada
商用DBからPostgreSQLへ まず知っておいて欲しいまとめ
商用DBからPostgreSQLへ まず知っておいて欲しいまとめ
Kosuke Kida
第2章アーキテクチャ
第2章アーキテクチャ
Kenta Hattori
MySQL Binlog Events でストリーム処理してみた #MySQLUC15
MySQL Binlog Events でストリーム処理してみた #MySQLUC15
Yahoo!デベロッパーネットワーク
今、改めて考えるPostgreSQLプラットフォーム - マルチクラウドとポータビリティ -(PostgreSQL Conference Japan 20...
今、改めて考えるPostgreSQLプラットフォーム - マルチクラウドとポータビリティ -(PostgreSQL Conference Japan 20...
NTT DATA Technology & Innovation
Spring CloudとZipkinを利用した分散トレーシング
Spring CloudとZipkinを利用した分散トレーシング
Rakuten Group, Inc.
GANMA!でDDDをやってみてから1年くらい経った
GANMA!でDDDをやってみてから1年くらい経った
Yasuyuki Sugitani
PostgreSQL のイケてるテクニック7選
PostgreSQL のイケてるテクニック7選
Tomoya Kawanishi
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)
MicroAd, Inc.(Engineer)
NW遅延環境(Paas)でのPostgreSQLの利用について
NW遅延環境(Paas)でのPostgreSQLの利用について
kawarasho
Massive service basic
Massive service basic
DaeMyung Kang
파이썬 데이터베이스 연결 2탄
파이썬 데이터베이스 연결 2탄
SeongHyun Ahn
名は体を表していますか
名は体を表していますか
infinite_loop
#dnstudy 01 ドメイン名の歴史
#dnstudy 01 ドメイン名の歴史
Takashi Takizawa
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
More Related Content
What's hot
Application Re-Architecture Technology ~ StrutsからSpring MVCへ ~
Application Re-Architecture Technology ~ StrutsからSpring MVCへ ~
Yuichi Hasegawa
DockerCon EU 2015: Day 1 General Session
DockerCon EU 2015: Day 1 General Session
Docker, Inc.
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
Kazuho Oku
Spring Framework勉強会
Spring Framework勉強会
Masakazu Matsushita
Software engineering 101 - The basics you should hear about at least once
Software engineering 101 - The basics you should hear about at least once
Alexey (Mr_Mig) Migutsky
ランサムウェアのおはなし
ランサムウェアのおはなし
Shiojiri Ohhara
PostgreSQL 15 開発最新情報
PostgreSQL 15 開発最新情報
Masahiko Sawada
商用DBからPostgreSQLへ まず知っておいて欲しいまとめ
商用DBからPostgreSQLへ まず知っておいて欲しいまとめ
Kosuke Kida
第2章アーキテクチャ
第2章アーキテクチャ
Kenta Hattori
MySQL Binlog Events でストリーム処理してみた #MySQLUC15
MySQL Binlog Events でストリーム処理してみた #MySQLUC15
Yahoo!デベロッパーネットワーク
今、改めて考えるPostgreSQLプラットフォーム - マルチクラウドとポータビリティ -(PostgreSQL Conference Japan 20...
今、改めて考えるPostgreSQLプラットフォーム - マルチクラウドとポータビリティ -(PostgreSQL Conference Japan 20...
NTT DATA Technology & Innovation
Spring CloudとZipkinを利用した分散トレーシング
Spring CloudとZipkinを利用した分散トレーシング
Rakuten Group, Inc.
GANMA!でDDDをやってみてから1年くらい経った
GANMA!でDDDをやってみてから1年くらい経った
Yasuyuki Sugitani
PostgreSQL のイケてるテクニック7選
PostgreSQL のイケてるテクニック7選
Tomoya Kawanishi
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)
MicroAd, Inc.(Engineer)
NW遅延環境(Paas)でのPostgreSQLの利用について
NW遅延環境(Paas)でのPostgreSQLの利用について
kawarasho
Massive service basic
Massive service basic
DaeMyung Kang
파이썬 데이터베이스 연결 2탄
파이썬 데이터베이스 연결 2탄
SeongHyun Ahn
名は体を表していますか
名は体を表していますか
infinite_loop
#dnstudy 01 ドメイン名の歴史
#dnstudy 01 ドメイン名の歴史
Takashi Takizawa
What's hot
(20)
Application Re-Architecture Technology ~ StrutsからSpring MVCへ ~
Application Re-Architecture Technology ~ StrutsからSpring MVCへ ~
DockerCon EU 2015: Day 1 General Session
DockerCon EU 2015: Day 1 General Session
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
Spring Framework勉強会
Spring Framework勉強会
Software engineering 101 - The basics you should hear about at least once
Software engineering 101 - The basics you should hear about at least once
ランサムウェアのおはなし
ランサムウェアのおはなし
PostgreSQL 15 開発最新情報
PostgreSQL 15 開発最新情報
商用DBからPostgreSQLへ まず知っておいて欲しいまとめ
商用DBからPostgreSQLへ まず知っておいて欲しいまとめ
第2章アーキテクチャ
第2章アーキテクチャ
MySQL Binlog Events でストリーム処理してみた #MySQLUC15
MySQL Binlog Events でストリーム処理してみた #MySQLUC15
今、改めて考えるPostgreSQLプラットフォーム - マルチクラウドとポータビリティ -(PostgreSQL Conference Japan 20...
今、改めて考えるPostgreSQLプラットフォーム - マルチクラウドとポータビリティ -(PostgreSQL Conference Japan 20...
Spring CloudとZipkinを利用した分散トレーシング
Spring CloudとZipkinを利用した分散トレーシング
GANMA!でDDDをやってみてから1年くらい経った
GANMA!でDDDをやってみてから1年くらい経った
PostgreSQL のイケてるテクニック7選
PostgreSQL のイケてるテクニック7選
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)
NW遅延環境(Paas)でのPostgreSQLの利用について
NW遅延環境(Paas)でのPostgreSQLの利用について
Massive service basic
Massive service basic
파이썬 데이터베이스 연결 2탄
파이썬 데이터베이스 연결 2탄
名は体を表していますか
名は体を表していますか
#dnstudy 01 ドメイン名の歴史
#dnstudy 01 ドメイン名の歴史
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