From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 172BF14A0BC for ; Fri, 30 Jan 2026 01:30:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769736622; cv=none; b=AWmg9NjZfNsMSF8y4K/yi5Mi02WjVUwgJICxcmctbWrzEkyVIW0XcUI/lN8/FUCc934FKGaBk1cVo2rSW8yHsjLa7s9D9MAOQ9cfe+vSJ/2gHwvI0y9g6AFAU7UuMMIlRGTPi4KEHzXqrP+WzTAjp2x4KA4zC8JhsebWnqTh+cA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769736622; c=relaxed/simple; bh=OWbo5+AC/7MNSmt+smFsiU1JrGaXjjA5PVj06qv+38c=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=IIECvAIpnThB3VoCiVn9WzTQoPGTcnIJ8a0XVAt1n00iFkM+PfNytMHOy8n78PGd/rXbO39IaJ9cuJN0m5X9htGchGwrD6s49O4yRwSnviL5hsy4bSFpyydPLFEFLMrGWyBEyKPqrSOJKh4FqLETxY06X9G+ho/ftP2MzsW7Vi8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ihlLXpBK; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ihlLXpBK" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-352e6fcd72dso2577953a91.3 for ; Thu, 29 Jan 2026 17:30:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769736620; x=1770341420; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=VQBtu95IXBz7ZXJTgTL37RQFlBFs8n039CcrQPqipBA=; b=ihlLXpBKidiUdXGYKngS6gVSCMXHjlsEvcErsSGa70DK4v41kn9Va7+hXxaf4wE/CN R6ulenxbWl9/NDX2sCCy0gzOeoP/NOc5dInn9+2Y3JUq7yFjVPESL7QfOwGNlLFIEBcE n+0xmty/CpmEFAoYbPBACfuji9VcP1R8K9+3en8M9baOqSOy66v7rjEIQaANPpakoMM+ bZOEO+yIrtuTOF5e1E8byshJUCRHIGCOuFj4xlVfRcsdRPjLdbCrF2GNxWmzmTaruPEj 4N2ieqkDJhTcFPVZHzWxHHglXYrfUmD2advmxeE0M/jMO9614mapqrXxx+zE2by96Y+N /xyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769736620; x=1770341420; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VQBtu95IXBz7ZXJTgTL37RQFlBFs8n039CcrQPqipBA=; b=vUNlPSjy1Z+YavG4pWzG+NXx6qtbnH8aOyKjnlspjsBAGSc+F4wsx4XrvWF7RrTN8R isj0CS1vReiPw4qQFnEeITtyY2pRZJpTWotVaDznSEykhxYWTCvDytMTIUlPFYCnujzc iUpTaTwOC/mVLWMsekkdLdlWuXpl94yVAFdiiQUkTDyi9xauDDAeDFiUmRRSzopyO0gg 1Hb9jIq/Hc4NyUWBpNT/GRVXJyGRLS45VVdTR2d24aI4PVYIm9UmQ1/0ZAcCO1hS3oh/ F/P7YNE/N9qtykdkG/XLdNvYuVzwM3pOxq0y2D/thC7bGtdu9feRncoPFppVXt7jOFQc DLuQ== X-Forwarded-Encrypted: i=1; AJvYcCUgUqMNzSQM2iBFmcPoXSCy4Osw9ifgCK3Rez5uedEU9WgBf/iciS5CgWryTig/P1WCV/0=@vger.kernel.org X-Gm-Message-State: AOJu0YyiCq/5MezgJM6N+txG1EDr7bwIuEuxyifdlWU3zUPq88ZXyFk0 xzhu+6SZfS+97Wn/E6gwJ9f/jYDCap4/5n4bqAT+HAHYFYczHnpr4j1HBX5PvLPNyjqwixCz1jS xJg0evQ== X-Received: from pjbcu19.prod.google.com ([2002:a17:90a:fa93:b0:352:d166:32ab]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3d4f:b0:341:88c9:6eb2 with SMTP id 98e67ed59e1d1-3543b2dedf9mr1401283a91.1.1769736620318; Thu, 29 Jan 2026 17:30:20 -0800 (PST) Date: Thu, 29 Jan 2026 17:30:18 -0800 In-Reply-To: <20260129011517.3545883-17-seanjc@google.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260129011517.3545883-1-seanjc@google.com> <20260129011517.3545883-17-seanjc@google.com> Message-ID: Subject: Re: [RFC PATCH v5 16/45] x86/virt/tdx: Add tdx_alloc/free_control_page() helpers From: Sean Christopherson To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Kiryl Shutsemau , Paolo Bonzini , linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, kvm@vger.kernel.org, Kai Huang , Rick Edgecombe , Yan Zhao , Vishal Annapurve , Ackerley Tng , Sagi Shahar , Binbin Wu , Xiaoyao Li , Isaku Yamahata Content-Type: text/plain; charset="us-ascii" On Wed, Jan 28, 2026, Sean Christopherson wrote: > +/* > + * For SEAMCALLs that pass a bundle of pages, the TDX spec treats the registers > + * like an array, as they are ordered in the struct. The effective array size > + * is (obviously) limited by the number or registers, relative to the starting > + * register. Fill the register array at a given starting register, with sanity > + * checks to avoid overflowing the args structure. > + */ > +static void dpamt_copy_regs_array(struct tdx_module_args *args, void *reg, > + u64 *pamt_pa_array, bool copy_to_regs) > +{ > + int size = tdx_dpamt_entry_pages() * sizeof(*pamt_pa_array); > + > + if (WARN_ON_ONCE(reg + size > (void *)args) + sizeof(*args)) The above closing ')' after args is misplaced, this should be if (WARN_ON_ONCE(reg + size > (void *)args + sizeof(*args))) I'm still in disbelief that I managed to end up with such a horrid bug that compiled without any warnings. *sigh*