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:   Tue, 6 Sep 2022 21:59:18 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Li Zhong <floridsleeves@...il.com>
Cc:     linux-kernel@...r.kernel.org, peterz@...radead.org,
        jpoimboe@...nel.org, jbaron@...mai.com, ardb@...nel.org,
        tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
        dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com
Subject: Re: [PATCH v1] arch/x86/kernel: check the return value of
 insn_decode_kernel()

On Fri,  2 Sep 2022 00:47:06 -0700
Li Zhong <floridsleeves@...il.com> wrote:

> @@ -20,9 +20,10 @@
>  int arch_jump_entry_size(struct jump_entry *entry)
>  {
>  	struct insn insn = {};
> +	int ret;
>  
> -	insn_decode_kernel(&insn, (void *)jump_entry_code(entry));
> -	BUG_ON(insn.length != 2 && insn.length != 5);
> +	ret = insn_decode_kernel(&insn, (void *)jump_entry_code(entry));

It's highly unlikely that length will be 2 or 5 if ret is not zero (as it
is initialized to zero going into this function).

> +	BUG_ON(ret < 0 || insn.length != 2 && insn.length != 5);

In any case, you need parenthesis around the && condition.

-- Steve


>  
>  	return insn.length;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ