From patchwork Wed Jan 8 15:07:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11323885 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 428561395 for ; Wed, 8 Jan 2020 15:08:45 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27BA220692 for ; Wed, 8 Jan 2020 15:08:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27BA220692 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipCvc-0001bf-9Q; Wed, 08 Jan 2020 15:07:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipCva-0001bW-9K for xen-devel@lists.xenproject.org; Wed, 08 Jan 2020 15:07:22 +0000 X-Inumbo-ID: 8cd49be4-3228-11ea-a38f-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8cd49be4-3228-11ea-a38f-bc764e2007e4; Wed, 08 Jan 2020 15:07:13 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D733BADE0; Wed, 8 Jan 2020 15:07:12 +0000 (UTC) To: "xen-devel@lists.xenproject.org" From: Jan Beulich Message-ID: <223c0294-f769-22fb-5958-e4ede84241af@suse.com> Date: Wed, 8 Jan 2020 16:07:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 Content-Language: en-US Subject: [Xen-devel] [PATCH] x86/MCE: correct struct mcinfo_extended for compat guests X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The use of any kind of pointers in the public interface is wrong, including dimensioning arrays based on the size of pointers. The least bad option of addressing the issue looks to be to pin down the number that the (64-bit) hypervisor has used anyway (even when passing information to compat but privileged guests). There aren't actual instantiations of the structure apart from ones allocated dynamically out of struct mc_info's mi_data[], which is entirely controlled by the hypervisor. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- a/xen/include/public/arch-x86/xen-mca.h +++ b/xen/include/public/arch-x86/xen-mca.h @@ -170,9 +170,9 @@ struct mcinfo_extended { /* * Currently Intel extended MSR (32/64) include all gp registers * and E(R)FLAGS, E(R)IP, E(R)MISC, up to 11/19 of them might be - * useful at present. So expand this array to 16/32 to leave room. + * useful at present. So expand this array to 32 to leave room. */ - struct mcinfo_msr mc_msr[sizeof(void *) * 4]; + struct mcinfo_msr mc_msr[32]; }; /* Recovery Action flags. Giving recovery result information to DOM0 */