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
340
仮想アドレスと物理アドレスの対応を実機確認してみよう
以下動画のテキストです
https://youtu.be/o1gRyW8U3dA
Satoru Takeuchi
PRO
June 15, 2024
Tweet
Share
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
Rook: Intro and Deep Dive With Ceph
sat
PRO
1
110
会社員しながら本を書いてきた知見の共有
sat
PRO
3
790
デバイスにアクセスするデバイスファイル
sat
PRO
1
38
ファイルシステムのデータを ブロックデバイスへの操作で変更
sat
PRO
1
32
デバイスドライバ
sat
PRO
0
49
マルチスレッドの実現方法 ~カーネルスレッドとユーザスレッド~
sat
PRO
2
120
共有メモリ
sat
PRO
3
71
マルチスレッドプログラム
sat
PRO
3
59
Linuxのブートプロセス initramfs編
sat
PRO
2
89
Other Decks in Technology
See All in Technology
American airlines ®️ USA Contact Numbers: Complete 2025 Support Guide
airhelpsupport
0
390
CDKコード品質UP!ナイスな自作コンストラクタを作るための便利インターフェース
harukasakihara
2
200
VGGT: Visual Geometry Grounded Transformer
peisuke
1
620
shake-upを科学する
rsakata
7
930
オフィスビルを監視しよう:フィジカル×デジタルにまたがるSLI/SLO設計と運用の難しさ / Monitoring Office Buildings: The Challenge of Physical-Digital SLI/SLO Design & Operation
bitkey
1
350
CDK Toolkit Libraryにおけるテストの考え方
smt7174
1
450
伴走から自律へ: 形式知へと導くSREイネーブリングによる プロダクトチームの信頼性オーナーシップ向上 / SRE NEXT 2025
visional_engineering_and_design
3
230
Delta airlines®️ USA Contact Numbers: Complete 2025 Support Guide
airtravelguide
0
350
LLM時代の検索
shibuiwilliam
2
640
関数型プログラミングで 「脳がバグる」を乗り越える
manabeai
2
220
話題の MCP と巡る OCI RAG ソリューションの旅 - Select AI with RAG と Generative AI Agents ディープダイブ
oracle4engineer
PRO
5
110
ClaudeCodeにキレない技術
gtnao
0
580
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Navigating Team Friction
lara
187
15k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Designing Experiences People Love
moore
142
24k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
740
Scaling GitHub
holman
460
140k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.9k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
A better future with KSS
kneath
238
17k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
980
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