* [PATCH] swiotlb: Do not zero buffer in set_memory_decrypted()
@ 2022-01-25 13:20 Kirill A. Shutemov
2022-01-25 16:49 ` Tom Lendacky via iommu
2022-01-26 16:06 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Kirill A. Shutemov @ 2022-01-25 13:20 UTC (permalink / raw)
To: iommu, hch; +Cc: thomas.lendacky, Kirill A. Shutemov
For larger TDX VM, memset() after set_memory_decrypted() in
swiotlb_update_mem_attributes() takes substantial portion of boot time.
Zeroing doesn't serve any functional purpose. Malicious VMM can mess
with decrypted/shared buffer at any point.
Remove the memset().
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
kernel/dma/swiotlb.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index f1e7ea160b43..9390b38d2897 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -207,8 +207,6 @@ void __init swiotlb_update_mem_attributes(void)
mem->vaddr = swiotlb_mem_remap(mem, bytes);
if (!mem->vaddr)
mem->vaddr = vaddr;
-
- memset(mem->vaddr, 0, bytes);
}
static void swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start,
--
2.34.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] swiotlb: Do not zero buffer in set_memory_decrypted()
2022-01-25 13:20 [PATCH] swiotlb: Do not zero buffer in set_memory_decrypted() Kirill A. Shutemov
@ 2022-01-25 16:49 ` Tom Lendacky via iommu
2022-01-26 16:06 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lendacky via iommu @ 2022-01-25 16:49 UTC (permalink / raw)
To: Kirill A. Shutemov, iommu, hch
On 1/25/22 07:20, Kirill A. Shutemov wrote:
> For larger TDX VM, memset() after set_memory_decrypted() in
> swiotlb_update_mem_attributes() takes substantial portion of boot time.
>
> Zeroing doesn't serve any functional purpose. Malicious VMM can mess
> with decrypted/shared buffer at any point.
>
> Remove the memset().
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> kernel/dma/swiotlb.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index f1e7ea160b43..9390b38d2897 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -207,8 +207,6 @@ void __init swiotlb_update_mem_attributes(void)
> mem->vaddr = swiotlb_mem_remap(mem, bytes);
> if (!mem->vaddr)
> mem->vaddr = vaddr;
> -
> - memset(mem->vaddr, 0, bytes);
> }
>
> static void swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start,
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] swiotlb: Do not zero buffer in set_memory_decrypted()
2022-01-25 13:20 [PATCH] swiotlb: Do not zero buffer in set_memory_decrypted() Kirill A. Shutemov
2022-01-25 16:49 ` Tom Lendacky via iommu
@ 2022-01-26 16:06 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2022-01-26 16:06 UTC (permalink / raw)
To: Kirill A. Shutemov; +Cc: hch, thomas.lendacky, iommu
Thanks,
applied to the dma-mapping for-next tree.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-26 16:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 13:20 [PATCH] swiotlb: Do not zero buffer in set_memory_decrypted() Kirill A. Shutemov
2022-01-25 16:49 ` Tom Lendacky via iommu
2022-01-26 16:06 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.