lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241119192602.GA2272685@bhelgaas>
Date: Tue, 19 Nov 2024 13:26:02 -0600
From: Bjorn Helgaas <helgaas@...nel.org>
To: Ragavendra <ragavendra.bn@...il.com>
Cc: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
	dave.hansen@...ux.intel.com, hpa@...or.com, thomas.lendacky@....com,
	ardb@...nel.org, tzimmermann@...e.de, bhelgaas@...gle.com,
	x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Updating es_em_ctxt fi to zero

On Tue, Nov 19, 2024 at 10:05:18AM -0800, Ragavendra wrote:
> Updating es_em_ctxt to zero for the ctxt->fi variable in
> verify_exception_info when ES_EXCEPTION is returned.

This commit log basically says in English what the code does in C.  If
you can include the *reason* why this is important, it will be more
helpful.  For example, maybe somebody consumes other parts of ctxt.fi
(a struct es_fault_info), and without this patch, they use junk that
causes an oops or some other bad thing.

If the 34ff65901735 Fixes: tag is correct, I suppose the problem
happens because ctxt is allocated on the stack and contains junk, and
then svsm_perform_ghcb_protocol() passes it on to
vc_forward_exception(), which does use fields of ctxt->fi other than
.vector, which will be junk without this patch.

Hints and samples for commit logs:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/maintainer-tip.rst?id=v6.11#n134

Based on "git log --oneline arch/x86/coco/sev", I would expect the
subject line to have an "x86/sev: " prefix, e.g.,

  x86/sev: Clear es_em_ctxt.fi to ...

> Fixes: 34ff65901735 x86/sev: Use kernel provided SVSM Calling Areas
> Signed-off-by: Ragavendra Nagraj <ragavendra.bn@...il.com>
> ---
>  arch/x86/coco/sev/shared.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/coco/sev/shared.c b/arch/x86/coco/sev/shared.c
> index 71de53194089..b8540d85e6f0 100644
> --- a/arch/x86/coco/sev/shared.c
> +++ b/arch/x86/coco/sev/shared.c
> @@ -239,6 +239,8 @@ static enum es_result verify_exception_info(struct ghcb *ghcb, struct es_em_ctxt
>  		if ((info & SVM_EVTINJ_VALID) &&
>  		    ((v == X86_TRAP_GP) || (v == X86_TRAP_UD)) &&
>  		    ((info & SVM_EVTINJ_TYPE_MASK) == SVM_EVTINJ_TYPE_EXEPT)) {
> +			memset(&ctxt->fi, 0, sizeof(ctxt->fi));
> +
>  			ctxt->fi.vector = v;
>  
>  			if (info & SVM_EVTINJ_VALID_ERR)
> -- 
> 2.46.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ