| Summary: | PHYS_IN_DMAP and VIRT_IN_DMAP macros assume contiguous DMAP memory | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Zeev Zilberman <zeev> | ||||||
| Component: | arm | Assignee: | Andrew Turner <Andrew> | ||||||
| Status: | Closed FIXED | ||||||||
| Severity: | Affects Some People | CC: | Andrew, cperciva, markj | ||||||
| Priority: | --- | ||||||||
| Version: | Unspecified | ||||||||
| Hardware: | arm64 | ||||||||
| OS: | Any | ||||||||
| URL: | https://reviews.freebsd.org/D44677 | ||||||||
| Attachments: |
|
||||||||
|
Description
Zeev Zilberman
2024-04-07 13:00:47 UTC
Created attachment 249803 [details]
bug fix: support non-contiguous memory in PHYS_IN_DMAP and VIRT_IN_DMAP
I have a possible fix in review D44677 Thank Andrew! Zeev, can you test Andrew's patch? I can build an AMI with it if it would help, but I don't have access to r8g.metal-48xl so I can't test it myself. The system boots properly with Andrew's patch, thanks! Should VIRT_IN_DMAP macro be fixed too? The patch addresses only PHYS_IN_DMAP. A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=9d40492efa467095340cf3dca5860880aa441472 commit 9d40492efa467095340cf3dca5860880aa441472 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2024-04-08 10:44:33 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2024-04-24 18:17:19 +0000 arm64: Check DMAP address is valid in PHYS_IN_DMAP When checking if a physical address is in the DMAP region we assume all physical addresses between DMAP_MIN_PHYSADDR and DMAP_MAX_PHYSADDR are able to be accesses through the DMAP. It may be the case that there is device memory in this range that shouldn't be accessed through the DMAP mappings. Add a check to PHYS_IN_DMAP that the translated virtual address is a valid kernel address. To support code that already checks the address is valid add PHYS_IN_DMAP_RANGE. PR: 278233 Reviewed by: alc, markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D44677 sys/arm64/arm64/efirt_machdep.c | 9 ++------- sys/arm64/arm64/machdep.c | 2 +- sys/arm64/arm64/minidump_machdep.c | 7 ++++--- sys/arm64/include/vmparam.h | 18 +++++++++++++++--- 4 files changed, 22 insertions(+), 14 deletions(-) A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c3a3b231da00e93fcd7baced74fa933b112de473 commit c3a3b231da00e93fcd7baced74fa933b112de473 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2024-04-08 10:44:33 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2024-05-02 07:59:31 +0000 arm64: Check DMAP address is valid in PHYS_IN_DMAP When checking if a physical address is in the DMAP region we assume all physical addresses between DMAP_MIN_PHYSADDR and DMAP_MAX_PHYSADDR are able to be accesses through the DMAP. It may be the case that there is device memory in this range that shouldn't be accessed through the DMAP mappings. Add a check to PHYS_IN_DMAP that the translated virtual address is a valid kernel address. To support code that already checks the address is valid add PHYS_IN_DMAP_RANGE. PR: 278233 Reviewed by: alc, markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D44677 (cherry picked from commit 9d40492efa467095340cf3dca5860880aa441472) sys/arm64/arm64/efirt_machdep.c | 9 ++------- sys/arm64/arm64/machdep.c | 2 +- sys/arm64/arm64/minidump_machdep.c | 7 ++++--- sys/arm64/include/vmparam.h | 18 +++++++++++++++--- 4 files changed, 22 insertions(+), 14 deletions(-) (In reply to Zeev Zilberman from comment #4) Can you confirm that 14.1-BETA1 boots on these instances? (If it doesn't, we need to fix whatever other problems exist ASAP before the release.) Confirming that FreeBSD 14.1-BETA2 boots properly on r8g.metal-48xl system. Thanks! |