On Tue 2025-03-11 11:53:59, zhang warden wrote: > > A single livepatch could modify more objects: vmlinux and several > > modules. The metadata for each modified object are in "struct > > klp_object". The related obect is currently identified only by obj->name. > > And we could add more precision identification by setting > > also "obj->srcversion" and/or "obj->build_id". > > > > Yep, but how can we get the obj->srcversion? If we tring to store it > in klp_object, the information should be carried when livepatch is being build. > Otherwise, we don't know which srcversion is good to patch, isn't it? I am not sure if I get the question correctly. Anyway, struct klp_object must be defined in any livepatch, for example, see /prace/kernel/linux/samples/livepatch/livepatch-sample.c I guess that you are using kPatch. I am not sure how it initializes these klp_patch, klp_object, and klp_func structures. But it has to create struct klp_object for the livepatched module and initialize at least .name, .func items. The srcversion of the livepatched module can be read by modinfo, for example: # modinfo test_printf filename: /lib/modules/6.13.0-default+/kernel/lib/test_printf.ko license: GPL description: Test cases for printf facility author: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> test: Y srcversion: AF319FC942A3220645E7E99 depends: intree: Y name: test_printf retpoline: Y vermagic: 6.13.0-default+ SMP preempt mod_unload modversions You need to teach kPatch to read the srcversion of the livepatched module and set it in the related struct klp_object. Best Regards, Petr