lkml.org 
[lkml]   [2018]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: /proc/kallsyms shows undefined symbols for livepatch modules
+++ Josh Poimboeuf [02/06/18 12:32 -0500]:
>Hi Jessica,
>
>I found a bug:
>
> [root@f25 ~]# modprobe livepatch-sample
> [root@f25 ~]# grep ' u ' /proc/kallsyms
> ffffffff81161080 u klp_enable_patch [livepatch_sample]
> ffffffff81a01800 u __fentry__ [livepatch_sample]
> ffffffff81161250 u klp_unregister_patch [livepatch_sample]
> ffffffff81161870 u klp_register_patch [livepatch_sample]
> ffffffff8131f0b0 u seq_printf [livepatch_sample]
>
>Notice that livepatch modules' undefined symbols are showing up in
>/proc/kallsyms. This can confuse klp_find_object_symbol() which can
>cause subtle bugs in livepatch.
>
>I stared at the module kallsyms code for a bit, but I don't see the bug.
>Maybe it has something to do with how we save the symbol table in
>copy_module_elf(). Any ideas?

Hi Josh!

This is because we preserve the entire symbol table for livepatch
modules, including the SHN_UNDEF symbols. IIRC, this is so that we can
still apply relocations properly with apply_relocate_add() after a
to-be-patched object is loaded. Normally we don't save these SHN_UNDEF
symbols for modules so they do not appear in /proc/kallsyms.

I think I see how this can cause bugs, since if we're searching for
seq_printf we want the real seq_printf and not the undef symbol from
the livepatch module. But I thought we renamed these symbols with some
.klp prefix? Or is the livepatch bug you're running into something else?

Thanks,

Jessica


\
 
 \ /
  Last update: 2018-06-04 10:06    [W:0.043 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site