Skip to Content
入門 eBPF ―Linuxカーネルの可視化と機能拡張
book

入門 eBPF ―Linuxカーネルの可視化と機能拡張

by Liz Rice, 武内 覚, 近藤 宇智朗
December 2023
Intermediate to advanced
228 pages
3h 33m
Japanese
O'Reilly Japan, Inc.
Content preview from 入門 eBPF ―Linuxカーネルの可視化と機能拡張

6章eBPF検証器

eBPFによる検証プロセスについて、これまで何回か言及してきました。eBPFプログラムをカーネルにロードするときは、検証プロセスによってプログラムが安全であることを保証しています。本章では検証器がどのようなことをしているのかについて述べます。

「検証(verification)」とは、プログラムを通して考えうるすべての実行経路をチェックし、どの命令も安全であると保証することを指します。検証器は実行の準備のためにバイトコードの更新もします。検証プロセスが失敗する例もいくつか紹介する予定です。まずは正常に動くコードを紹介して、その後に検証器に不合格とみなされるようにコードを書き換えます。

[注記]

本章のサンプルコードはGitHubリポジトリ(https://github.com/lizrice/learning-ebpf)のchapter6ディレクトリからダウンロードできます。

本章の目的は検証器の概要説明なので、検証器が行うすべてのチェックを網羅的に説明するわけではありません。BPFプログラムを書いたときによく遭遇する検証エラーについて具体例を使って紹介します。

検証器の対象はソースコードではなくeBPFバイトコードだということに注意が必要です。バイトコードの中身はコンパイラが生成します。コンパイラの最適化などのために、ソースコードとバイトコードの内容は機械的に1対1対応しているわけではありません。そのため、ソースコードから期待された検証結果が得られないこともあります。例えば検証器は到達不可能な命令があるプログラムを拒否しますが、ソースコードにこのようなコードがあっても、コンパイラは検証器による確認前にそのようなコードを最適化によって消してしまうため、到達不能な命令による検証の失敗は発生しないでしょう。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

入門 モダンLinux ―オンプレミスからクラウドまで、幅広い知識を会得する

入門 モダンLinux ―オンプレミスからクラウドまで、幅広い知識を会得する

Michael Hausenblas, 武内 覚, 大岩 尚宏
初めてのGraphQL ―Webサービスを作って学ぶ新世代API

初めてのGraphQL ―Webサービスを作って学ぶ新世代API

Eve Porcello, Alex Banks, 尾崎 沙耶, あんどうやすし

Publisher Resources

ISBN: 9784814400560Publisher Website