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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <B4C5F8DE-5337-47F1-AD59-93B375A323C2@vmware.com>
Date:   Thu, 10 Jan 2019 00:16:34 +0000
From:   Nadav Amit <namit@...are.com>
To:     Josh Poimboeuf <jpoimboe@...hat.com>
CC:     X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
        Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        Andy Lutomirski <luto@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Jason Baron <jbaron@...mai.com>, Jiri Kosina <jkosina@...e.cz>,
        David Laight <David.Laight@...LAB.COM>,
        Borislav Petkov <bp@...en8.de>,
        Julia Cartwright <julia@...com>, Jessica Yu <jeyu@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Edward Cree <ecree@...arflare.com>,
        Daniel Bristot de Oliveira <bristot@...hat.com>
Subject: Re: [PATCH v3 3/6] x86/static_call: Add out-of-line static call
 implementation

> On Jan 9, 2019, at 2:59 PM, Josh Poimboeuf <jpoimboe@...hat.com> wrote:
> 

<snip>

> +
> +void __ref arch_static_call_transform(void *site, void *tramp, void *func)
> +{
> +	s32 dest_relative;
> +	unsigned char opcode;
> +	void *(*poker)(void *, const void *, size_t);
> +	void *insn = tramp;
> +
> +	mutex_lock(&text_mutex);
> +
> +	/*
> +	 * For x86-64, a 32-bit cross-modifying write to a call destination is
> +	 * safe as long as it's within a cache line.
> +	 */
> +	opcode = *(unsigned char *)insn;
> +	if (opcode != 0xe8 && opcode != 0xe9) {
> +		WARN_ONCE(1, "unexpected static call insn opcode 0x%x at %pS",
> +			  opcode, insn);
> +		goto done;
> +	}
> +
> +	dest_relative = (long)(func) - (long)(insn + CALL_INSN_SIZE);
> +
> +	poker = early_boot_irqs_disabled ? text_poke_early : text_poke;
> +	poker(insn + 1, &dest_relative, sizeof(dest_relative));
> +
> +done:
> +	mutex_unlock(&text_mutex);
> +}
> +EXPORT_SYMBOL_GPL(arch_static_call_transform);

Err… I was rewriting __jump_label_transform(), so if this code duplication can
be avoided, this would be great.

(See https://lkml.org/lkml/2018/11/14/72 )

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ