[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 6/9] x86/vmx: move declations used only by vmx code from vmx.h to private header


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 23 Feb 2023 11:56:46 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PBukA0ASAWupIqjpJxDLVGd9kgtEAcQBaWJu58/XJ6Y=; b=WZvhf7a4jLBYCtF7JdQVwlBpJWARWdFcCw4dlsBF6IKe8t6+iS21LdKlMbxcyrUdKc0ksKAur0rD5HFIXcll/1C9lByMk/GsPo6QwuvEyQHhaIinarkOlbn5jwOC7uSn8zyWjUpvDkKljlejupUd6VrMofgPy/xCSzkmnl6w1dqLrGMjMLlDIk+wGvyKwDYeTyNuA1FWQhMDtQCucjeuo0yjLmZJuh2Gp9bUESGiyWyPlGy0TKd6vvdWtHhxjpiLioi+EbubGrt+brH9mBIgnP7c5Z3CDvoTfGAR6SaiE+dRxzIesp2D2zu+YTyYaKPAmAD4ASvY0u8TsnUAr9FjJQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AEO6A36CM1PjsZjdoHZjYVfKwmwt86Mh8hRt9QA1t+eqwzna9HurPcPqLKf64dCSHWMqqtGlEvH6GSDUW8uQvqwr9a8Q1UtY3f/Vi5GlJzK0zQF+mla0bYIfVRl32eoniet9hxwzGeRFPRhoUonO284A1gv1gK/iu2LciPga0abM55XuRVV5lkgZrb5VS7169/G8x9OnWz8KETnxOnxsv7RSanDmYTm13VgyzK64vZdLyxONQRlOF/3j6hQFRIsKTvuN0HQDfbmbrDJzwTRmq66VY8MWob3T590eWD7BS0EDTGA30qiykz8Nbjfb9gkdkmX9kfANdYJRXQlkWeDE5Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 23 Feb 2023 11:57:22 +0000
  • Ironport-data: A9a23:0AJu9qOnoqgS8KDvrR1LlsFynXyQoLVcMsEvi/4bfWQNrUok1GBUn DNMC27VPquOamGkKd1yOt60oBkEsJWHm9dlTAto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQAOKnUoYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9Suv3rRC9H5qyo42tC5AdmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0vRbM3lv8 OFIEToyczHdvP6EnJbiSeY506zPLOGzVG8ekldJ6GiDSNMZG9XESaiM4sJE1jAtgMwIBezZe 8cSdTtoalLHfgFLPVAUTpk5mY9EhFGmK2Ee9A3T+/RxvzW7IA9ZidABNPL8fNCQSNoTtUGfv m/cpEzyAw0ANczZwj2Amp6prr6fw3qkCdlKfFG+3udykUbQyG49MiEfCUubruWCuBS9CvsKf iT4/QJr98De7neDTNPwQhm5q36spQMHVpxbFOhSwAuQ0Ljd5wGVAXcNZjFEYd0i8sQxQFQC1 EKP2dXgBjVtsbicYXOb6rqQ6zi1PEA9LmIcZClCUQoM5fHipp0+ilTESdMLOLGxps34H3f32 T/ihDgzgfAfgNAG042//EvbmHS8q57RVAk36w7LGGW/4WtEiJWNYoWp7R3e8qxGJYPAFF2Z5 iBYxo6Z8fwECoyLmGqVWuIREbq15vGDdjrBnVpoGJpn/DOok5K+Qb1tDPhFDB8BGq45lfXBO Sc/ZSs5CEdvAUaX
  • Ironport-hdrordr: A9a23:/5PGrKNfvRSiMcBcTgWjsMiBIKoaSvp037BK7S1MoH1uA6mlfq WV9sjzuiWatN98Yh8dcLO7Scu9qBHnlaKdiLN5VduftWHd01dAR7sSjrcKrQeAJ8X/nNQtr5 uJccJFeaDN5Y4Rt7eH3OG6eexQv+Vu6MqT9IPjJ+8Gd3ATV0lnhT0JbTqzIwlNayRtI4E2L5 aY7tovnUvaRZxGBv7LYEXsRoL41qT2qK4=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 23/02/2023 10:47 am, Jan Beulich wrote:
> On 22.02.2023 13:00, Xenia Ragiadakou wrote:
>> --- /dev/null
>> +++ b/xen/arch/x86/hvm/vmx/vmx.h
>> @@ -0,0 +1,459 @@
>> +#include <xen/sched.h>

Like svm.h, SPDX tag and guards please.

>
>> +extern int8_t opt_ept_exec_sp;
>> +
>> +#define PI_xAPIC_NDST_MASK      0xFF00
>> +
>> +void vmx_asm_vmexit_handler(struct cpu_user_regs);
> Even if it was like this originally, this is bogus. This not-really-a-
> function doesn't take any parameters. It's declaration also looks to be
> missing cf_check - Andrew, was this deliberate?

Yes, it's deliberate.  As you identified, it's never called, and
therefore doesn't undergo any CFI typechecking.

It's an address written into the VMCS's HOST_RIP field, which also
explains why it has a bogus type and no-one's noticed in 18 years.  (Yup
really - c/s 9c3118a825, December 2004)


But it does bring us back to a general question which has come up a
couple of times recently - how to represent asm symbols in C.

This ought to be

void nocall vmx_asm_vmexit_handler(void);

to identify that it is a function-like thing without a normal calling
convention.  IMO i could live in vmcs.c rather than being declared publicly.

I see nothing in MISRA that objects to this.  Rule 8.5 states that an
external object or function shall be declared once, and only in one
file.  There is no mandate that this single file is a header file.

The point of moving this to a .c file is to indicate that the asm symbol
isn't legitimate to reference anywhere else.


Such a change probably wants backporting.  Let me do a specific fix, to
separate it from the cleanup.

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.