Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1613113yba; Thu, 4 Apr 2019 14:27:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4qyM0EVnQmREwtycpRprTuGzKND/U2G+aql+n5z/VDPK7tekbMT/I9tXKErskwM8VBZFU X-Received: by 2002:aa7:92c4:: with SMTP id k4mr8342407pfa.183.1554413277127; Thu, 04 Apr 2019 14:27:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554413277; cv=none; d=google.com; s=arc-20160816; b=EmN4RVlBNSFHE89tUwmz+dH83vxS9ONmomFmucXpsl0cjNZgNql1XLSYxFntkNJzek 50zQGr0wETSXtC3jPd7H6xTn9NG1V5Z+Fn8PBniObZMoeQ0FvcS1gkB+1XvjhBgFXGr7 bDG2sUwxDsyexFCww4hEV8+BZzMZ1eJsjA2t2IKHUbzEIiyoNgbCvdAPATWb2vhIzIcg snqeuvrRXHOVpvV5hLA/sbf+/S8rXfsOwc8pYMvKEIffpJ/nppallAepXx4n6PU0cvCE TLBcCtpSdudKbf7ZVNyoR6BSxfoQ6FahJBsOBZi6zW7DmO6HYd8mcrG1YTimWBXMzQu/ ZqRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=DY8YS7XX12dpTjks6ywbJuHtvWmcDkCE2mEQA8qN5fQ=; b=MCD0axWOn+LajCxvxMLVxymMuB3HoHrfTq8t7VeggG3YBDlVR6DlxgYmvZRh/fSW78 c+2ic4ufjrZQ3t5GGt+0fiJ3iqFYOiE7SA5lQboRKDqQDpcZkgevIF1wJo/rjyjSXzxQ cy5LIMnwyKsf3Vy+KYqxSDh//v55zHg44GCjyLI7U1zgUeS9lvxDVrBpJqWIxEWsLNJr Fwi0uNnHgaRacRNoaCqCZa37H36/nR4Xh09Ldyxh7dTCnkxUdKi1wypcfOKRsZnuBOTM UJPaMFTdhM8lGFyunhzDjSbFUVzXukAShRYdb3odWMJHm+9lJ4hQuvPT7xehRWWLyo5h M3lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=n2OZpaJT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id c2si16927332pls.226.2019.04.04.14.27.42; Thu, 04 Apr 2019 14:27:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=n2OZpaJT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1731334AbfDDUzh (ORCPT + 99 others); Thu, 4 Apr 2019 16:55:37 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:44452 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730402AbfDDUzg (ORCPT ); Thu, 4 Apr 2019 16:55:36 -0400 Received: by mail-pf1-f194.google.com with SMTP id y13so1952001pfm.11 for ; Thu, 04 Apr 2019 13:55:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=DY8YS7XX12dpTjks6ywbJuHtvWmcDkCE2mEQA8qN5fQ=; b=n2OZpaJT2RNV9e9mJm5o2W/jHV+FOuBztZUAXAhs/NzG2r2UDzfEKZFDoiFoZCiMl5 E7Hd5chP5xQmzhl6ZrM2ejn/DzUrK1j96ClMdVWFFIUKNzJ5qLiBBckupuAyHaTVvS9L KwKUPEbWtlmxD/ds7iNNlJLYmD1VzYdHFkEj9D5RdAck9ctk8KKJglgGi1/8tE75Nm91 k3LnKSDWxVtfkClZ3YOo563faj5KSu68xr5A0FOFH7OTcUHpfe3SK8EOiGf2+uslgGjv +9DhPrRuI/A6tKg42XKHo+ZslVtU9cW2mAkXAJwYnTuaN/hm9jUSTV0+kw5quhw6zuis 941g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=DY8YS7XX12dpTjks6ywbJuHtvWmcDkCE2mEQA8qN5fQ=; b=VoPGLmJ7pGVEcqbrpWms9pxcyJF7u/bDagPJjV3cTavxh+3FuhaROBXL+S5DJmaDjy rEiGlUcxWFh0Z6XAm5mURVhIFtkiL7rDTH74oxBJwcMJra7fyS/in5LyLoVjZEjbMUvV 56lPRo4FiWIkGiKMWYByFrDVBi41XPxyVBC1usN2RNwDE1L/YlrVXQIqhi1MaeFNKl/T DxtktDKl+EHiSCaS9TQrXKMZRHYDJo6ztCRAx5N2rZy30U0YPSdotwtUD9BG5+05qaJ6 5e+/lpPT9MkF2tdTKBUfD4BT4ae4SZ2fIzxRji+Vzdaa/t1n++OSfqunKvMlZdaN8YP/ 5FHg== X-Gm-Message-State: APjAAAW9t3NE/vZY2erj2LJWMQc0HxeDTUJyyyzykxWtTQCCEdZOkQd3 TZDCTSMpB27ppytSV7sGzuCQzA== X-Received: by 2002:a62:7089:: with SMTP id l131mr8332802pfc.158.1554411335580; Thu, 04 Apr 2019 13:55:35 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id c3sm29433776pfo.2.2019.04.04.13.55.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Apr 2019 13:55:34 -0700 (PDT) Date: Thu, 4 Apr 2019 13:55:34 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: "Singh, Brijesh" cc: Joerg Roedel , Paolo Bonzini , =?UTF-8?Q?Radim_Kr=C4=8Dm=C3=A1=C5=99?= , Borislav Petkov , "x86@kernel.org" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [patch] KVM: SVM: prevent DBG_DECRYPT and DBG_ENCRYPT overflow In-Reply-To: <0ba6d873-6567-f20a-c5c1-59fc2c97968e@amd.com> Message-ID: References: <0ba6d873-6567-f20a-c5c1-59fc2c97968e@amd.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 28 Mar 2019, Singh, Brijesh wrote: > > This ensures that the address and length provided to DBG_DECRYPT and > > DBG_ENCRYPT do not cause an overflow. > > > > At the same time, pass the actual number of pages pinned in memory to > > sev_unpin_memory() as a cleanup. > > > > Reported-by: Cfir Cohen > > Signed-off-by: David Rientjes > > --- > > arch/x86/kvm/svm.c | 12 +++++++++--- > > 1 file changed, 9 insertions(+), 3 deletions(-) > > > > > Reviewed-by: Brijesh Singh > > thanks > Paolo, Radim, I don't see this in kvm.git, is it ready to be staged?