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.133.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 8A15E3A6B6E for ; Thu, 7 May 2026 22:23:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778192633; cv=none; b=kfgPi33naFbuq5frmUq4fEQHIvKBzWGrTqA1VZJKTUUEec56TKhthF2yDvzc0YvJGEiGEc2cECw5IkT9/N6dkzbAPRB/TNCi2MJLPuOv0omKpQR7k7fU4sW/DmLEPmOZ5GUxGUX93RgKhHoOm7a+63mFuJhGnY7lXC0YvI0+lDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778192633; c=relaxed/simple; bh=AK9TO94T0KU+04u+dGjmV3b60mJRmYIjdCC4LEd/MMo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DDH+nTyxZd/AyL4/IqxbgVWgZDSwdujVKWhAcyoZg+as5J45y0Fxplm4wRZDX3+DFuVlbYuI/mItVRHeS/ibmXGZ6pIts2eNjoq3zaC0NXtkg8TH2yu8S8D0k0vuSFkNo4r1b340pE5t1ppyDfpP+EBNIG9RgmKynWyCrvDe7KQ= 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=IX+vUPjS; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=kaBhtjWT; arc=none smtp.client-ip=170.10.133.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="IX+vUPjS"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="kaBhtjWT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778192628; 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=NRctwQPPX8xkJe678Z/hFoNL2OQQ834j5nPYy6NU4ac=; b=IX+vUPjSPpT3ns/5chTU5AJYlcpw4ydRk/vjtCrqQjg44aDOGh+4cObozOiFvEStaXFjgc gAzqS/dtj7gWEf5LY+Mloa0s9lrnfrZCV9B+BwHsUx6m3zNFEN5iP2Zd705vNokmA13lRS 0Hevwbt7uG5axVkcARusx0lDXLVXlyQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-634-kCNeRZ_9ObyQ4rc_dKmqqA-1; Thu, 07 May 2026 18:23:47 -0400 X-MC-Unique: kCNeRZ_9ObyQ4rc_dKmqqA-1 X-Mimecast-MFC-AGG-ID: kCNeRZ_9ObyQ4rc_dKmqqA_1778192625 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-488ba2f4094so9818975e9.1 for ; Thu, 07 May 2026 15:23:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778192625; x=1778797425; 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=NRctwQPPX8xkJe678Z/hFoNL2OQQ834j5nPYy6NU4ac=; b=kaBhtjWT1/Zk8C+i4z4pgzpMZTRNvc95xZioR9djRvEM1kvwJkintzLYjyVIgWHtm5 2gTXofTzJREUD0pA2LWTGLDfyBhchWHhMRELa1S0g/rN/lLxHMavbEXRDZAEr2KI18GJ UlkGzd4Xnoz+xI7++bCC2fjOl+K5OdZwSXMuvdvDv+YZYfPlplkfj4IJhvD0PpKsZ6Mw 11VH71LSmG+qz1AM7mfDiaSnCQgMztvKVKFBq0J5Qs+XeXfU17D5+JHHcCYGJuHYyNXN c5qmiG0GsjaB+NRKxMxSBoVQ27xxgxyobLCJGaB62HWrKKDnpdRkPvvSAAGfRvmcgkpU sOGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778192625; x=1778797425; 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=NRctwQPPX8xkJe678Z/hFoNL2OQQ834j5nPYy6NU4ac=; b=bXBqeRfk9AvuPFLghZkKY+KAiagri+7RcHANxyjUnuguLZGlVadQ5q1wnO/6SqEOVp syjvov2ZcTyqwSYk9nhRV0LgSz9IiYFdfj5hp7SX66tgomEqGt6BLoWmqDk+OBJuaBh8 C7H9S1/5WeIiM+y92LF7IF42EYU9gHlSAyFZhn0dVxEW1WBG2wSuEhswOx8YzyRTUPam EkHr0XV8EAuc4TQve31T7Rxz6EQaQWlwk3A5Zp0H2lQLm3Dt78RxKTv1hLBrgSZEIKPd wvPoRYA8yu2Rr4PCiq1PS/v/h/hmjCBmx+hPSUJGevjaCczMhZ/XJN2eS1dT4Zc9/Ctg 7Vqg== X-Gm-Message-State: AOJu0Yy0AJoBfjqfr23wtA+C9pOpmZU4CRsyd+rm5t3Ido0dYFjGrjlQ VygM3alklzZeEnDLzs2YdX0b0hJD835FnueOCFU8wXL1VuavA4IL8D9iaINAkz7pP0KA3itO+yk BBLJ82F3WmNyTjuoFx8e8vaX6ifLNex7Nd/Pdgu+woqQmriKyyqKJJTKpOdOaKj5+M7f98Xg2xV O066NBalkaWIGyEjLbxZfYXn9tjUpVeZiNqwKCW47MzBw= X-Gm-Gg: AeBDievOUI5IEBUFVF0A7S7u6GPEIvb9WXe9yGd3nC6RmMFHz0TZ8Ug+ibJY6POOCrg c1t0424CKreqMogYwz5wvDQoC4cRFlzaJ9jpEscu+bLKVxsPJC4T25/2Hk1bZXX7ZW5yUtAvrhz TPwBvVZnVWxQgRllUcvvYzQzFmbFf0nybWhetgOiyADMt+1CvWY2q0/D338sH5NZaQHmVjtou0f t2vyXlMl7Q0O0BFPn7wZ0noLZ0oEe0UlJIQmGsyG93uLxRSAgaWSepYsFfSGnQCsnT89KMyxz6Z ZKK3PHNROj4/v/RJekfT1d4yWRzV92mZkw/Y0YOPgeaBtib7V+xd00rceD9RN8Rii3rM8dauXqe JIlNuFgixEcq3j6xhZdzfxHos9H5Ehh5x36tYpcIY X-Received: by 2002:a05:600c:2e0c:b0:48e:526e:1011 with SMTP id 5b1f17b1804b1-48e526e106bmr81739885e9.25.1778192624894; Thu, 07 May 2026 15:23:44 -0700 (PDT) X-Received: by 2002:a05:600c:2e0c:b0:48e:526e:1011 with SMTP id 5b1f17b1804b1-48e526e106bmr81739685e9.25.1778192624331; Thu, 07 May 2026 15:23:44 -0700 (PDT) Received: from redhat.com (IGLD-80-230-48-7.inter.net.il. [80.230.48.7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e65c01d7bsm4592885e9.8.2026.05.07.15.23.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2026 15:23:43 -0700 (PDT) Date: Thu, 7 May 2026 18:23:42 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: David Hildenbrand , Jason Wang , Xuan Zhuo , Eugenio =?utf-8?B?UMOpcmV6?= , virtualization@lists.linux.dev Subject: [PATCH v5 27/28] virtio_balloon: disable reporting zeroed optimization for confidential guests Message-ID: 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.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent In confidential computing environments (TDX, SEV-SNP), the host is untrusted and may lie about zeroing reported pages. Disable host_zeroes_pages so the guest does not skip re-zeroing based on the used_len hint from an untrusted device. Signed-off-by: Michael S. Tsirkin Assisted-by: Claude:claude-opus-4-6 --- 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 708b0c344ae9..1eb9a6376038 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -18,6 +18,7 @@ #include #include #include +#include /* * Balloon device works in 4K page units. So each page is pointed to by @@ -1117,6 +1118,8 @@ static int virtballoon_probe(struct virtio_device *vdev) #endif vb->pr_dev_info.capacity = capacity; + vb->pr_dev_info.host_zeroes_pages = + !cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT); err = page_reporting_register(&vb->pr_dev_info); if (err) goto out_unregister_oom; -- MST