Re: [PATCH] arm64/module-plts: Consider the special case where plt_max_entries is 0
From: Will Deacon <will@kernel.org>
Date: 2020-08-21 11:17:25
Also in:
lkml
On Tue, Jul 14, 2020 at 08:48:11AM +0000, 彭浩(Richard) wrote:
On Thu, Jul 09, 2020 at 07:18:01AM +0000,Peng Hao(Richard) wrote:quoted
On Thu, 9 Jul 2020 at 09:50, Peng Hao(Richard) [off-list ref] wrote:quoted
quoted
quoted
Apparently, you are hitting a R_AARCH64_JUMP26 or R_AARCH64_CALL26 relocation that operates on a b or bl instruction that is more than 128 megabytes away from its target.My understanding is that a module that calls functions that are not part of the module will use PLT. Plt_max_entries =0 May occur if a module does not depend on other module functions.A PLT slot is allocated for each b or bl instruction that refers to a symbol that lives in a different section, either of the same module (e.g., bl in .init calling into .text), of another module, or of the core kernel. I don't see how you end up with plt_max_entries in this case, though.if a module does not depend on other module functions, PLT entries in the module is equal to 0.quoted
This brings me back to my earlier question: if there are no PLT entries in the module, then count_plts() will not find any R_AARCH64_JUMP26 or R_AARCH64_CALL26 relocations that require PLTs and will therefore return 0. The absence of these relocations means that module_emit_plt_entry() will not be called by apply_relocate_add(), and so your patch should have no effect.1.The module in question is the calling function from core kernel.( Ib_core.ko triggered the warning multiple times). 2. There are multiple threads loading IB_core.ko [ 73.388931] ###cpu=33, name=ib_core, core_plts=0, init_plts=0 [ 73.402102] #### cpu=33,pid=2297,name=ib_core, module_emit_plt_entry:plt_num_entries=1, plt_max_entries=0 (warning) [ 73.439391] ###cpu=24, name=ib_core, core_plts=0, init_plts=0 [ 73.448617] ###cpu=4, name=ib_core, core_plts=0, init_plts=0 [ 73.547535] ###cpu=221, name=ib_core, core_plts=0, init_plts=0 [ 75.198075] #### cpu=24,pid=2336,name=ib_core, module_emit_plt_entry:plt_num_entries=1, plt_max_entries=0 (warning) [ 75.489496] #### cpu=4,pid=2344,name=ib_core, module_emit_plt_entry:plt_num_entries=1, plt_max_entries=0(warning) I don't understand why count_plts returns 0 when CONFIG_RANDOMIZE_BASE=n for R_AARCH64_JUMP26 and R_AARCH64_CALL26. 3. Set CONFIG_ARM64_MODULE_PLTS=y and restart the server several times without triggering this warning.
Can you provide a means for us to reproduce this failure with an upstream kernel, please? I really can't tell what's going on from the report. If I can reproduce the problem locally, then I'm happy to take a look. Thanks, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel