|
[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
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |