-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CFI violations due to run_on_irqstack_cond #1052
Comments
It looks like there are also other mismatching function pointers passed to |
This will be a problem in mainline now: https://git.kernel.org/torvalds/c/076f14be7fc942e112c94c841baec44124275cd0 |
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
run_on_irqstack_cond casts callback functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) checking. Link: ClangBuiltLinux#1052 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Thomas posted a patch that fixes the type mismatch: https://lore.kernel.org/lkml/87pn6eb5tv.fsf@nanos.tec.linutronix.de/ |
Sami reported that run_on_irqstack_cond() requires the caller to cast functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) in Clang. Instead of disabling CFI on that function, provide proper helpers for the three call variants. The actual ASM code stays the same as that is out of reach. [ bp: Fix __run_on_irqstack() prototype to match. ] Fixes: 931b941 ("x86/entry: Provide helpers for executing on the irqstack") Reported-by: Nathan Chancellor <natechancellor@gmail.com> Reported-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Tested-by: Sami Tolvanen <samitolvanen@google.com> Cc: <stable@vger.kernel.org> Link: ClangBuiltLinux#1052 Link: https://lkml.kernel.org/r/87pn6eb5tv.fsf@nanos.tec.linutronix.de
Sami reported that run_on_irqstack_cond() requires the caller to cast functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) in Clang. Instead of disabling CFI on that function, provide proper helpers for the three call variants. The actual ASM code stays the same as that is out of reach. [ bp: Fix __run_on_irqstack() prototype to match. ] Fixes: 931b941 ("x86/entry: Provide helpers for executing on the irqstack") Reported-by: Nathan Chancellor <natechancellor@gmail.com> Reported-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Tested-by: Sami Tolvanen <samitolvanen@google.com> Cc: <stable@vger.kernel.org> Link: ClangBuiltLinux#1052 Link: https://lkml.kernel.org/r/87pn6eb5tv.fsf@nanos.tec.linutronix.de
Sami reported that run_on_irqstack_cond() requires the caller to cast functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) in Clang. Instead of disabling CFI on that function, provide proper helpers for the three call variants. The actual ASM code stays the same as that is out of reach. [ bp: Fix __run_on_irqstack() prototype to match. ] Fixes: 931b941 ("x86/entry: Provide helpers for executing on the irqstack") Reported-by: Nathan Chancellor <natechancellor@gmail.com> Reported-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Tested-by: Sami Tolvanen <samitolvanen@google.com> Cc: <stable@vger.kernel.org> Link: ClangBuiltLinux#1052 Link: https://lkml.kernel.org/r/87pn6eb5tv.fsf@nanos.tec.linutronix.de
Sami reported that run_on_irqstack_cond() requires the caller to cast functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) in Clang. Instead of disabling CFI on that function, provide proper helpers for the three call variants. The actual ASM code stays the same as that is out of reach. [ bp: Fix __run_on_irqstack() prototype to match. ] Fixes: 931b941 ("x86/entry: Provide helpers for executing on the irqstack") Reported-by: Nathan Chancellor <natechancellor@gmail.com> Reported-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Tested-by: Sami Tolvanen <samitolvanen@google.com> Cc: <stable@vger.kernel.org> Link: ClangBuiltLinux#1052 Link: https://lkml.kernel.org/r/87pn6eb5tv.fsf@nanos.tec.linutronix.de
commit a7b3474 upstream. Sami reported that run_on_irqstack_cond() requires the caller to cast functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) in Clang. Instead of disabling CFI on that function, provide proper helpers for the three call variants. The actual ASM code stays the same as that is out of reach. [ bp: Fix __run_on_irqstack() prototype to match. ] Fixes: 931b941 ("x86/entry: Provide helpers for executing on the irqstack") Reported-by: Nathan Chancellor <natechancellor@gmail.com> Reported-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Tested-by: Sami Tolvanen <samitolvanen@google.com> Cc: <stable@vger.kernel.org> Link: ClangBuiltLinux/linux#1052 Link: https://lkml.kernel.org/r/87pn6eb5tv.fsf@nanos.tec.linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
BugLink: https://bugs.launchpad.net/bugs/1898076 commit a7b3474 upstream. Sami reported that run_on_irqstack_cond() requires the caller to cast functions to mismatching types, which trips indirect call Control-Flow Integrity (CFI) in Clang. Instead of disabling CFI on that function, provide proper helpers for the three call variants. The actual ASM code stays the same as that is out of reach. [ bp: Fix __run_on_irqstack() prototype to match. ] Fixes: 931b941 ("x86/entry: Provide helpers for executing on the irqstack") Reported-by: Nathan Chancellor <natechancellor@gmail.com> Reported-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Tested-by: Sami Tolvanen <samitolvanen@google.com> Cc: <stable@vger.kernel.org> Link: ClangBuiltLinux#1052 Link: https://lkml.kernel.org/r/87pn6eb5tv.fsf@nanos.tec.linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Fixed in v5.9-rc7: https://git.kernel.org/linus/a7b3474cbb2864d5500d5e4f48dd57c903975cab |
When building a linux-next kernel and booting it in WSL2, I see the following problem in dmesg:
From what I can tell, that is fixed with this diff (although I highly doubt this is correct):
Once I patch that up and disable
FTRACE
, I see the following trace occasionally, which I believe is the same issue:From what I can tell,
run_on_irqstack_cond
(introduced by https://git.kernel.org/tip/931b94145981e411bd2c934657649347ba8a9083) casts whatever function is passed to it tovoid (*__func)(void *arg)
and just calls that, which I assume what causes everything to explode... I have no idea how to untangle that, hence this issue.cc @kees @samitolvanen
The text was updated successfully, but these errors were encountered: