RE: [patch v2 1/2] x86,module: Detect VMX modules and disable Split-Lock-Detect

From: David Laight
Date: Fri Apr 03 2020 - 04:09:11 EST


From: Peter Zijlstra
> Sent: 02 April 2020 16:24
>
> I picked VMXOFF (which also appears in vmmon.ko) instead of VMXON
> because that latter takes an argument is therefore more difficult to
> decode.
...
> + while (text < text_end) {
> + kernel_insn_init(&insn, text, text_end - text);
> + insn_get_length(&insn);
> +
> + if (WARN_ON_ONCE(!insn_complete(&insn)))
> + break;
> +
> + if (insn.length == 3 &&
> + (!memcmp(text, vmlaunch, sizeof(vmlaunch)) ||
> + !memcmp(text, vmxoff, sizeof(vmxoff))))
> + goto bad_module;
> +
> + text += insn.length;
> + }

How long is that going to take on a module with (say) 400k of text?

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)