Re: [PATCH] dma-buf: heaps: system: zero pages after set_memory_decrypted()
From: Jiri Pirko
Date: Wed Nov 18 2026 - 08:15:35 EST
Tue, Nov 17, 2026 at 04:54:31PM +0100, eagleshaw@xxxxxxxxxx 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>
Reviewed-by: Jiri Pirko <jiri@xxxxxxxxxx>