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] [day] [month] [year] [list]
Message-ID: <C187B3AC-2582-4B07-8735-7F11B887F008@zytor.com>
Date: Fri, 22 Aug 2025 15:12:55 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Peter Zijlstra <peterz@...radead.org>,
        Marcos Del Sol Vives <marcos@...a.pet>
CC: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
        Brian Gerst <brgerst@...il.com>, Uros Bizjak <ubizjak@...il.com>,
        Ard Biesheuvel <ardb@...nel.org>, David Kaplan <david.kaplan@....com>,
        "Ahmed S. Darwish" <darwi@...utronix.de>, Kees Cook <kees@...nel.org>,
        Andrew Cooper <andrew.cooper3@...rix.com>,
        Oleg Nesterov <oleg@...hat.com>, "Xin Li (Intel)" <xin@...or.com>,
        Sabyrzhan Tasbolatov <snovitoll@...il.com>
Subject: Re: [PATCH] x86: add hintable NOPs emulation

On August 21, 2025 5:48:04 AM PDT, Peter Zijlstra <peterz@...radead.org> wrote:
>On Wed, Aug 20, 2025 at 03:34:46AM +0200, Marcos Del Sol Vives wrote:
>> +static bool handle_hnop(struct pt_regs *regs)
>> +{
>> +	struct thread_struct *t = &current->thread;
>> +	unsigned char buf[MAX_INSN_SIZE];
>> +	unsigned long nr_copied;
>> +	struct insn insn;
>> +
>> +	nr_copied = insn_fetch_from_user(regs, buf);
>> +	if (nr_copied <= 0)
>> +		return false;
>> +
>> +	if (!insn_decode_from_regs(&insn, regs, buf, nr_copied))
>> +		return false;
>> +
>> +	/* Hintable NOPs cover 0F 18 to 0F 1F */
>> +	if (insn.opcode.bytes[0] != 0x0F ||
>> +		insn.opcode.bytes[1] < 0x18 || insn.opcode.bytes[1] > 0x1F)
>> +		return false;
>
>FWIW, you need to check for insn.opcode.nbytes == 2.
>
>> +	if (!t->hnop_warn) {
>> +		pr_warn_ratelimited("%s[%d] emulating hintable NOP, ip:%lx\n",
>> +		       current->comm, task_pid_nr(current), regs->ip);
>> +		t->hnop_warn = 1;
>> +	}
>> +
>> +	regs->ip += insn.length;
>> +	return true;
>> +}

No, hintable noops apply to any modr/m.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ