aarch64: SIGILL on BTI-enabled CPUs: #12536 fixed lib/flb_libco but the binary links lib/monkey/deps/flb_libco
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 63/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- c
調査の方向性
修正対象は、ベンダリングされたコピー lib/monkey/deps/flb_libco/aarch64.c です。co_switch_aarch64 のasmブロックの末尾がまだ br x17 で終わっています。#12536 で ret x17 に変更済みの lib/flb_libco/aarch64.c と比較し、CMakeビルドが monkey 側のコピーのみをコンパイルしていることを確認してください。monkey 側のファイルが修正版と一致し、-mbranch-protection=standard を指定した aarch64 ビルドが BTI ランタイムテストに合格すれば完了です。SIGILL を再現するには BTI 対応の CPU が必要です。
索引モデルが issue の本文から書いたものです。
説明
Bug Report
Describe the bug
On an aarch64 CPU that implements BTI, a fluent-bit binary built with -mbranch-protection=standard gets SIGILL in the output worker thread (flb-out-forward) at the first flush.
#12536 fixed this in lib/flb_libco/aarch64.c by changing the end of co_switch_aarch64 from br x17 to ret x17. But fluent-bit does not link that copy: the build compiles the libco bundled with monkey, lib/monkey/deps/flb_libco/libco.c. Monkey's aarch64.c still ends with br x17 in v5.1.5, v5.2.0 and master, so the binary still crashes.
To Reproduce
Build fluent-bit for aarch64 with -mbranch-protection=standard in CFLAGS. This is the Yocto/OpenEmbedded default for aarch64, and the binary gets the AArch64 feature: BTI, PAC GNU property.
Run on a CPU with BTI (bti in /proc/cpuinfo, e.g. Neoverse V2/V3, Cortex-A720; we hit it on NVIDIA Jetson Thor):
fluent-bit -i dummy -o forward -p host=127.0.0.1 -p port=24299 -f 1
The process dies with SIGILL within a second:
Thread 4 "flb-out-forward" received signal SIGILL, Illegal instruction.
bl co_switch
=> ldr x21, [x21, #40]
$_siginfo.si_code is 1. The faulting PC is the instruction after bl co_switch, reached by the br x17 at the end of co_switch_aarch64, which is not a BTI landing pad.
Expected behavior
No SIGILL; coroutine switches work as on CPUs without BTI.
Your Environment
Version used: v5.0.2. The same br x17 is in monkey's copy in v5.1.5, v5.2.0 and master.
Environment name and version: Yocto / OpenEmbedded (meta-oe fluentbit_5.0.2.bb), GCC with -mbranch-protection=standard
Server type and version: NVIDIA Jetson Thor (Neoverse V3AE, Armv9), Linux 6.8
Operating System and version: Yocto-based embedded Linux
Filters and plugins: reproduced with dummy → forward; any output that flushes in a coroutine should hit it
Additional context
Only one libco object is built: lib/monkey/deps/flb_libco/CMakeFiles/co.dir/libco.c.o.
After the #12536 change, lib/flb_libco/aarch64.c and lib/monkey/deps/flb_libco/aarch64.c are otherwise identical.
The fix: apply the same one-line change to monkey's copy (and to monkey upstream):
--- a/lib/monkey/deps/flb_libco/aarch64.c
+++ b/lib/monkey/deps/flb_libco/aarch64.c
@@ -58,7 +58,7 @@ asm (
" ldp x28, x29, [x0, #144]\n"
" ldp x16, x17, [x0, #160]\n"
" mov sp, x16\n"
-
" br x17\n"
-
);" ret x17\n" ".previous\n"
With this applied to v5.0.2, the crash is gone on Jetson Thor and records are forwarded normally.
Longer term, there should be a single copy of libco, or the BTI runtime test added in #12536 should also build monkey's copy, so the two cannot diverge again.
- 主要言語
- C
- スター
- 8.2k
- フォーク
- 2k
- 平均マージ
- 3日 13時間
- マージ済み PR(30日)
- 93
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fluent/fluent-bit のほかの issue
-
in_tail: files falsely detected as rotated on macOS with threaded inputs, causing duplicate records対応中かも @kevin9327 が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
fluent/fluent-bit#12780 ·
メンテナーはふだん 1 日以内に返信
-
status: waiting-for-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
fluent/fluent-bit#12683 · コメント 2 件 · リアクション 6 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
fluent/fluent-bit#12657 ·
メンテナーはふだん 1 日以内に返信
-
http: Transfer-Encoding chunked plus Content-Length hangs forever (CL branch shadows the chunked path)対応中かも @sarankumar1325 が 15 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
fluent/fluent-bit#12656 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
fluent/fluent-bit#12649 ·
メンテナーはふだん 1 日以内に返信
fluent/fluent-bit の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dfa1/rocksdb-ffm#292 ·
メンテナーはふだん 1 日以内に返信
-
SPIDevice selects an active-high device as soon as it is created対応中かも @mikeysklar が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
adafruit/circuitpython#11869 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
gnif/LookingGlass#1352 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信