[PATCH 2/2] arch: arm64: Reject modules with internal alternative callbacks

Adrian Barnaś abarnas at google.com
Fri Sep 19 09:39:59 PDT 2025


On Fri, Sep 19, 2025 at 05:01:09PM +0200, Ard Biesheuvel wrote:
>Hi Adrian,
>
>On Fri, 19 Sept 2025 at 14:23, Adrian Barnaś <abarnas at google.com> wrote:
>>
>> During module loading, check if there is a callback function used by the
>> alternatives specified in the '.altinstruction' ELF section and block
>> loading the module if such a function is present.
>>
>
>Why?
>
>AIUI, the issue being addressed is the fact that we cannot yet execute
>code from the module itself when alternatives are being applied, and
>so the callback must live in the core kernel, or in another module.
>
>So this is a really big hammer, given that it disallows all callback
>alternatives, including ones that we could easily support.

Yes, it is true.                                                           
                                                                            
What about we check if cb resides in kernel .text using core_kernel_text()? 
Pointer should be valid already since applying alternatives is done after 
relocation. We can shrink the hammer a bit.

Then we allow the callback from inside the kernel to be called from 
the module but reject modules with callbacks that are invalid.      

Thanks,
Adrian



More information about the linux-arm-kernel mailing list