Re: [PATCH] dma-buf: heaps: system: zero pages after set_memory_decrypted()
From: Jason Gunthorpe
Date: Wed Nov 18 2026 - 08:44:26 EST
On Tue, Nov 17, 2026 at 03:54:31PM +0000, Ying Xiao wrote:
> system_heap_allocate() allocates pages via order_flags[] with __GFP_ZERO
> while the direct map still has the memory encryption bit set. For the
> system_cc_shared heap, set_memory_decrypted() subsequently clears the
> encryption bit without re-zeroing, leaving ciphertext in DRAM on
> confidential computing (CoCo) guests instead of plaintext zeros.
>
> Skip __GFP_ZERO during alloc_pages() for cc_shared allocations, and zero
> the pages once in system_heap_set_page_decrypted() after
> set_memory_decrypted() succeeds.
>
> Fixes: 78b30c50a7ac ("dma-buf: heaps: system: add system_cc_shared heap for explicitly shared memory")
> Reviewed-by: Jacob Moroni <jmoroni@xxxxxxxxxx>
> Signed-off-by: Ying Xiao <eagleshaw@xxxxxxxxxx>
> ---
> drivers/dma-buf/heaps/system_heap.c | 24 ++++++++++++++++++++----
> 1 file changed, 20 insertions(+), 4 deletions(-)
This seems fine, but Aneesh is fixing this in a more complete way with
this other series.
Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
Jason