From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA0343E9C2F for ; Thu, 20 Aug 2026 12:20:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787228454; cv=none; b=iNdIrb/VjjUKmyfSL1/7xwDq5l+CmARgo3Vx41g4ohjAWhtsNKczHRBbqHyn6cs7j5DTUZBwZ04s1SHj07njxVg0nti4jNF80/SLd2fPStxR/ISIsFtGGCtaXUGDFv6Do7Gln5PecnqbDbOkkCgY5PjeNd8FZgqusZLkoxzt4wg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787228454; c=relaxed/simple; bh=IcoMuhjZIaAv716kXMsE3tELwfUGT8S9drXzA3a9OEM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EPxaDVmG00vUXaZS2HOuWaoYl2Dd787O27YRzjA6awops+6n1kiKQn418rJSeZYzkSAynsgV4VrJIEIkp0NkeTwFZl7psypY3Qw5Pyl7y5zRh0L2544T4pnpdi5KY3GetQC6++RebRKqOoKS8Jjl8zh67GVBxfFqmkpnOgYUtmQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=GJyiDdb3; arc=none smtp.client-ip=209.85.219.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="GJyiDdb3" Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-8f0e5e36912so14829926d6.2 for ; Thu, 20 Aug 2026 05:20:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1787228450; x=1787833250; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=CFAD3PPmyEYBnRQoyhozco7Gx3OsZl5eV5ORNG74mm8=; b=GJyiDdb3FVlkK1gGlB7M0Xegdj9gEsDfiZvwU138KP2+QEHbwTvHdb2x//rb4RfVWF VHGcxosJDdu+RAclJx+40ZTxA4/3hCOGrXfq8BoburP9xRdfoB9hHjzuYpSjABA/qKY0 tpch8YuyIX4jttHK9YykXWviTjRkEK/2CzHRGFA+5/WLKISuKQ8Vkg3MiGqVoOKXi96O GJXm5cUN7q3/gBVUrWHMf0dSLKzO88agNNme33MpqgZ0SmzhBbk/dp5+Fbx7FOZQ5Veq fPBzgM/4lSliQtxRTng1in+IjIPS+nt535GiH97I+yJg9LR0ySf7SkRNT83Bir/ocpky yHhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787228450; x=1787833250; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=CFAD3PPmyEYBnRQoyhozco7Gx3OsZl5eV5ORNG74mm8=; b=MJc7jQNJ7Jt+f+2X+7pHFEdCTxc22hjS9jMGIebmvYk5m/+MfpriH3AbkbNR18YzAd ZaG++Xvc+MVvKJA30mRH4eLIuWfubXnl3kNuI7BNcaJpHeWVcO1Db9ybNlemiwOP6pDU 7/tVnKGg3BaQxlj7UcgGn+AU5ETq+5g/xItb+E/smfN3rTuGnpR5B6o+f8VX/9b44tG2 tHk2itg0URVGdBADlRlZHtlwasqvBkPyr/9HNPV5u7PR05BAiXq1KKNxtRwjbTv5urNL nfTpCtKmftlhTtSb1EmoA8Xlw4MlCTETrBauoI3XTjkKCeWQTmH9dUy2V7p0Zbq9kXxv DiZQ== X-Forwarded-Encrypted: i=1; AHgh+RqFw716s5/QvVWS5uO74IK0ay9phmS1k2ZcQ/dVVXAOvikCnTAHhp4fTw3vqZi5GIrdYcxxULsQFDQfn8w=@vger.kernel.org X-Gm-Message-State: AFuF++ke1L9exsH8EB2s3U2+YmmHEmruqmolzJHB5t38x6z4Y6bX5WxG /AMwV9G0ZPhSmBG39LnfGFx3WbKZYDX9lf9UaFLesUzGAVpakGPtHkdzTkIaqWWRnRc= X-Gm-Gg: AR+sD13oXzIYhyy+mtENhQrom7qn2Y8SHw2Rj9rjAN3PqjXRK4yTwyQzYOeouZxtowH gBQBRWiup0ZpuoOHTRLMrVOWWsXpmYTd4g3ZjJ5k9o6+L9j8/pHJgmDnq45zCZw+2M+ydLcwRuP TnbUx8HzveGqRSDjite7nvGFftKRQN1Wg2fc72oFFr51EjeQdjLsCr+Wtv9wnzLUcTS8kPv+4PQ JeEfmlXMYIpF0V0Du/iLAH9ybOI5VuwhaNgexl7HcWeelHJZEhZzUT5mz4p0TxsStv5EGSpvXMj 0XfS/pGDEUN4+BxK0RVC8cbUlo2G6RCBx34WZ3o8ElrUkj26d/YPaD9f8TIDm3nioYBvxweYe/3 Sa+4Kx7bsX1cLqSowBseFWFGs2Z0c6C6RinOJ7l2d6WUkZC3BJq31zAfiwCI5tgFlQKPNOwxqV5 B0MYSNkSlpBNy5suFbb1wlabvUGkdeJjgl5bp86A8J7ZZ7qQfgYGJnWviXibkqAnCucMPoY8/DS /e4iyoVKdbC8Hc+FMRUSdASFbqMx9HJrFiQLmTgqxGKgw== X-Received: by 2002:a05:6214:124a:b0:908:92e3:a37 with SMTP id 6a1803df08f44-90c5eaf245amr114579506d6.32.1787228450436; Thu, 20 Aug 2026 05:20:50 -0700 (PDT) Received: from ziepe.ca (hlfxns010zw-159-2-239-150.pppoe-dynamic.high-speed.ns.bellaliant.net. [159.2.239.150]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-90c5f2b1f39sm36591756d6.41.2026.08.20.05.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2026 05:20:49 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wx1lI-00000003bNC-36dR; Thu, 20 Aug 2026 09:20:48 -0300 Date: Thu, 20 Aug 2026 09:20:48 -0300 From: Jason Gunthorpe To: Steven Price Cc: Christian =?utf-8?B?S8O2bmln?= , Marc Zyngier , Sumit Semwal , Thomas Gleixner , "T.J. Mercier" , Benjamin Gaignard , Brian Starkey , John Stultz , dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Jiri Pirko , Marek Szyprowski , Suzuki K Poulose Subject: Re: [PATCH 0/2] Clear shared pages after private-to-shared conversion Message-ID: <20260820122048.GB18100@ziepe.ca> References: <20260820105026.53208-1-steven.price@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260820105026.53208-1-steven.price@arm.com> On Thu, Aug 20, 2026 at 11:50:23AM +0100, Steven Price wrote: > Arm CCA includes "Memory Encryption Contexts" (MEC) which allows the > private and shared data accessible to a guest to have different memory > encryption keys. Consequently when converting memory to shared, the > memory encryption key used to access the physical page will change. > > Both the GICv3 ITS driver and the system_cc_shared dma-buf heap > currently allocate memory with __GFP_ZERO and then decrypt it. With MEC > the zeroing is done with the wrong encryption key and the data visible > after decryption may be ciphertext. The RMM is required to scrub the > data, but may perform this scrub with a different encryption key to the > eventual key that will be used for shared access. > > Fix these two sites by avoiding the __GFP_ZERO during the allocation and > performing a clear_pages() call after the decryption. Reviewed-by: Jason Gunthorpe This whole set_memory_decrypted() API is awful. It really should be improved. alloc_pages_decrypted() ? Jason