From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4BDC606A322 for ; Wed, 2 Dec 2026 09:57:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=owwRlF0n; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=N8i3ffnf DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=huEssHtkFTTBYIhOPLmOb/3+lORTnB9fmBDuszd0SUA=; b=owwRlF0n22+CxY MbA3xIQ3HbA3zKujASfIQc60C6dcpt05UgKSTP6YH+c3W9ExiteRFsTNKQYDTuIF2AkMK3kT78R6j tvmcyG64HTJSBbY3JiQGad8ER/rNwaCHu5jw7sdjBK1Me0zLOqTvctYWSY0S1oCEub1zOqEX8rIz0 zFgjUCgJBy1R5W0XkbmSoglLeJKfls9O2e9EBXydHq+PCeIpfBkc2og866wCZQrB3QRjfC8QoJSJI PPVR5YG/8z2Ml4inpXubF3OEV4TEZa5FaSG943TjAiyWjvrLYBXqiz0oPQ9GvcH7HuXgjFXSJq74z wAPlTWHVeo/ET4QEtF2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYh54-0000000AwMs-2UlD; Wed, 02 Dec 2026 09:56:54 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYh52-0000000AwKl-2shD for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2026 09:56:52 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 6D58D451AC; Wed, 2 Dec 2026 09:56:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A81731F00899; Wed, 2 Dec 2026 09:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796205412; bh=huEssHtkFTTBYIhOPLmOb/3+lORTnB9fmBDuszd0SUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=N8i3ffnfZBcsu+nBuYP/6/pxmlzoPeshePFtZBG/vZZ/Iw74JMFw/bCaZU2tFICQu zk9WL16LwqV01qyteVhcNcpISusY9ByKIiWcWckmqDQrXvqoQPn7JH4ugmYqIRllMF /BBEJUvp+Bcx3NF0dULXU7pA1sGiLGZZzYiuktO9fupQYbZFdIWIKKD8opeMQBtOts 9HrQ5O31LZH1cqGsQXM1UskN6GZr3tKeKWgXJDpLc28PlvCE7gahLU6l18L3nvwbXs 6puZ4izZdmWfsIfRjY1DxvtOVTZo9wQ4gFmE2Tpyrkum678HU+Ml48LgMTOnqqzuwi g/mGx0LxI+K3g== From: "Aneesh Kumar K.V (Arm)" To: linux-coco@lists.linux.dev Cc: "Aneesh Kumar K.V (Arm)" , Andrew Morton , Catalin Marinas , =?UTF-8?q?Christian=20K=C3=B6nig?= , Jason Gunthorpe , Joerg Roedel , Marc Zyngier , Marek Szyprowski , Robin Murphy , Steven Price , Sumit Semwal , Suzuki K Poulose , Will Deacon , "T.J. Mercier" , Madhavan Srinivasan , Heiko Carstens , Christian Borntraeger , Sven Schnelle , Dave Hansen , Kiryl Shutsemau , Rick Edgecombe , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Haiyang Zhang , Wei Liu , Dexuan Cui , Andy Lutomirski , Peter Zijlstra , Alexander Gordeev , Gerald Schaefer , Vasily Gorbik , x86@kernel.org, dri-devel@lists.freedesktop.org, iommu@lists.linux.dev, linaro-mm-sig@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-mm@kvack.org, kvmarm@lists.linux.dev, patches@lists.linux.dev Subject: [PATCH v11 08/23] mm: Document zeroing by set_memory_decrypted() and update the fallback Date: Wed, 2 Dec 2026 15:24:31 +0530 Message-ID: <20261202095446.2029567-9-aneesh.kumar@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261202095446.2029567-1-aneesh.kumar@kernel.org> References: <20261202095446.2029567-1-aneesh.kumar@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The architecture implementations now clear memory during successful private-to-shared transitions. Make the no-encryption generic fallback clear the supplied range too. Signed-off-by: Aneesh Kumar K.V (Arm) --- include/linux/set_memory.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/set_memory.h b/include/linux/set_memory.h index 27c32fbabfec..43ab0d62b87e 100644 --- a/include/linux/set_memory.h +++ b/include/linux/set_memory.h @@ -5,6 +5,10 @@ #ifndef _LINUX_SET_MEMORY_H_ #define _LINUX_SET_MEMORY_H_ +#include + +#include + /** * DOC: Kernel page table permissions * @@ -21,7 +25,8 @@ * * When an architecture does not implement these APIs they succeed without * doing anything, so a return value of 0 does not mean that the permissions - * were actually changed. + * were actually changed. set_memory_decrypted() also clears the range, + * including when no encryption change is needed. * * Callers that depend on the permissions being applied must ensure that the * architecture supports the required operation for the target addresses. The @@ -186,6 +191,7 @@ static inline int set_memory_encrypted(unsigned long addr, int numpages) static inline int set_memory_decrypted(unsigned long addr, int numpages) { + memset((void *)addr, 0, (size_t)numpages << PAGE_SHIFT); return 0; } #endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */ -- 2.43.0