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]
Date:   Thu, 3 Mar 2022 11:53:44 +0100 (CET)
From:   Miroslav Benes <mbenes@...e.cz>
To:     Peter Zijlstra <peterz@...radead.org>
cc:     x86@...nel.org, joao@...rdrivepizza.com, hjl.tools@...il.com,
        jpoimboe@...hat.com, andrew.cooper3@...rix.com,
        linux-kernel@...r.kernel.org, ndesaulniers@...gle.com,
        keescook@...omium.org, samitolvanen@...gle.com,
        mark.rutland@....com, alyssa.milburn@...el.com,
        rostedt@...dmis.org, mhiramat@...nel.org,
        alexei.starovoitov@...il.com
Subject: Re: [PATCH v2 33/39] objtool: Add IBT/ENDBR decoding

Hi,

On Thu, 24 Feb 2022, Peter Zijlstra wrote:

> Decode ENDBR instructions and WARN about NOTRACK prefixes.

I guess it has been already mentioned somewhere, but could you explain 
NOTRACK prefix here, please? If I understand it right, it disables IBT for 
the indirect branch instruction meaning that its target does not have to 
start with ENDBR? 

> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
>  tools/objtool/arch/x86/decode.c      |   34 +++++++++++++++++++++++++++++-----
>  tools/objtool/include/objtool/arch.h |    1 +
>  2 files changed, 30 insertions(+), 5 deletions(-)
> 
> --- a/tools/objtool/arch/x86/decode.c
> +++ b/tools/objtool/arch/x86/decode.c
> @@ -103,6 +103,18 @@ unsigned long arch_jump_destination(stru
>  #define rm_is_mem(reg)	(mod_is_mem() && !is_RIP() && rm_is(reg))
>  #define rm_is_reg(reg)	(mod_is_reg() && modrm_rm == (reg))
>  
> +static bool has_notrack_prefix(struct insn *insn)
> +{
> +	int i;
> +
> +	for (i = 0; i < insn->prefixes.nbytes; i++) {
> +		if (insn->prefixes.bytes[i] == 0x3e)
> +			return true;
> +	}
> +
> +	return false;
> +}
> +

...

> @@ -636,20 +656,24 @@ int arch_decode_instruction(struct objto
>  		break;
>  
>  	case 0xff:
> -		if (modrm_reg == 2 || modrm_reg == 3)
> +		if (modrm_reg == 2 || modrm_reg == 3) {
>  
>  			*type = INSN_CALL_DYNAMIC;
> +			if (has_notrack_prefix(&insn))
> +				WARN("notrack prefix found at %s:0x%lx", sec->name, offset);
>  
> -		else if (modrm_reg == 4)
> +		} else if (modrm_reg == 4) {
>  
>  			*type = INSN_JUMP_DYNAMIC;
> +			if (has_notrack_prefix(&insn))
> +				WARN("notrack prefix found at %s:0x%lx", sec->name, offset);

And we want to warn about it here so that we can have it all in the kernel 
control?

Miroslav

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ