Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp552485pxb; Fri, 8 Jan 2021 11:35:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyi4H74umsz8tt6c3mZoE0jE56KEhM48cke3BGa01PJZq7J+wMfxNTHtJR/jdZVLMKKB7d3 X-Received: by 2002:aa7:c749:: with SMTP id c9mr6484013eds.3.1610134516500; Fri, 08 Jan 2021 11:35:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610134516; cv=none; d=google.com; s=arc-20160816; b=bA0UOVF7w3B/G2lfSSAjIazLK69Mgn+hK+PpRjvOpVtTKdjuNNXQ7YjwVgrHKKcvTf Ygx6nctHKY3ns5XFBHzjW6cx61Mh9EjFjLKcY+cv5BvnxFjTDRMju6+kTQFr1YHEvdsK p/6i4pWCc9ehKiy+AOP+7gumtpIMR3DL/r8Atm4ysLUBkRKP5Brm/6INU50X6iS8MsMv v98I+bdq1ACMI/eI2hxgUQIcEOjI+wqHJeQV8FHGLz8JiFPhoMR55sPCoCwQg6QRjJaM rZnjcCBEpWSrQ93Qzl2JFFTzs49xG0gN8BGb6bPe/IzUhQEuNArZeHN3U3VDClp0Oqx3 JBmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1pHPN41hHFv+ZbGuu8jjfM3Gxxyuq3FlEqjuJ/4MteE=; b=hDE9NunC02Sa5Z5o/VTDc7p1PV13Nxs0OWft9te7p2MrrY3QDn6ONYIp45WSl5wMcV mOpoLVTx3Yqah55tsUVapBGOYUmFIicRjyVEGfJgwZL33gSrWtTkxZlbuDAoO/tZtCvb 9rzcdEhCikjGrRkI5eRlQ9Rr765rYPStkzCI2jl3h4JA+n1zqcem5iEzvhreXgvnm70J ecDvSQA1zT71JwPPuIbVICcZ4zZRYBmOY2sUyj74t29SAaJoZhKhTlWpgRdy+qRNpZu8 fSYMw8KvWC9E2g/O+gd7Q1nbIUjTchXo8FYrJ7UVJkQTCVqKJSW6VZQhW4NmmAbVmrZY SckQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ayiqZhbI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w11si2535687ejc.533.2021.01.08.11.34.52; Fri, 08 Jan 2021 11:35:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ayiqZhbI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728884AbhAHTdq (ORCPT + 99 others); Fri, 8 Jan 2021 14:33:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726650AbhAHTdp (ORCPT ); Fri, 8 Jan 2021 14:33:45 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ADCAC061380 for ; Fri, 8 Jan 2021 11:33:05 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id r7so10053139wrc.5 for ; Fri, 08 Jan 2021 11:33:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1pHPN41hHFv+ZbGuu8jjfM3Gxxyuq3FlEqjuJ/4MteE=; b=ayiqZhbIA7heOAmgfEv425GUDNo65pWHCEe/o441GbMZbV/HY57wDg0PvV6K74fOzs tRu4fsD3S5MhMhKZOiijzPuus4y26RhXMqsVGS5cIhg5Il0Y99x0G7UDEy7FVv6VLF3w r6Z9qBNWBnkGJ0GVWhRAroGBsUY19PhZTQvmdAOjJk7w7Qp86jSJ95tdtb00XPkdqTGj ZLHc2HYSPFDN9REUrU7nKjVyl9AUeljJzvFNcICJR0mG2AG/eQB5JY1tYQKu3u2Zqcw2 nwp9uZFO7BBj1Z9TDnF4ax/jx0sQdyZY0Jes8jGoq20zYT2huT3aSa6dqt/IsOYZBzHD R3Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1pHPN41hHFv+ZbGuu8jjfM3Gxxyuq3FlEqjuJ/4MteE=; b=VYKmAJjYT0p38b9saV7s4JwwZGo/33rz7byO18b3KsoJa3hOlXRKH2jBgIk+xfC86q urOdy0nG4eemLyHeb3/n/0b/sLkgFNBVlxBAhyXp/4OnGifYNWkYTvghiCqWZZbGtwwk sovQ3pFKpbRyZo/+zHfIHcdW+DuBBhQ/6+jDl90hsOnFF/JENmGKBOT5sb5coDYt7mkF ijcE8iVtNUDJ9E5Ae6sxpvrfNn4A4qsy7CDn2qubmdln9TyU44O/wd1yOg1KFHqwdypv IyF0ueNo8QNIwy+8Nyu4crFtlunBlHCWHzAT5AKlnWtWtIxOxZbWH/O66QkKFxR1vmX3 EW1A== X-Gm-Message-State: AOAM533rxeokGrOUPrqP1bK6tVarXpuXnWnTNyzRgxx+HkfM8t9zUxq3 FouRSmjX7OZBMjFOOwPxKjOs7/G37uC3ssAo0XLrZA== X-Received: by 2002:adf:9dc4:: with SMTP id q4mr5042095wre.367.1610134383860; Fri, 08 Jan 2021 11:33:03 -0800 (PST) MIME-Version: 1.0 References: <20210108025107.1223487-1-baekhw@google.com> <20210108172049.GF4042@zn.tnic> In-Reply-To: <20210108172049.GF4042@zn.tnic> From: "Hyunwook (Wooky) Baek" Date: Fri, 8 Jan 2021 11:32:52 -0800 Message-ID: Subject: Re: [PATCH] x86/sev-es: Fix SEV-ES #VC handler for string port IO To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , David Rientjes , Sean Christopherson , linux-kernel@vger.kernel.org, x86@kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Borisslav, My sincere apologies for it. We actually tested the patch but I made a bad mistake while generating the patch file to email. I will send a PATCH V2 after testing the email version patch file from the scratch. Regards, Wooky On Fri, Jan 8, 2021 at 9:20 AM Borislav Petkov wrote: > > On Thu, Jan 07, 2021 at 06:51:07PM -0800, Hyunwook (Wooky) Baek wrote: > > Don't assume dest/source buffers are userspace addresses when manually > > copying data for string I/O or MOVS MMIO, as {get,put}_user() will fail > > if handed a kernel address and ultimately lead to a kernel panic. > > > > Signed-off-by: Hyunwook (Wooky) Baek > > Acked-by: David Rientjes > > --- > > arch/x86/kernel/sev-es.c | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > > diff --git a/arch/x86/kernel/sev-es.c b/arch/x86/kernel/sev-es.c > > index 0bd1a0fc587e..812494d216ba 100644 > > --- a/arch/x86/kernel/sev-es.c > > +++ b/arch/x86/kernel/sev-es.c > > @@ -286,6 +286,12 @@ static enum es_result vc_write_mem(struct es_em_ctxt *ctxt, > > u16 d2; > > u8 d1; > > > > + /* If instruction ran in kernel mode and the I/O buffer is in kernel space */ > > + if (!user_mode(ctxt->regs) && !access_ok(s, size)) { > ^^^ > > Just by looking at this patch I know you haven't tested it before sending. > > :-( > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette