* [PATCH] x86/sev-es: Remove subtraction of res variable
@ 2021-02-23 11:11 Borislav Petkov
2021-02-23 12:23 ` Joerg Roedel
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Borislav Petkov @ 2021-02-23 11:11 UTC (permalink / raw)
To: Joerg Roedel; +Cc: X86 ML, LKML
From: Borislav Petkov <bp@suse.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@suse.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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/sev-es: Remove subtraction of res variable
2021-02-23 11:11 [PATCH] x86/sev-es: Remove subtraction of res variable Borislav Petkov
@ 2021-02-23 12:23 ` Joerg Roedel
2021-03-01 12:07 ` [tip: x86/seves] " tip-bot2 for Borislav Petkov
2021-03-06 11:25 ` tip-bot2 for Borislav Petkov
2 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2021-02-23 12:23 UTC (permalink / raw)
To: Borislav Petkov; +Cc: X86 ML, LKML
On Tue, Feb 23, 2021 at 12:11:30PM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.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@suse.de>
Reviewed-by: Joerg Roedel <jroedel@suse.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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip: x86/seves] x86/sev-es: Remove subtraction of res variable
2021-02-23 11:11 [PATCH] x86/sev-es: Remove subtraction of res variable Borislav Petkov
2021-02-23 12:23 ` Joerg Roedel
@ 2021-03-01 12:07 ` tip-bot2 for Borislav Petkov
2021-03-06 11:25 ` tip-bot2 for Borislav Petkov
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Borislav Petkov @ 2021-03-01 12:07 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Borislav Petkov, Joerg Roedel, x86, linux-kernel
The following commit has been merged into the x86/seves branch of tip:
Commit-ID: bb8dc26937d51b3421b26d9d91cdad3484c34b7e
Gitweb: https://git.kernel.org/tip/bb8dc26937d51b3421b26d9d91cdad3484c34b7e
Author: Borislav Petkov <bp@suse.de>
AuthorDate: Tue, 23 Feb 2021 12:03:19 +01:00
Committer: Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 01 Mar 2021 12:40:22 +01:00
x86/sev-es: Remove subtraction of res variable
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@suse.de>
Reviewed-by: Joerg Roedel <jroedel@suse.de>
Link: https://lkml.kernel.org/r/20210223111130.16201-1-bp@alien8.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 84c1821..1e78f4b 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);
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [tip: x86/seves] x86/sev-es: Remove subtraction of res variable
2021-02-23 11:11 [PATCH] x86/sev-es: Remove subtraction of res variable Borislav Petkov
2021-02-23 12:23 ` Joerg Roedel
2021-03-01 12:07 ` [tip: x86/seves] " tip-bot2 for Borislav Petkov
@ 2021-03-06 11:25 ` tip-bot2 for Borislav Petkov
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Borislav Petkov @ 2021-03-06 11:25 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Borislav Petkov, Joerg Roedel, x86, linux-kernel
The following commit has been merged into the x86/seves branch of tip:
Commit-ID: f3db3365c069c2a8505cdee8033fe3d22d2fe6c0
Gitweb: https://git.kernel.org/tip/f3db3365c069c2a8505cdee8033fe3d22d2fe6c0
Author: Borislav Petkov <bp@suse.de>
AuthorDate: Tue, 23 Feb 2021 12:03:19 +01:00
Committer: Borislav Petkov <bp@suse.de>
CommitterDate: Sat, 06 Mar 2021 12:08:53 +01:00
x86/sev-es: Remove subtraction of res variable
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@suse.de>
Reviewed-by: Joerg Roedel <jroedel@suse.de>
Link: https://lkml.kernel.org/r/20210223111130.16201-1-bp@alien8.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 84c1821..1e78f4b 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);
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-06 11:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 11:11 [PATCH] x86/sev-es: Remove subtraction of res variable Borislav Petkov
2021-02-23 12:23 ` Joerg Roedel
2021-03-01 12:07 ` [tip: x86/seves] " tip-bot2 for Borislav Petkov
2021-03-06 11:25 ` tip-bot2 for Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).