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: <20210223122327.GA9649@8bytes.org>
Date:   Tue, 23 Feb 2021 13:23:27 +0100
From:   Joerg Roedel <joro@...tes.org>
To:     Borislav Petkov <bp@...en8.de>
Cc:     X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86/sev-es: Remove subtraction of res variable

On Tue, Feb 23, 2021 at 12:11:30PM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@...e.de>
> 
> vc_decode_insn() calls copy_from_kernel_nofault() by way of
> vc_fetch_insn_kernel() to fetch 15 bytes max of opcodes to decode.
> 
> copy_from_kernel_nofault() returns negative on error and 0 on success.
> The error case is handled by returning ES_EXCEPTION.
> 
> In the success case, the ret variable which contains the return value is
> 0 so there's no need to subtract it from MAX_INSN_SIZE when initializing
> the insn buffer for further decoding. Remove it.
> 
> No functional changes.
> 
> Signed-off-by: Borislav Petkov <bp@...e.de>

Reviewed-by: Joerg Roedel <jroedel@...e.de>

> ---
>  arch/x86/kernel/sev-es.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/sev-es.c b/arch/x86/kernel/sev-es.c
> index 84c1821819af..1e78f4bd7bf2 100644
> --- a/arch/x86/kernel/sev-es.c
> +++ b/arch/x86/kernel/sev-es.c
> @@ -267,7 +267,7 @@ static enum es_result vc_decode_insn(struct es_em_ctxt *ctxt)
>  			return ES_EXCEPTION;
>  		}
>  
> -		insn_init(&ctxt->insn, buffer, MAX_INSN_SIZE - res, 1);
> +		insn_init(&ctxt->insn, buffer, MAX_INSN_SIZE, 1);
>  		insn_get_length(&ctxt->insn);
>  	}
>  
> -- 
> 2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ