Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3856844yba; Mon, 29 Apr 2019 09:37:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVkms+9xymGfpHbpuZJf3o3dG5mQX4fIjRVKgjbGZneX2DYJDyzZo/fdThU6FfzzVwjh5Q X-Received: by 2002:a65:5304:: with SMTP id m4mr35513825pgq.281.1556555834474; Mon, 29 Apr 2019 09:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556555834; cv=none; d=google.com; s=arc-20160816; b=tk+sy60VmLN4sGOpjU/t7v+4n3QpgmewFjxOLbV211Gcik4v+aRwSCFUg7F7yaHG4e vpUWLRqFkqgGLW7jQfhg6qgv4cgUiA0gngG4QiTyehpFXR05NbeKq7cyxUC6LnLOSbF2 pXlfNFrUjw5i085iG0d0qxH0ywICrV8ayXLqQgeU09TGHQpcFp8cxQS+HPVbqJ5MJLaT I0cvd8MupLwRQ8w0V9V5WYTTZXFfQuguEqh8Upnc9VbJQoKEbCPwgreTk9ezCGvga+Fr rDs689U48Y/wgPO1sTbSOPkGWKNr4npWngA89xRRPJNvEEXhJizNDdHUvIxqsJytoww0 PyGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fismiO90X9ow0flqEFvKG4xZhSvKMbYdUPumKyUhM9Q=; b=rhjx18TzQ1fWHRvO2kfqU4SAV8fSi9vmOo106VzTenf9IAD9CNPQ/IlV5S4aa/5y4u 4oYMFJNLD52Egk5A/QJHnmzNBS2xIICZN5CgZJuEAd8ccQQ1a/XsJzXbwkeDGMPHbxgc vPioh/TP8rkb7YLPAdRo/KTVTQWJ4efsgc+aZtm9JFJc1INv2jv8W15RiS5bRRD6DgaN gQBgw2ofIe0IEBaBT88x0+KMzjj6ZVIFS57sXusSyqxf+L6LK3bk7PSKBF/M2sSul7XM y8dU74moDPWvVufr6eDKreD+UEU1hMhtYdi6BoFnZjBzArlNAhTYpp+P67NwAOha8xPW yARw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=HIYiXKVA; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9si33030096pls.323.2019.04.29.09.36.58; Mon, 29 Apr 2019 09:37:14 -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=@alien8.de header.s=dkim header.b=HIYiXKVA; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728666AbfD2QgG (ORCPT + 99 others); Mon, 29 Apr 2019 12:36:06 -0400 Received: from mail.skyhub.de ([5.9.137.197]:38380 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728520AbfD2QgF (ORCPT ); Mon, 29 Apr 2019 12:36:05 -0400 Received: from zn.tnic (p200300EC2F073600329C23FFFEA6A903.dip0.t-ipconnect.de [IPv6:2003:ec:2f07:3600:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id B87D01EC027B; Mon, 29 Apr 2019 18:36:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1556555763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=fismiO90X9ow0flqEFvKG4xZhSvKMbYdUPumKyUhM9Q=; b=HIYiXKVApvDpTbHt+PlhAFHoIKD7hjuzVMbirqjxzgyuu3MmYXciLwQeByWfBXIi8n7ZGG JmqEiMLFwgc5z7qaUypuJWTpYU3D/FWlSEOzl2WFSZfumc32qPYes0/yxrryhUSKtuex8Y eN+dlETiFUgSwoU/eKGsdygENq9nAQY= Date: Mon, 29 Apr 2019 18:36:02 +0200 From: Borislav Petkov To: "Singh, Brijesh" Cc: "kvm@vger.kernel.org" , "qemu-devel@nongnu.org" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Joerg Roedel , "Lendacky, Thomas" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [RFC PATCH v1 01/10] KVM: SVM: Add KVM_SEV SEND_START command Message-ID: <20190429163602.GE2324@zn.tnic> References: <20190424160942.13567-1-brijesh.singh@amd.com> <20190424160942.13567-2-brijesh.singh@amd.com> <20190426141042.GF4608@zn.tnic> <20190426204327.GM4608@zn.tnic> <2b63d983-a622-3bec-e6ac-abfd024e19c0@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2b63d983-a622-3bec-e6ac-abfd024e19c0@amd.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 29, 2019 at 03:01:24PM +0000, Singh, Brijesh wrote: > Practically I don't see any reason why caller would do that but > theoretically it can. If we cache the len then we also need to consider > adding another flag to hint whether userspace ever requested length. > e.g an application can compute the length of session blob by looking at > the API version and spec and may never query the length. > > > I mean I'm still thinking defensively here but maybe the only thing that > > would happen here with a bigger buffer is if the kmalloc() would fail, > > leading to eventual failure of the migration. > > > > If the code limits the allocation to some sane max length, the migration > > won't fail even if userspace gives it too big values... So what about this? Limiting to a sane length... -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.