Skip to content

LATX, fix: parse PE32+ Wine section headers - #557

Open
ganjue66da wants to merge 2 commits into
lat-opensource:masterfrom
ganjue66da:codex/pe32-parser-prready-20261111
Open

ganjue66da wants to merge 2 commits into
lat-opensource:masterfrom
ganjue66da:codex/pe32-parser-prready-20261111

Conversation

@ganjue66da

Copy link
Copy Markdown
Contributor

Summary

  • Parse both PE32 and PE32+ Wine section headers using the declared optional
    header length instead of a fixed header location.
  • Validate DOS, PE and section-table ranges against both the file and mapped
    region before reading them through the file descriptor.
  • Validate Wine module paths before section tracking, including short names,
    failed reads and truncated readlink() results.
  • Validate all code-section addresses before inserting records, so a later
    invalid section does not leave partial state.

Validation

  • Built x86_64-linux-user and i386-linux-user with LATX, AOT and KZT.
  • lat-pr-fast: 52/52 passed.
  • test_lat_ci_version.py: 5/5 passed.
  • Focused latx-aot-segment-unmap and latx-aot-pe-load-address tests passed.
  • git diff --check passed; checkpatch reported no errors.
  • Added coverage for PE32, PE32+, non-standard optional-header sizes, malformed
    signatures and headers, mapping/file truncation, path truncation and atomic
    registration failure.

The host GCC installation lacks native UBSan runtime libraries, so the full
clean test run used the ABI-compatible Clang 8 standalone UBSan runtime through
LIBRARY_PATH and LD_LIBRARY_PATH.

Evidence Boundary

The tests prove Wine PE code-section discovery and registration behavior. They
do not establish real Wine AOT cache loading or an end-to-end startup-time
improvement.

Reject short file names, path construction failures, readlink errors and
possible truncation before using a Wine module path for AOT section
lookup.
Cover the short-name and truncation paths in the segment tracking test.

Tests:
- build/test-latx-aot-segment-unmap

Signed-off-by: Wenqiang Wei <weiwenqiang@mail.ustc.edu.cn>
Read and validate DOS, PE and section-table data through the file
descriptor, use the declared optional-header length to locate PE32+
sections, and register validated code sections atomically.

Cover PE32, PE32+, non-standard optional-header sizes, malformed
headers, and partial mapping or file lengths.

Tests:
- build/test-latx-aot-segment-unmap
- build/test-latx-aot-pe-load-address

Signed-off-by: Wenqiang Wei <weiwenqiang@mail.ustc.edu.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant