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
| ||
|
Date: Sun, 7 Jan 2018 12:46:45 +0100 From: Borislav Petkov <bp@...e.de> To: David Woodhouse <dwmw2@...radead.org> Cc: Josh Poimboeuf <jpoimboe@...hat.com>, "tglx@...utronix.de" <tglx@...utronix.de>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "tim.c.chen@...ux.intel.com" <tim.c.chen@...ux.intel.com>, "peterz@...radead.org" <peterz@...radead.org>, "torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>, "ak@...ux.intel.com" <ak@...ux.intel.com>, "riel@...hat.com" <riel@...hat.com>, "keescook@...gle.com" <keescook@...gle.com>, "gnomes@...rguk.ukuu.org.uk" <gnomes@...rguk.ukuu.org.uk>, "pjt@...gle.com" <pjt@...gle.com>, "dave.hansen@...el.com" <dave.hansen@...el.com>, "luto@...capital.net" <luto@...capital.net>, "jikos@...nel.org" <jikos@...nel.org>, "gregkh@...ux-foundation.org" <gregkh@...ux-foundation.org> Subject: Re: [PATCH v3 01/13] x86/retpoline: Add initial retpoline support On Sun, Jan 07, 2018 at 09:40:42AM +0000, David Woodhouse wrote: > Right, so it all tends to work out OK purely by virtue of the fact that > oldinstr and altinstr end up far enough apart in the image that they're > 5-byte jumps. Which isn't perfect but we've lived with worse. Well, the reference point is important. And I don't think we've done more involved things than jumping back to something in .text proper. However, I think I know how to fix this so that arbitrary jump offsets would work but I need to talk to our gcc guys first. If the jump is close enough for 2 bytes, then it should work as long as the offset to the target doesn't change. The main thing recompute_jumps() does is turn 5-byte jumps - which gas creates because the jump target is in .text but the jump itself is in .altinstr_replacement - into 2-byte ones. Because when you copy the jump back into .text, the offset might fit in a signed byte all of a sudden. There are still some nasties with forcing 5-byte jumps but I think I know how to fix those. Stay tuned... > I'm relatively pleased that we've managed to eliminate this as a > dependency for inverting the X86_FEATURE_RETPOLINE logic though, by > following Linus' suggestion to just emit the thunk inline instead of > calling the same one as GCC. > > The other fun one for alternatives is in entry_64.S, where we really > need the return address of the call instruction to be *precisely* the > .Lentry_SYSCALL_64_after_fastpath_call label, so we have to eschew the > normal NOSPEC_CALL there: So CALL, as the doc says, pushes the offset of the *next* insn onto the stack and branches to the target address. So I'm thinking, as long as the next insn doesn't move and gcc doesn't pad anything, you're fine. However, I suspect that I'm missing something else here and I guess I'll have more clue if I look at the whole thing. So can you point me to your current branch so that I can take a look at the code? Thx. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --
Powered by blists - more mailing lists