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

Re: [PATCH v1.1 60/65] x86/emul: Update emulation stubs to be CET-IBT compatible


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 3 Dec 2021 14:39:46 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=hlb2C9KX4/QLshera0eJldEU/BNffZR+O7olz5J/0EE=; b=gTSYotlCeXNW1rYJLI3gO6jXzn5fnbIp/tA1cIn3JeU6KBptuWZavixTp26ZqowuTZuuhSbMjAJoyixvLLaV+3k8IsRpBDgsp2AbALcvURkH3yvXMStQMFZvQlDbpeNpADQpq7FCauHzNY7k2tBtlqpoafwTOkddStJS1YrvCyuAjiME8cH6ljZ7kRaA3pxm7he6yaUDQhDvAWFjGzoDF1vHDqIfVz96JKSB2Mj95s5Z9B1agrGbLFu+vQOeP5O5ljlzlJ3yGvX+OYp+ncnGk2NSE0of7QTv0D/ja9DHS41quEOXTp9pJslzg1fXFX45mHPdoD+aMUD+s1ZT64pmrw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iseIm7/ybvP/4QRtccxY0XQ7iselk8p75xPB+YmhGQrbPYkhWlHCnKu1u8RZDhtkDIZg9jQrHKpx1llRqX6xBlpu/JDGaofdMHkGClOk4OIzNiK+VL5KsHE0yCZZU0egTOTPx1VppJo2xjmFEZUZtlI8CohImMLP3PNPyITuU2rZ678OQ5IPpiEvmKj4FzLQQ0JJ3DT6PnTyimNUvqN37Q81+bcr3ZXhL622JocSV4DnnU4Jt2CNGhGovjV9e1Khwjh+LjHafAFKH5ynaqUO5YlOBRd9UyGiUb72h7LJ651ovzH55Urwk6Xhv0cn+k+PMoZKEfJkG+tfTPVJDuYWpw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 03 Dec 2021 13:40:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.11.2021 17:37, Andrew Cooper wrote:
> --- a/xen/arch/x86/extable.c
> +++ b/xen/arch/x86/extable.c
> @@ -129,19 +129,23 @@ search_exception_table(const struct cpu_user_regs *regs)
>  static int __init cf_check stub_selftest(void)
>  {
>      static const struct {
> -        uint8_t opc[4];
> +        uint8_t opc[8];
>          uint64_t rax;
>          union stub_exception_token res;
>      } tests[] __initconst = {
> -        { .opc = { 0x0f, 0xb9, 0xc3, 0xc3 }, /* ud1 */
> +        { .opc = { 0xf3, 0x0f, 0x1e, 0xfa,   /* endbr64 */
> +                   0x0f, 0xb9, 0xc3, 0xc3 }, /* ud1 */
>            .res.fields.trapnr = TRAP_invalid_op },
> -        { .opc = { 0x90, 0x02, 0x00, 0xc3 }, /* nop; add (%rax),%al */
> +        { .opc = { 0xf3, 0x0f, 0x1e, 0xfa,   /* endbr64 */
> +                   0x90, 0x02, 0x00, 0xc3 }, /* nop; add (%rax),%al */
>            .rax = 0x0123456789abcdef,
>            .res.fields.trapnr = TRAP_gp_fault },
> -        { .opc = { 0x02, 0x04, 0x04, 0xc3 }, /* add (%rsp,%rax),%al */
> +        { .opc = { 0xf3, 0x0f, 0x1e, 0xfa,   /* endbr64 */
> +                   0x02, 0x04, 0x04, 0xc3 }, /* add (%rsp,%rax),%al */
>            .rax = 0xfedcba9876543210,
>            .res.fields.trapnr = TRAP_stack_error },
> -        { .opc = { 0xcc, 0xc3, 0xc3, 0xc3 }, /* int3 */
> +        { .opc = { 0xf3, 0x0f, 0x1e, 0xfa,   /* endbr64 */
> +                   0xcc, 0xc3, 0xc3, 0xc3 }, /* int3 */
>            .res.fields.trapnr = TRAP_int3 },
>      };

Instead of the recurring hex values followed by the /* endbr64 */ comment,
how about having a local #define for this? Preferably with such a change
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan




 


Rackspace

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