Le 23/04/2020 à 17:09, Naveen N. Rao a écrit :
Introduce a macro PATCH_INSN() to simplify instruction patching, and to make the error messages more uniform and useful: - print an error message that includes the original return value - print the function name and line numbers, so that the offending location is clear - always return -EPERM, which ftrace_bug() expects for proper error handling Also eliminate use of patch_branch() since most such uses already call create_branch() for error checking before patching. Instead, use the return value from create_branch() with PATCH_INSN().
I have the same comment here as for patch 3, this kind of macro hides the return action and can be dangerous.
What about implementing a macro that takes an explicit label as third argument and jump to that label in case of error ? On the same model as unsafe_put_user() ?
Christophe