If available, add the build-id to the info list returned by
kmod_module_get_info(). This allows us to compare the build-id of a
loaded module versus the build-id of the file. It's rather cumbersome
command, but it works:
$ ./build/modinfo -F build-id hid
AE:7A:2E:37:E0:2B:31:D5:72:7C:87:87:15:8C:05:FA:77:7A:4F:57
$ xxd -p -u -s16 /sys/module/hid/notes/.note.gnu.build-id | sed 's/../&:/g;s/:$//'
AE:7A:2E:37:E0:2B:31:D5:72:7C:87:87:15:8C:05:FA:77:7A:4F:57
An option to modinfo to really to just dump the raw value can be added
in future.
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/432
goto list_error;
}
+ if (mod->elf) {
+ const void *build_id;
+ size_t build_id_len;
+
+ if (kmod_elf_get_build_id(mod->elf, &build_id, &build_id_len) == 0) {
+ struct kmod_list *n;
+
+ n = kmod_module_info_append_hex(list, "build-id",
+ strlen("build-id"), build_id,
+ build_id_len);
+ if (n == NULL)
+ goto list_error;
+ count++;
+ }
+ }
+
if (mod->file && kmod_module_signature_info(mod->file, &sig_info)) {
struct kmod_list *n;