coresight: etm4x: fix underflow for usage of (nrseqstate - 1)
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 2e1cdfe184b5202d51e0611d7a051e2bea303946 · < 5ac900f73ce1d4d8308f40752b51bc8a02b244d2| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
coresight: etm4x: fix underflow for usage of (nrseqstate - 1)
According to IHI006H Embedded Trace Macrocell Architecture Specification[0], TRCSEQEVR<n> is implemented only when TRCIDR5.NUMSEQSTATE is 0b100, in which case n ranges from 0 to 2; otherwise, TRCIDR5.NUMSEQSTATE is 0b000.
IOW, the number of usage in the initialisation or setting TRCSEQEVR<n> with drvdata->nrseqstate - 1 in the loop could make underflow issue when TRCIDR5.NUMSEQSTATE is 0b000.
Therefore, introduce nr_seq_ctrls field and untie it from nrseqstate. As part of this introduce ETM_MAX_SEQ_TRANSITIONS macro and apply nr_seq_ctrls and above macro to TRCSEQEVR<n> relevant fields setup.
From the CVE record · Linux
The Linux kernel’s CoreSight etm4x code can underflow when it uses nrseqstate minus one to initialize or set TRCSEQEVR registers and TRCIDR5.NUMSEQSTATE is zero. The input does not describe an attacker outcome or whether exploitation requires network access, authentication, or user interaction.
Engineers running Linux kernels with CoreSight etm4x should check whether their kernel includes this fix; affected versions are not specified.