rust-osdev / rust-osdev/acpi

Passing Local to Method allows it to be overwritten

Open
#313 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
245
Forks
93
Avg merge
2d 8h
Merged PRs (30d)
15

Description

The following script demonstrates this:

DefinitionBlock ("", "DSDT", 1, "RSACPI", "TESTTABL", 0xF0F0F0F0)
{
    Name(FCNT, 0)

    Method (CHEK, 2) {
        If (Arg0 != Arg1) {
            FCNT++
        }
    }

    Method (INR5, 1) {
        Arg0 = 5
    }

    Method (T5) {
        Local1 = 1
        INR5(Local1)
        CHEK (Local1, 1)
    }

    Method (MAIN, 0, NotSerialized) {
        T5()

        Return (FCNT)
    }
}

Local1 of T5 should remain as 1, instead it is overwritten in INR5.

I think this can be fixed by special-casing do_store to avoid writing back to the inner ref if target is an Arg that's anything over than a "true" reference, but I feel like I've missed something obvious?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the AML script in the report and trace the argument/local handling through do_store. Determine why passing Local1 to INR5 permits the callee's Arg0 assignment to overwrite the caller's local. Done means the script returns FCNT as 0, showing Local1 remains 1 after INR5(Local1).

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.