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:   Mon, 15 Mar 2021 17:23:03 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     x86@...nel.org
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH] x86/alternatives: Optimize optimize_nops()

On Mon, Mar 15, 2021 at 04:45:24PM +0100, Peter Zijlstra wrote:
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -345,19 +345,39 @@ recompute_jump(struct alt_instr *a, u8 *
>  static void __init_or_module noinline optimize_nops(struct alt_instr *a, u8 *instr)
>  {
>  	unsigned long flags;
> +	int nops = 0, i = 0;
> +	struct insn insn;
> +	u8 *nop = NULL;
> +
> +	do {
> +		kernel_insn_init(&insn, &instr[i], MAX_INSN_SIZE);
> +		insn_get_length(&insn);
> +

I suppose you'd like to see that replaced with something like this,
rite?


--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -350,8 +350,8 @@ static void __init_or_module noinline op
 	u8 *nop = NULL;
 
 	do {
-		kernel_insn_init(&insn, &instr[i], MAX_INSN_SIZE);
-		insn_get_length(&insn);
+		if (insn_decode(&insn, &instr[i], MAX_INSN_SIZE, INSN_MODE_KERN))
+			return;
 
 		if (insn.length == 1 && insn.opcode.bytes[0] == 0x90) {
 			if (!nop) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ