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]
Message-ID: <20231114150627.GDZVOM82VPHDlnD3lF@fat_crate.local>
Date:   Tue, 14 Nov 2023 16:06:27 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Juergen Gross <jgross@...e.com>
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v4 2/5] x86/alternative: add indirect call patching

On Mon, Oct 30, 2023 at 03:25:05PM +0100, Juergen Gross wrote:
> +#ifdef CONFIG_X86_64
> +	/* ff 15 00 00 00 00   call   *0x0(%rip) */
> +	target = *(void **)(instr + a->instrlen + *(s32 *)(instr + 2));
> +#else
> +	/* ff 15 00 00 00 00   call   *0x0 */
> +	target = *(void **)(*(s32 *)(instr + 2));

Yeah, let's document those a bit better. Either with comments above or
as Peter suggests:

	/* Add 2 to skip opcode and ModRM byte: */
	disp32 = *(s32 *)(instr + 2);

	rip_rela_ptr = (void **)(instr + a->instrlen + disp32);
	target = *rip_rela_ptr;

so that it is crystal clear what we're doing here.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ