On Wednesday 11 October 2017 09:42 AM, Michael Ellerman wrote: > Kamalesh Babulal <kamal...@linux.vnet.ibm.com> writes: > >> Use WARN_ON(), while running out of stubs in stub_for_addr() >> and abort loading of the module instead of BUG_ON(). > > Thanks. This looks good in principle. Have you actually tested it to > make sure we do in fact gracefully fail the module load? >
Thanks for the review. I tested with little hackish version of this patch: + if (!strncmp(me->name, "live", 4)) + j = 100; + for (i = 0; stub_func_addr(stubs[i].funcdata); i+=j) { + if (WARN_ON(i >= num_stubs)) + return 0; and it fails gracefully. # modprobe livepatch-sample modprobe: ERROR: could not insert 'livepatch_sample': Unknown symbol in module, or unknown parameter (see dmesg) # echo $? 1 # dmesg ------------[ cut here ]------------ WARNING: CPU: 2 PID: 2836 at arch/powerpc/kernel/module_64.c:526 apply_relocate_add+0x71c/0xb00 -- cheers, Kamalesh.