Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
仮想アドレスと物理アドレスの対応を実機確認してみよう
Search
Satoru Takeuchi
PRO
June 15, 2024
Technology
0
320
仮想アドレスと物理アドレスの対応を実機確認してみよう
以下動画のテキストです
https://youtu.be/o1gRyW8U3dA
Satoru Takeuchi
PRO
June 15, 2024
Tweet
Share
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
会社員しながら本を書いてきた知見の共有
sat
PRO
3
750
デバイスにアクセスするデバイスファイル
sat
PRO
1
31
ファイルシステムのデータを ブロックデバイスへの操作で変更
sat
PRO
1
27
デバイスドライバ
sat
PRO
0
43
マルチスレッドの実現方法 ~カーネルスレッドとユーザスレッド~
sat
PRO
2
94
共有メモリ
sat
PRO
3
65
マルチスレッドプログラム
sat
PRO
3
55
Linuxのブートプロセス initramfs編
sat
PRO
2
73
Linuxのブートプロセス
sat
PRO
6
180
Other Decks in Technology
See All in Technology
Workflows から Agents へ ~ 生成 AI アプリの成長過程とアプローチ~
belongadmin
3
150
QAはソフトウェアエンジニアリングを学んで実践するのが大事なの
ymty
1
390
AWS全冠したので振りかえってみる
tajimon
0
140
IIWレポートからみるID業界で話題のMCP
fujie
0
220
「規約、知識、オペレーション」から考える中規模以上の開発組織のCursorルールの 考え方・育て方 / Cursor Rules for Coding Styles, Domain Knowledges and Operations
yuitosato
6
1.7k
エンジニア採用から始まる技術広報と組織づくり/202506lt
nishiuma
8
1.7k
doda開発 生成AI元年宣言!自家製AIエージェントから始める生産性改革 / doda Development Declaration of the First Year of Generated AI! Productivity Reforms Starting with Home-grown AI Agents
techtekt
0
140
(非公式) AWS Summit Japan と 海浜幕張 の歩き方 2025年版
coosuke
PRO
1
250
技術職じゃない私がVibe Codingで感じた、AGIが身近になる未来
blueb
0
120
"SaaS is Dead" は本当か!? 生成AI時代の医療 Vertical SaaS のリアル
kakehashi
PRO
3
200
New Cache Hierarchy for Container Images and OCI Artifacts in Kubernetes Clusters using Containerd / KubeCon + CloudNativeCon Japan
pfn
PRO
0
150
CI/CDとタスク共有で加速するVibe Coding
tnbe21
0
160
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Gamification - CAS2011
davidbonilla
81
5.3k
Code Review Best Practice
trishagee
68
18k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
650
Done Done
chrislema
184
16k
Designing for Performance
lara
609
69k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.8k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Product Roadmaps are Hard
iamctodd
PRO
53
11k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Transcript
仮想アドレスと 物理アドレスの対応を 実機確認してみよう Jun. 15th, 2024 Satoru Takeuchi X: satoru_takeuchi
1
はじめに • プロセスの仮想アドレスと物理アドレスがどう対応しているかはユーザ空間から確 認できる • 実際に実機確認してみよう • 環境 ◦ CPUアーキテクチャ:
x86_64 ◦ カーネル: 5.15.0-107-generic • 📝 x86_64以外でできるかどうかは確認していないので知らないです 2
確認方法 • /proc/<pid>/pagemapに各プロセスのページテーブル相当の情報がある • ページ(4KiB)単位で8バイトのデータがメモリアドレス0から並んでいる • 主なデータ: ◦ bit 0
~ bit 54: page frame number: 4KiBをかけると物理メモリアドレスになる ◦ bit 63: present bit • 読み出すにはCAP_SYS_PTRACE capabilityが必要 ◦ Ubuntu 22.04.5のデフォルト設定なら rootならOK ◦ 権限が無ければzero fillされる • 📝 詳細は man procfsを参照 3
実機確認 • vp-conversion.py ◦ sudo ./vp-conversion.py <pid> <仮想アドレス> • 仮想端末上で動いているbashの実行ファイルをmapしている領域がどの物理アド
レスにマップされているか確認 ◦ cat /proc/$$/maps を実行してbashのメモリマップを確認 ◦ sudo ./vp-conversion.py $$ <仮想アドレス> を実行してアドレスの対応を見る • 📝 ある瞬間にページがメモリ上にあったとしても次の瞬間には無くなっているかも しれない。それはまた別動画で 4
まとめ • /proc/<pid>/pagemapを読めばプロセスの仮想アドレスと物理アドレスの対応がわ かる • かっこいい 5