Skip to content

Faulty logic in kpatch_replace_sections_syms() #1438

Description

@j-piecuch

The function uses a local bool found variable to keep track of whether a replacement symbol was found for a given rela. The variable is set to true when a replacement symbol is found for a particular rela, but when we move to the next rela, it should be reset to false, which never happens.

Simply adding the missing found = false; statement causes several unit tests to fail:

BUILD altinstr_aux                                                                                                                                 
create-diff-object: ERROR: altinstr_aux.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x5c: can't find replacement symbol for .init.text+3172 reference                                                                                                                                  
BUILD ASSERT_RTNL-detect                                                                                                                           
create-diff-object: ERROR: ASSERT_RTNL-detect.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x308: can't find replacement symbol for .init.text+748 reference                                                                                                                            
BUILD clang-lstr
create-diff-object: ERROR: clang-lstr.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x14: can't find replacement symbol for .init.text+143 reference
BUILD clang-special-static
create-diff-object: ERROR: clang-special-static.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x19c: can't find replacement symbol for .init.text+302 reference
BUILD cmdline-ubsan
create-diff-object: ERROR: cmdline-ubsan.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x14: can't find replacement symbol for .init.text+94 reference
BUILD cold-noid-issue-1160
create-diff-object: ERROR: cold-noid-issue-1160.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x86c: can't find replacement symbol for .init.text+17 reference
BUILD dynamic-debug-special-static-issue-990
create-diff-object: ERROR: dynamic-debug-special-static-issue-990.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x84: can't find replacement symbol for .init.text+424 reference
BUILD mangled-symbol-modification-issue-1048
create-diff-object: ERROR: mangled-symbol-modification-issue-1048.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x14: can't find replacement symbol for .init.text+123 reference
BUILD mcount_loc-issue-1102
create-diff-object: ERROR: mcount_loc-issue-1102.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x1c: can't find replacement symbol for .init.text+121 reference
BUILD multifile-pr-1204
create-diff-object: ERROR: multifile-pr-1204.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x58: can't find replacement symbol for .init.text+78 reference
BUILD plt32-relocations-issue-975
create-diff-object: ERROR: plt32-relocations-issue-975.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x4: can't find replacement symbol for .init.text+34 reference
BUILD static-call-pr-1315
create-diff-object: ERROR: static-call-pr-1315.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0x4: can't find replacement symbol for .static_call.text+5 reference
BUILD static-local-moved-subfunction-issue-1054
create-diff-object: ERROR: static-local-moved-subfunction-issue-1054.ORIG.o: kpatch_replace_sections_syms: 1685: .orc_unwind_ip+0xc8: can't find replacement symbol for .init.text+711 reference

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions