Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Incorrect pkglength can cause panic

Đang mở
#362 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@mikamikasuki đang làm issue này rồi.

Từ ngày 2/10/2026.

  • #365 của @mikamikasuki — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
operating-systems

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
248
Fork
95
Merge trung bình
3 ngày 14 giờ
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rust-osdev/acpi

Tất cả issue của rust-osdev/acpi

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.