Re: [PATCH v2 51/53] objtool/klp: Fix kCFI prefix finding/cloning
Song Liu <[email protected]>
| Newsgroups | org.kernel.vger.live-patching,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAPhsuW7XKO=9cLBDU=DS7HY+MRyQY6-jpbCqO49Et-yV7=x+=A@mail.gmail.com> |
On Fri, May 1, 2026 at 5:09 AM Josh Poimboeuf <[email protected]> wrote: > > With CFI+CALL_PADDING, Clang places .Ltmp labels at the start of the NOP > padding (offset 5) between the __cfi_ prefix and the function entry > point. get_func_prefix() only checks the immediately previous symbol, > so the intervening .Ltmp label causes it to miss the __cfi_ prefix > symbol. > > This results in klp-diff not cloning the kCFI type hash into the > livepatch module, causing a CFI failure at module load when calling > callback functions through indirect calls: > > CFI failure at __klp_enable_patch+0xab/0x140 > (target: pre_patch_callback+0x0/0x80 [livepatch_combined]; > expected type: 0xde073954) > > Instead of walking backward through the section's symbol list, just use > find_func_containing() for the byte before the function. This works now > that __cfi_ symbols are being grown by objtool to fill the padding. > > Signed-off-by: Josh Poimboeuf <[email protected]> Acked-by: Song Liu <[email protected]>