Incorrect pkglength can cause panic
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- rust
調査の方向性
Start at src/aml/mod.rs:784:25 and reproduce the panic with faulty.aml.txt or dump FC552E246162. Trace package parsing for the over-long pkglength, then verify that parsing uses the package element count and continues to the following BBBB definition without panicking.
索引モデルが issue の本文から書いたものです。
説明
I discovered this by attempting to load all of the uACPI dump files.
A handful fail with this error (e.g. dump FC552E246162):
thread 'main' (49596) panicked at [xxx]\src\aml\mod.rs:784:25:
assertion `left == right` failed
left: Ok(8)
right: Err(RunOutOfStream)
It turns out that these files encode packages where the pkglength field has a value greater than the actual length of the package. So, for example (in encoded AML)
08 // Def Name
41 41 41 41 // AAAA
12 // Def Package
0a // <------ Package Length - this line is wrong, should be 06
02 // 2 elements
0a a1 // Element 1
0a a2 // Element 2
08 // Def Name
42 42 42 42 // BBBB
12 // Def Package
06 // 6 bytes
02 // 2 elements
0a b1 // element 1
0a b2 // element 2
(File attached as well - faulty.aml.txt)
This loosely corresponds to the following ASL, but with the pkglength of AAAA edited:
DefinitionBlock("", "DSDT", 1, "RSACPI", "PKGLEN", 1) {
Name(AAAA, Package(2) { 0xa1, 0xa2 })
Name(BBBB, Package(2) { 0xb1, 0xb2 })
}
I'm aware there are various places where incorrect AML can cause panics, and that we already know that. I flag this specific example because it's the only one we currently hit by loading all of the uACPI dumps - so it's 🤞 the only significant one we might hit in the wild.
What do the other interpreters do?
- uACPI fails to load the rest of the table, but otherwise carries on OK
- ACPICA loads the entire table successfully - I assume it relies on the package element count, rather than the pkglength field.
I assume that Windows does as ACPICA does, otherwise the original firmware developers would have spotted the problem, but I haven't checked.
I propose to adjust our code to allow over-long pkglength fields by relying on the package count.
O/T, but this may be a good place to add some kind of AcpiWarning system.
- 主要言語
- Rust
- スター
- 248
- フォーク
- 95
- 平均マージ
- 3日 14時間
- マージ済み PR(30日)
- 9
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rust-osdev/acpi のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
rust-osdev/acpi#366 · コメント 3 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
rust-osdev/acpi#354 ·
メンテナーはふだん 2 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
rust-osdev/acpi#353 ·
メンテナーはふだん 2 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
rust-osdev/acpi#336 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
rust-osdev/acpi#328 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
rust-osdev/acpi の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
foxglove/mcap#1907 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
good first issue help wanted r-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
servo/rust-smallvec#792 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信