lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3245cf5e-b21b-634e-a9d7-a63d55145c33@citrix.com>
Date:   Tue, 7 Apr 2020 21:21:31 +0100
From:   Andrew Cooper <andrew.cooper3@...rix.com>
To:     Peter Zijlstra <peterz@...radead.org>
CC:     <tglx@...utronix.de>, <linux-kernel@...r.kernel.org>,
        <hch@...radead.org>, <sean.j.christopherson@...el.com>,
        <mingo@...hat.com>, <bp@...en8.de>, <hpa@...or.com>,
        <x86@...nel.org>, <kenny@...ix.com>, <jeyu@...nel.org>,
        <rasmus.villemoes@...vas.dk>, <pbonzini@...hat.com>,
        <fenghua.yu@...el.com>, <xiaoyao.li@...el.com>,
        <nadav.amit@...il.com>, <thellstrom@...are.com>,
        <tony.luck@...el.com>, <rostedt@...dmis.org>,
        <gregkh@...uxfoundation.org>, <jannh@...gle.com>,
        <keescook@...omium.org>, <David.Laight@...lab.com>,
        <dcovelli@...are.com>, <mhiramat@...nel.org>
Subject: Re: [PATCH 0/4] x86/module: Out-of-tree module decode and sanitize

On 07/04/2020 20:41, Peter Zijlstra wrote:
> On Tue, Apr 07, 2020 at 06:23:27PM +0100, Andrew Cooper wrote:
>> On 07/04/2020 12:02, Peter Zijlstra wrote:
>>> Hi all,
>>>
>>> Driven by the SLD vs VMX interaction, here are some patches that provide means
>>> to analyze the text of out-of-tree modules.
>>>
>>> The first user of that is refusing to load modules on VMX-SLD conflicts, but it
>>> also has a second patch that refulses to load any module that tries to modify
>>> CRn/DRn.
>>>
>>> I'm thinking people will quickly come up with more and more elaborate tests to
>>> which to subject out-of-tree modules.
>> Anything playing with LGDT & friends?  Shouldn't be substantially more
>> elaborate than CR/DR to check for.
> More friends? (I wasn't sure on the Sxxx instructions, they appear
> harmless, but what do I know..)
>
> I was also eyeing LSL LTR LSS, none of which I figured a module has any
> business of using. Are there more?
>
> --- a/arch/x86/kernel/module.c
> +++ b/arch/x86/kernel/module.c
> @@ -282,6 +282,50 @@ static bool insn_is_mov_DRn(struct insn
>  	return false;
>  }
>  
> +static bool insn_is_LxDT(struct insn *insn)
> +{
> +	u8 modrm = insn->modrm.bytes[0];
> +	u8 modrm_mod = X86_MODRM_MOD(modrm);
> +	u8 modrm_reg = X86_MODRM_REG(modrm);
> +
> +	if (insn->opcode.bytes[0] != 0x0f)
> +		return false;
> +
> +	switch (insn->opcode.bytes[1]) {
> +	case 0x00:
> +		if (modrm_mod != 0x03)
> +			break;
> +

Apologies - missed this before.  LLDT and LTR can be encoded with a
memory operand, so you need to drop the modrm_mod check to spot all
instances.

~Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ