On 4/14/2025 10:13 AM, Francesco Lavra wrote:
This works only if this function has been called directly (e.g. via `call asm_xen_write_msr`), but doesn't work with alternative call types (like indirect calls). Not sure why one might want to use an indirect call to invoke asm_xen_write_msr, but this creates a hidden coupling between caller and callee. I don't have a suggestion on how to get rid of this coupling, other than setting ipdelta in _ASM_EXTABLE_FUNC_REWIND() to 0 and adjusting the _ASM_EXTABLE_TYPE entries at the call sites to consider the instruction that follows the function call (instead of the call instruction) as the faulting instruction (which seems pretty ugly, at least because what follows the function call could be an instruction that might itself fault). But you may want to make this caveat explicit in the comment.
Good idea, will state that in the comment.