[edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-18 Thread Rebecca Cran via groups.io
I've been debugging an assert failure when using HeapGuard on AArch64. A call to FreePages in SmbiosDxe is failing because the memory is aligned to 0x1000 instead of 0x1 as defined by RUNTIME_PAGE_ALLOCATION_GRANULARITY. I'm enabling HeapGuard by setting the PCDs to the following values:

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-18 Thread Oliver Smith-Denny
On 1/18/2024 7:27 AM, Rebecca Cran via groups.io wrote: I've been debugging an assert failure when using HeapGuard on AArch64. A call to FreePages in SmbiosDxe is failing because the memory is aligned to 0x1000 instead of 0x1 as defined by RUNTIME_PAGE_ALLOCATION_GRANULARITY. I'm enabling

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-18 Thread Rebecca Cran via groups.io
On 1/18/2024 9:48 AM, Oliver Smith-Denny via groups.io wrote: Are you including this commit: https://github.com/tianocore/edk2/commit/00b51e0d78a547dd78119ec44fcc74a01b6f79c8? Can you share some more details on where this is failing? I.e. what assert is getting tripped? Presumably without Heap

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-18 Thread Oliver Smith-Denny
On 1/18/2024 9:42 AM, Rebecca Cran via groups.io wrote: On 1/18/2024 9:48 AM, Oliver Smith-Denny via groups.io wrote: Are you including this commit: https://github.com/tianocore/edk2/commit/00b51e0d78a547dd78119ec44fcc74a01b6f79c8? Can you share some more details on where this is failing? I.e

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-18 Thread Rebecca Cran via groups.io
On 1/18/2024 11:38 AM, Oliver Smith-Denny wrote: Yeah, if you can get it running there, that would be a good data point. I assume you mean the Project Mu QemuSbsaPkg? If so that is great, but you will need to update the RUNTIME_PAGE_ALLOCATION_GRANULARITY back to 0x1. It was set to 0x1000 fo

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-18 Thread Oliver Smith-Denny
On 1/18/2024 10:45 AM, Rebecca Cran via groups.io wrote: No, I mean SbsaQemu from edk2-platforms: https://github.com/tianocore/edk2-platforms/tree/master/Platform/Qemu/SbsaQemu Sure, if you can repro there that is helpful. Oliver -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all mes

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-18 Thread Rebecca Cran via groups.io
On 1/18/2024 12:04 PM, Oliver Smith-Denny wrote: On 1/18/2024 10:45 AM, Rebecca Cran via groups.io wrote: No, I mean SbsaQemu from edk2-platforms: https://github.com/tianocore/edk2-platforms/tree/master/Platform/Qemu/SbsaQemu Sure, if you can repro there that is helpful. I've realized it w

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-18 Thread Oliver Smith-Denny
On 1/18/2024 10:38 AM, Oliver Smith-Denny wrote: I am suspicious that we are checking for the alignment before we adjust the memory for the guard. I'm wondering if we actually should do AdjustMemoryF (recalling function from memory) before we check the alignment. Following up on this, this is

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-19 Thread Rebecca Cran via groups.io
On 1/18/2024 12:26 PM, Oliver Smith-Denny wrote: Does this solve your issue? I have to run to a meeting, but I can write this in actual patch form (and give it a quick test) later. Unfortunately that didn't work: I still get the assert. ... SmbiosCreate64BitTable() re-allocate SMBIOS 64-bit t

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-19 Thread Oliver Smith-Denny
On 1/19/2024 8:34 AM, Rebecca Cran wrote: On 1/18/2024 12:26 PM, Oliver Smith-Denny wrote: Does this solve your issue? I have to run to a meeting, but I can write this in actual patch form (and give it a quick test) later. Unfortunately that didn't work: I still get the assert. ... SmbiosCre

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-22 Thread Rebecca Cran via groups.io
On 1/19/2024 1:03 PM, Oliver Smith-Denny wrote: Thanks for trying. In lieu of being able to test myself, all I can offer is adding some more prints, when the memory gets allocated, making sure it is 64k aligned then. I'd be curious to see what the address is that is attempting to be freed. My g

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-22 Thread Oliver Smith-Denny
On 1/22/2024 2:06 PM, Rebecca Cran via groups.io wrote: On 1/19/2024 1:03 PM, Oliver Smith-Denny wrote: Thanks for trying. In lieu of being able to test myself, all I can offer is adding some more prints, when the memory gets allocated, making sure it is 64k aligned then. I'd be curious to see

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-22 Thread Rebecca Cran via groups.io
On 1/22/2024 6:53 PM, Oliver Smith-Denny wrote: I was able to repro your bug (by just turning on page guards on ArmVirtQemu, allocating runtime mem and freeing it). I think you are the first person to free runtime mem on ARM64 with page guards enabled (and to care when it failed :). The heap gu

Re: [edk2-devel] AArch64 with HeapGuard: page allocations wrongly aligned

2024-01-24 Thread Oliver Smith-Denny
On 1/22/2024 6:14 PM, Rebecca Cran wrote: Thanks! I wonder if the same problem occurs on LoongArch64, which also defines the runtime page allocation granularity to be 0x1? Yes, it should have exactly the same problem -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent