casaroli opened a new pull request, #20549: URL: https://github.com/apache/nuttx/pull/20549
## Summary `create_region()` maps a region one final-level page table at a time, and mapped up to `ENTRIES_PER_PGT` pages through each table from the address where the region started. The text region starts one page after the reserved area, so it does not start at a table boundary. When such a region crossed the end of a table, the next pages were mapped through the same table, from its first entry: they replaced the mappings of the reserved area and the first pages of the region. In a program with more than about 2 MB of text, the reserved area became read-only text, and the kernel faulted in `umm_initialize()` when it wrote the heap pointer there. This PR walks the region one final-level table at a time, from any start address. ## Impact arm64 with `CONFIG_ARCH_ADDRENV` (kernel builds). Regions that fit in one table are mapped as before. ## Testing `qemu-armv8a:knsh` with `CONFIG_DRIVERS_VIRTIO`, `CONFIG_DRIVERS_VIRTIO_MMIO`, `CONFIG_FS_V9FS` and `CONFIG_V9FS_VIRTIO_9P`, QEMU 11 (`-m 512M`, a `virtio-9p-device` share). The test programs were built outside the tree against the export package. A program with 3 MB of read-only data, so that its text region is larger than 2 MB. Before: ``` nsh> bigtext default_fatal_handler: (IFSC/DFSC) for Data/Instruction aborts: level 3 permission fault arm64_exception_handler: ESR_ELn: 0x9600004f arm64_exception_handler: FAR_ELn: 0xc0000008 ``` After: ``` nsh> bigtext bigtext: 3145728 bytes of read-only data, big[2] = 3 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
