From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 8B97F35E95E for ; Tue, 16 Jun 2026 14:32:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781620334; cv=none; b=SGtRvue8rn3u2RfLf8T9wiDthYcnRW3VPUK2CIoy1AI+wyv3a7Xz/+g7j4UZTb6+hG1UuWnjS1OEgj+pjrXtappUb8GMrFuUOmAf6H/zCflt3DI0cQitZTnzMTeEqM6CShOrtQjy+luwZHhDKsxHSbnOLfS7sYTr4kESoxP9sLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781620334; c=relaxed/simple; bh=+rhMBDhmOVgjCabl31Hjhb5/AFO+Bz+8U3GfV3m9AFA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WR/yE60VVMFquBo2gYx3yxV039ON4eCK9A6gcjpgA9YlHSdVdOiB9D1Qg4jUebqSwmoRGBnGjfJxmy4wK3YqFQQ0TCP67bqF7N1vGV/YN09VDP+nfR0MUqN/9hEhic37sAxK28WNGIF82CekCv/4fbWTD3/M9uiBnThjWm/h2fA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=a+nHeBcl; arc=none smtp.client-ip=209.85.128.44 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="a+nHeBcl" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-490b23c828aso47635e9.1 for ; Tue, 16 Jun 2026 07:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781620332; x=1782225132; 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=n3wvzxcpQU0Ik+95S3dasptB+RwKMZZavChVLbzx6Es=; b=a+nHeBclFztBzG5H51KCnIrAS/IR6wf4x/VxxvK4tImDBQn4RqNBpNIAOXUfJCnggG 0H9Nj+D5uFBKnfCKQ2vH8TjuqZv4vCKpw7gN4aQqoPmBiNv2OJ/Oz5rZN8T4UwnP68Ji Tn8kO1m45xhjjkXPTKfBVIT3+BGnZNrfagMYthsLDKpzdl2LVjfk4i34Rbyfxgkx2rd8 NPm0eiTX4z/DzGmh0cXzug3g5UX/nI+YxUmVNe9KTu+gA9kOsaVWfl0TnQhFeTuyIHJ5 wdwD4aMKfHM85k5BvQSqj8RSKlKLyVjKaHqhIx4XCupdsZa291H351yJhAztqn4n2iFe IXIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781620332; x=1782225132; 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=n3wvzxcpQU0Ik+95S3dasptB+RwKMZZavChVLbzx6Es=; b=jlbIO7pT3fxTBm3NfQkpicrw0KgJ0dz0MVpXaKwpRP2OHk+DRoNIJl3H8cGB1gua/i CuUMpV6EIyx2xAGNa0jiolZOJzlb6ZlCs09YdvYHQnGMKZd80gpeuEaN0kaanpdU0jUa prNwwNxZra8a5cn4R4uxYWXgwjcAJrvaVqUNI1mR0KKEYp2iL05G5LphMFcSVmpoOQ1k mHkW3mM7FruDfZvxSyZRcSPU8AiW4XUd+GFSPCV4BzfFDPL6H/LLyOI73p9TAj6xk7lF koYkrluyErtNmAfsDdzNxXi0Pyi+rdWgNNyrz688HREi5m4Go0lQmn1EYts7aM5Nwpgg vvPA== X-Forwarded-Encrypted: i=1; AFNElJ/TNeMefNChwOXdAQHPJINorcuFP2ncvmkZOUH5ldXkTV56BjKy2r6oOGHroynPlbc/LGGrxqV5M6P9R94=@vger.kernel.org X-Gm-Message-State: AOJu0YzxtWhNnHa1d3mPyN2IWYhkdTZ49qJc8J62acAQoRQWciCE9+Jv qDwqZL8lO0rik6fUmCliJCv7oeYpZsIqiATNlxJx/Q5vbwEbAQbbJr4EJTezxyDqTg== X-Gm-Gg: Acq92OFW5D+TvBnyL57se7PZOQTPNWxiugveY7FU+HWN907qk+nsnPxMjxFE0JW/biJ diZBMRicyOCkYG0L1vlmqfDSBoYO9cmO0Q4D1Iulapzxnk1DaE2/X9ecxtOuLBM/3CyokgAqaq4 S6VvJejwwbIzkXVDkWPSXzuPwcmCn2/Pw7FjvzO4bHJVcelRvfWK5OmCtdnlcK90SBbjEKRqCvO lR/lk+BR+HAIsUwXiRWISoSRZm757m48Sjd68s2PgIKUcAH3F8JtEN2ObrwUfNCvGqV/UQKQm8+ GQ+gm1+KZuV9UbAB2rI7leqaWDLf0zvxAtJXqc/PDvvAKzX7mSnwYb6484KHx/T5W94ldjzLyAs AFY4MYBFDxrS0K+gzCp0waDQC6HOgr/aDSpaW+PazQV4YgxSJiEtpDls9Y6Dv77Jae0keKz1thM lehyOfOInnXB22MnyZ82pECrx1YKY5cZRGvMnjmCY3fG4L73qLiawUCHqvtFWDU+uwt62xyg== X-Received: by 2002:a05:600c:15c3:b0:492:203f:a378 with SMTP id 5b1f17b1804b1-4922ffdc0f7mr882935e9.8.1781620331294; Tue, 16 Jun 2026 07:32:11 -0700 (PDT) Received: from google.com (143.11.148.146.bc.googleusercontent.com. [146.148.11.143]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4922fa47d1csm83331255e9.4.2026.06.16.07.32.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 07:32:10 -0700 (PDT) Date: Tue, 16 Jun 2026 14:32:07 +0000 From: Sebastian Ene To: Vincent Donnefort Cc: catalin.marinas@arm.com, maz@kernel.org, oupton@kernel.org, will@kernel.org, joey.gouly@arm.com, korneld@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, android-kvm@google.com, mrigendra.chaubey@gmail.com, perlarsen@google.com, suzuki.poulose@arm.com, yuzenghui@huawei.com Subject: Re: [PATCH v3 1/7] KVM: arm64: Enforce strict SBZ checks in the FF-A proxy Message-ID: References: <20260616105417.2578670-1-sebastianene@google.com> <20260616105417.2578670-2-sebastianene@google.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: On Tue, Jun 16, 2026 at 02:00:39PM +0100, Vincent Donnefort wrote: > On Tue, Jun 16, 2026 at 10:54:08AM +0000, Sebastian Ene wrote: > > Introduce a helper method ffa_check_unused_args_sbz to enforce strict > > arguments checking when the hypervisor acts as a relayer between the > > host and Trustzone. > > > > Signed-off-by: Sebastian Ene > > --- > > arch/arm64/kvm/hyp/nvhe/ffa.c | 47 +++++++++++++++++++++++++++++++++++ > > 1 file changed, 47 insertions(+) > > > > diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c > > index 1af722771178..c723a21006aa 100644 > > --- a/arch/arm64/kvm/hyp/nvhe/ffa.c > > +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c > > @@ -71,6 +71,18 @@ static u32 hyp_ffa_version; > > static bool has_version_negotiated; > > static hyp_spinlock_t version_lock; > > > > +static bool ffa_check_unused_args_sbz(struct kvm_cpu_context *ctxt, int first_reg) > > +{ > > + int reg; > > + > > + for (reg = first_reg; reg < 17; reg++) { > > Hum, should it be reg <= 17? > Right, I think 17 including. Thanks for pointing out. > > > + if (cpu_reg(ctxt, reg)) > > + return true; > > + } > > + > > + return false; > > +} > > + > > [...] Sebastian