On 11/2/22 8:51 AM, Joe Lawrence wrote: > On 11/1/22 7:02 AM, Petr Mladek wrote: >> Note that adding the used klp_shadow_types into struct klp_object >> is not strictly required. >> >> Alternative solution is to register/unregister the used types using >> klp_callbacks or module init()/exit() callbacks. This approach >> is used in lib/livepatch/test_klp_shadow_vars.c. >> >> I believe that this would be usable for kpatch-build. >> You needed to remove not-longer used shadow variables >> using these callbacks even before this patchset. I would >> consider it a bug if you did not remove them. The new API >> just allows to do this a safe way. >> > > Ah, let me dig into that example for alternative usage. At first > glance, it looks like you're right -- kpatch already supports callbacks, > so just (un)register the shadow variables here. I'll be back with more > info hopefully later this week. > (Un)registering the shadow types from the callbacks worked out fine. It adds some verbosity to our shadow variable usage, but I think most of that is unavoidable as the API is changing anyway. Adding the shadow type into kpatch klp_objects (or the klp_patch) would require a bit more work on our part, but doesn't need to hold up upstream review up this patchset. Thanks, -- Joe