Re: [PATCH 1/3] powerpc: Properly return error code from do_patch_instruction()
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2020-04-24 18:32:25
On Fri, 24 Apr 2020 23:37:06 +0530 "Naveen N. Rao" [off-list ref] wrote:
quoted
quoted
Le 23/04/2020 à 17:09, Naveen N. Rao a écrit :quoted
With STRICT_KERNEL_RWX, we are currently ignoring return value from __patch_instruction() in do_patch_instruction(), resulting in the error not being propagated back. Fix the same.Good patch. Be aware that there is ongoing work which tend to wanting to replace error reporting by BUG_ON() . See https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=166003Thanks for the reference. I still believe that WARN_ON() should be used in 99% of the cases, including here. And only do a BUG_ON() when you know there's no recovering from it.I'm not sure if you meant that we should have a WARN_ON() in patch_instruction(), or if it was about the users of patch_instruction(). As you're well aware, ftrace likes to do its own WARN_ON() if any of its operations fail through ftrace_bug(). That was the reason I didn't add anything here.
I'm fine with that too, and better reason not to call BUG_ON(), because I'm guessing if we crash, we never make it to the ftrace_bug() which reports information that can be used to debug what went wrong. -- Steve