Skip to content

support for calling a new function in another object#390

Merged
sjenning merged 1 commit intodynup:masterfrom
jpoimboe:inter-object-call
Sep 2, 2014
Merged

support for calling a new function in another object#390
sjenning merged 1 commit intodynup:masterfrom
jpoimboe:inter-object-call

Conversation

@jpoimboe
Copy link
Member

@jpoimboe jpoimboe commented Sep 2, 2014

If a patch adds a new function in foo.c, and calls that function from
bar.c, currently it fails with something like:

kpatch_create_dynamic_rela_sections: 2115: lookup_global_symbol failed for tpe_allow_file, needed for .text.do_mmap_pgoff

This (crudely) fixes the issue by assuming that if we can't find the
global symbol in the original vmlinux, that it will be provided by
another object in the patch module. If that assumption is incorrect,
the module will fail to load due to the missing symbol dependency.

A (perhaps) better way to fix this is to search for the symbol in the
patched version of the vmlinux. But I think this approach is good
enough, for now at least.

Fixes #388.

If a patch adds a new function in foo.c, and calls that function from
bar.c, currently it fails with something like:

    kpatch_create_dynamic_rela_sections: 2115: lookup_global_symbol failed for tpe_allow_file, needed for .text.do_mmap_pgoff

This (crudely) fixes the issue by assuming that if we can't find the
global symbol in the original vmlinux, that it will be provided by
another object in the patch module.  If that assumption is incorrect,
the module will fail to load due to the missing symbol dependency.

A (perhaps) better way to fix this is to search for the symbol in the
patched version of the vmlinux.  But I think this approach is good
enough, for now at least.

Fixes dynup#388.
@jpoimboe
Copy link
Member Author

jpoimboe commented Sep 2, 2014

@cormander I think this should fix issue #388.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think we should output some sort of warning at least that says "symbol x lookup failed, assuming object is provided by patch" or something like that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm inclined to say we don't need a warning, because my feeling is that 90% of the time, the symbol will be defined elsewhere in the patch module, and a warning would be inappropriate and confusing.

The other 10% of the time (or maybe less? I'm not even sure what could legitimately cause this error...) the module would fail to load and the printk message would state which symbol is missing.

sjenning added a commit that referenced this pull request Sep 2, 2014
support for calling a new function in another object
@sjenning sjenning merged commit d0606ae into dynup:master Sep 2, 2014
@cormander
Copy link
Contributor

Confirmed, this fixes it.

@jpoimboe jpoimboe deleted the inter-object-call branch September 9, 2014 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kpatch_create_dynamic_rela_sections: 2115: lookup_global_symbol failed

3 participants