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: <20231019143951.GEZTE/t/wECKBxMSjl@fat_crate.local>
Date:   Thu, 19 Oct 2023 16:39:51 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     "Kaplan, David" <David.Kaplan@....com>
Cc:     Josh Poimboeuf <jpoimboe@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-tip-commits@...r.kernel.org" 
        <linux-tip-commits@...r.kernel.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        "x86@...nel.org" <x86@...nel.org>,
        David Howells <dhowells@...hat.com>
Subject: Re: [tip: x86/bugs] x86/retpoline: Ensure default return thunk isn't
 used at runtime

On Thu, Oct 19, 2023 at 02:21:40PM +0000, Kaplan, David wrote:
> The return thunk is used for all functions though, including assembly
> coded functions which may use non-standard calling conventions and
> aren't visible to gcc.  I think the only safe thing would be to
> preserve all GPRs across the call to check_thunks.  Something like
> PUSH_REGS/call check_thunks/POP_REGS.

That call nop will be inside the return thunk. I.e., something like
this:

SYM_CODE_START(__x86_return_thunk)
        UNWIND_HINT_FUNC
        ANNOTATE_NOENDBR
        ANNOTATE_UNRET_SAFE
	ALTERNATIVE CALL nop, check_thunks, X86_FEATURE_ALWAYS
	ret
	int3
SYM_CODE_END(__x86_return_thunk)
EXPORT_SYMBOL(__x86_return_thunk)

I suspect that gcc doesn't know that there is a function call in the asm
there, which is also what you hint at - I need to ask a compiler guy.

But yeah, if it doesn't, then we'll need to push/pop regs as you
suggest.

-- 
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