Hi Joe, On Wed, Aug 3, 2022 at 5:36 AM Joe Lawrence <joe.lawrence@xxxxxxxxxx> wrote: > > On 8/3/22 1:53 AM, Song Liu wrote: > > On Thu, Jul 28, 2022 at 6:44 AM Petr Mladek <pmladek@xxxxxxxx> wrote: > >> > >> On Mon 2022-07-25 15:02:31, Song Liu wrote: > >>> I was debugging an issue that a livepatch appears to be attached, but > >>> actually not. It turns out that there is a mismatch in module name > >>> (abc-xyz vs. abc_xyz), klp_find_object_module failed to find the module. > >> > >> This might be a quite common mistake. IMHO, the module name stored in > >> the module metadata always uses underscore '_' instead of dash '-'. > >> > >> If I get it correctly, it is done by the following command in > >> scripts/Makefile.lib: > >> > >> --- cut --- > >> # These flags are needed for modversions and compiling, so we define them here > >> # $(modname_flags) defines KBUILD_MODNAME as the name of the module it will > >> # end up in (or would, if it gets compiled in) > >> name-fix-token = $(subst $(comma),_,$(subst -,_,$1)) > >> --- cut --- > > > > Yeah, I can confirm the "name-fix" makes the change. > > > > Hi Josh and Joe, > > > > I hit this issue while building live patch for OOT module with kpatch-build. > > Do you have some suggestions on how to fix it? My current workaround is > > to manually edit the .ko file... > > > > Hi Song, > > Was the original issue that the module's filename included '-' dash > character(s) while the module name ends up replaced those with '_' > underscores? There are multiple mismatches: module name, rela section name(s), and rela entry name(s). > > If that is the case, would you prefer that kpatch-build warn or refuse > to create .ko filenames that include '-' characters? I think the best is to have kpatch-build do the same subst for OOT modules, just as when the module itself is built. > > If you have ideas, feel free to post a new issue over on the project's > github. No one should have to resort to manually (hex) editing .ko files :) Yeah, I will create an issue on GitHub. Thanks, Song