[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200603100857.GA20099@8bytes.org>
Date: Wed, 3 Jun 2020 12:08:57 +0200
From: Joerg Roedel <joro@...tes.org>
To: Borislav Petkov <bp@...en8.de>
Cc: x86@...nel.org, hpa@...or.com, Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Hellstrom <thellstrom@...are.com>,
Jiri Slaby <jslaby@...e.cz>,
Dan Williams <dan.j.williams@...el.com>,
Tom Lendacky <thomas.lendacky@....com>,
Juergen Gross <jgross@...e.com>,
Kees Cook <keescook@...omium.org>,
David Rientjes <rientjes@...gle.com>,
Cfir Cohen <cfir@...gle.com>,
Erdem Aktas <erdemaktas@...gle.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mike Stunes <mstunes@...are.com>,
Joerg Roedel <jroedel@...e.de>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v3 23/75] x86/boot/compressed/64: Setup GHCB Based VC
Exception handler
On Mon, May 11, 2020 at 10:07:09PM +0200, Borislav Petkov wrote:
> On Tue, Apr 28, 2020 at 05:16:33PM +0200, Joerg Roedel wrote:
> > @@ -63,3 +175,45 @@ void __init do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code)
> > while (true)
> > asm volatile("hlt\n");
> > }
> > +
> > +static enum es_result vc_insn_string_read(struct es_em_ctxt *ctxt,
> > + void *src, char *buf,
> > + unsigned int data_size,
> > + unsigned int count,
> > + bool backwards)
> > +{
> > + int i, b = backwards ? -1 : 1;
> > + enum es_result ret = ES_OK;
> > +
> > + for (i = 0; i < count; i++) {
> > + void *s = src + (i * data_size * b);
> > + char *d = buf + (i * data_size);
>
> >From a previous review:
>
> Where are we checking whether that count is not exceeding @buf or
> similar discrepancies?
These two functions are only called from vc_handle_ioio() and buf always
points to ghcb->shared_buffer.
In general, the caller has to make sure that sizeof(*buf) is at least
data_size*count, and handle_ioio() calculates count based on the size of
*buf.
Joerg
Powered by blists - more mailing lists