OpenXiangShan / OpenXiangShan/ChiselAIA
【Bug】APLIC: setipnum/clripnum/setienum/clrienum do not strictly constrain writes to source numbers
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 13
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
Violated specification
code
ChiselAIA/src/main/scala/APLIC.scala
Description
According to my understanding, The current implementation truncates the 32-bit write data to the lowest aplicIntSrcWidth bits to form the source index.
As a result, writes with values outside the legal source number range (which should be ignored) are instead alias-mapped to a different valid source number due to truncation, causing erroneous interrupt behavior.
Specifically, after source 1 has been configured as active, writing an out-of-range value 129 (0x81) to the setipnum register should be ignored according to the specification.
However, in the current XiangShan implementation, this write results in execution of ips.wBitUI(1, true.B), setting interrupt-pending for source 1.
So I think the code should probably add an in-range check to these two register writes, and only allow entering wBitUI() when the written 32-bit value falls within [1, intSrcNum-1]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read ChiselAIA/src/main/scala/APLIC.scala and the cited specification first. Trace the setipnum, clripnum, setienum, and clrienum register writes, then reproduce the source-1 case with an out-of-range value such as 129. Done means out-of-range writes are ignored rather than aliasing to another source number.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100