From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54A9E3B5854 for ; Mon, 8 Jun 2026 08:40:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780908050; cv=none; b=rBUY4B4KJ0txA/bFY+zait6VrJFEw+BZ5WPPPnX65cKdLMn80E+ygOy377q7kfnrVhAptBsPUJrmw4O5UR4q0msT3udR7eliTOHE3WhNuBclBWBcB7wHJvJpAx9UJzFpniTqXhckQLFmDyNNLmNVMf/UDRKKZpnfSBGrd/kw/+M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780908050; c=relaxed/simple; bh=t7dTtFcMNo1oGbZCogjoqyizO/j3E+pcvyk5ppy+DwY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oF3jVeD8Hw9SoQDZDV7G8TA9lLvr2vsiCyZj2pmGrLHXcG8X4Oeq7LC/I0TNx4/f1p8uQnlmXNf2AMuMn4nTm3CY0TnPi4/Xjs212u/8HwNiSrZO6I8jzi9UH1kWPm+MluOGH/j+dKdZfO0xIEIOTZx6+NlLG6xnuUo0WncmJFI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CyScqIgk; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=d6Ky4wyE; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CyScqIgk"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="d6Ky4wyE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780908048; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=4h2My/REs5Vp77QAaORxbiGwFbWeluHTenTERVDNw80=; b=CyScqIgkvbPjDWFTomxC6UduwHqNrPKtxhhsiFk9IvXf8/yPwx9g1rpZMis+yocjJDDAzZ Pv8A/xZjjYn7PzRiz//2HwGWeM+8T/9K08bucmiibRHJSOhPUlBfXGNV9j9M+TRRE6Zy+r oI5Fv20T8/Jt8Xt9t8ENGFkNtQCTNQ0= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-9-TTXnBsLiObi6mwl6b2OO_Q-1; Mon, 08 Jun 2026 04:40:47 -0400 X-MC-Unique: TTXnBsLiObi6mwl6b2OO_Q-1 X-Mimecast-MFC-AGG-ID: TTXnBsLiObi6mwl6b2OO_Q_1780908046 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-45eebc943bfso2307147f8f.0 for ; Mon, 08 Jun 2026 01:40:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1780908046; x=1781512846; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=4h2My/REs5Vp77QAaORxbiGwFbWeluHTenTERVDNw80=; b=d6Ky4wyEEm1um5rDNrvMov99suWtnYnJSNBcn2eAOdM3w5UwiAuwYuU+2LFRxchfBP EKhkF/wvJ7htGd2T1eS9NKsJ3yrw5mc4oaw9gjh5njZSScs4UMXcXqO5FrDejuisX9J/ JGlRPfSKM83S3zwBW24g0VbaHrfGNQsfELpiqJupRMmfDaiC4imQWbeR/9oUz3xqMyBF hzVzveCyTOS3RAnDRGnNzj6XDxjWNlCjlKHFogtOEPWZAzqY6CjM/J9KC87WtT1n29RY XTEP8+s7zWlC5mZelxjGaXQMKTSZYUzf92ejJNlP0KW4AzmHdJozBWGxTN7uDnMtJ9Zz jJzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780908046; x=1781512846; h=in-reply-to:content-disposition: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; bh=4h2My/REs5Vp77QAaORxbiGwFbWeluHTenTERVDNw80=; b=NNtADtUccofxj8KSzTtgAkT6TRiyKGv9CyMVF9xRdjA/B9qxkBm8ACGneWCOKgux4k o/SboqiAK6oB3/LPlyrNyRI2dssajRYOfi6VcjOadLd9hLMge7im6oBKPjTeGpTCH0rN T2go9MItKNNbeqSJGmBmvmpHweDAmUQEfWfgablUh6FSbwABn3FWo/ohBjNd14vW32/C afiwnZhhnwqFf4QYz5E1HAymfZB/9HUKmsn7prnEaWtN1j4QshQ+kMcruDg20/7y87pa N81ioVY2Mcn4hQxdlSm+RFBA00336IW6a/MnGhZSDykjS0R55qsue3ZYDO8XL3/TWRJM Ixpg== X-Gm-Message-State: AOJu0Ywx5nT9XZSw8DVaLxBy6lSIuBQ0uAxBRJErTwlfI6sSszGA2122 NxsqHQlI4uXDTbmlS0JBmH30Sqqtd8M2n6ybVw2ppcyYY1gnwyUQR+YA3VymQcQVRBx4HY8ldL/ Pi7yFuEFSTvOh3KNimdVA3qcYsdcMDlzOR1qrLJiZR+BiX/SbmOmUoXgtPEMIT4PmzBvngKPA1k AK9EL2Ytl4kZtGYFgIvOofi7TSpB85btStXW1DIfI/PRY= X-Gm-Gg: Acq92OGwlsKifJMQhi0lrzijBK8i7GxB2BDR4YwV5+hccCtv1LpWR1ITu0uPDyj04CA 33JDLYb0rDX+3x09o29pcK72MJ4lhzbak493DmRlGoeOjsTX2I4Mead/fjQDqAWko9FQIhAK7kQ yPGfiURFhb89TTor5XV6tW6NbchUkTCtyY10CaEKaoEP5DNcrx5WndIu96Yd+RWmhT4OZnY3aMV A0F6td3bn6AFuuVs590XAG8nXKNHgqplnwRYOWKsbsvMmujt8twH/RWJVV0Azxv4CyiwRAveG5z 6yGdPSJbPQ517L3AsrUjb5K8qODqS9iFvbb7qDsxfAHq7C62N6SKgzJDt/+7XFrGVu69QLPepjs NP3L4Lrp7B0qMxKYJqIZo+Hg= X-Received: by 2002:a05:6000:491a:b0:45e:f93a:2069 with SMTP id ffacd0b85a97d-46032db4e83mr21033570f8f.23.1780908045929; Mon, 08 Jun 2026 01:40:45 -0700 (PDT) X-Received: by 2002:a05:6000:491a:b0:45e:f93a:2069 with SMTP id ffacd0b85a97d-46032db4e83mr21033456f8f.23.1780908045356; Mon, 08 Jun 2026 01:40:45 -0700 (PDT) Received: from redhat.com ([31.152.37.159]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f344558sm48517487f8f.18.2026.06.08.01.40.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 01:40:44 -0700 (PDT) Date: Mon, 8 Jun 2026 04:40:30 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: "David Hildenbrand (Arm)" , Jason Wang , Xuan Zhuo , Eugenio =?utf-8?B?UMOpcmV6?= , Muchun Song , Oscar Salvador , Andrew Morton , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Hugh Dickins , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Christoph Lameter , David Rientjes , Roman Gushchin , Harry Yoo , Axel Rasmussen , Yuanchu Xie , Wei Xu , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , virtualization@lists.linux.dev, linux-mm@kvack.org, Andrea Arcangeli Subject: [PATCH v10 35/37] virtio_balloon: disable reporting zeroed optimization for confidential guests Message-ID: <101bfae36b0f6445ff0189c2b0936648f3f46118.1780906288.git.mst@redhat.com> References: 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: X-Mailer: git-send-email 2.51.2.2891.g4157995a80.dirty X-Mutt-Fcc: =sent In confidential computing environments (TDX, SEV-SNP), the host is untrusted and may lie about zeroing reported pages. Clear DEVICE_INIT_REPORTED in validate() so the guest does not skip re-zeroing based on hints from an untrusted device. Note: currently REPORTING remains enabled and VIRTIO_F_ACCESS_PLATFORM is cleared in CC environments. This is known to leak free page physical addresses to the host. Whether that, or ballooning in general, is a security concern in CC is up to the user. This patch only disables our new zeroed-page hints where the host is untrusted. Signed-off-by: Michael S. Tsirkin Assisted-by: Claude:claude-opus-4-6 Assisted-by: cursor-agent:GPT-5.4-xhigh --- drivers/virtio/virtio_balloon.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index e3afa6f32ba5..bf1172ad5419 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -19,6 +19,7 @@ #include #include #include +#include /* * Balloon device works in 4K page units. So each page is pointed to by @@ -1193,6 +1194,8 @@ static int virtballoon_validate(struct virtio_device *vdev) !want_init_on_free()) __virtio_clear_bit(vdev, VIRTIO_BALLOON_F_DEVICE_INIT_REPORTED); + if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) + __virtio_clear_bit(vdev, VIRTIO_BALLOON_F_DEVICE_INIT_REPORTED); /* * Balloon submits 1-2 sg entries max per buffer, virtqueue * sizes are 128+. Disable indirect descriptors to avoid -- MST