-
Notifications
You must be signed in to change notification settings - Fork 336
create-diff-object: Add support for x86_64 CONFIG_CALL_PADDING #1487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
For x86_64 this option uses -fpatchable-function-entry=$(CONFIG_FUNCTION_PADDING_BYTES),$(CONFIG_FUNCTION_PADDING_BYTES), so CONFIG_FUNCTION_PADDING_BYTES NOPs are placed before the function entry point (in order to store a pointer to ftrace_ops).When calculating function padding, check for the presence of the CONFIG_FUNCTION_PADDING_BYTES NOPs, and adjust the padding size by CONFIG_FUNCTION_PADDING_BYTES if they are found. Signed-off-by: lu21253 <lu.haoA@h3c.com> Reviewed-by: w28894 <wang.shijie@h3c.com> Reviewed-by: z17497 <zhang.chunA@h3c.com>
|
/packit test |
|
Hi @lu21253 : just curious, what was the failure mode that you encountered that this patch fixes? And if you could attach your complete kernel configuration. I ask as RHEL-10 sets CONFIG_CALL_PADDING=y and CONFIG_FUNCTION_PADDING_BYTES=16, yet there are no problems (at least using gcc). Thanks and btw, many of us here will be away at LPC over the next week or two, so replies may take a while. Thanks! |
|
Hi, @joe-lawrence : make: Leaving directory '/home/l21253/V9/B93D001/PUBLIC/kernel' /home/l21253/V9/B93D001/kpatch-master/kpatch-build/create-diff-object /home/l21253/V9/B93D001/objs64/orig/n_tty.o /home/l21253/V9/B93D001/objs64/patched/n_tty.o vmlinux /home/l21253/V9/B93D001/objs64/vmlinux.symtab /home/l21253/V9/B93D001/TARGET/arch/x86_64/release/Module.symvers livepatch-livepatch-vmlinux-tty.ko /home/l21253/V9/B93D001/objs64/output/n_tty.o create-diff-object: ERROR: home/l21253/V9/B93D001/objs64/orig/n_tty.o: kpatch_bundle_symbols: 355: symbol echo_set_canon_col at offset 16 within section .text.echo_set_canon_col, expected 0 |
|
@lu21253 : can you attach your kernel .config? (Or indicate which distro kernel you may be using.) Thanks! |
|
@joe-lawrence kernel version is 6.6.0, Thanks! |
Yes that's the version, but the kernel config? Perhaps it's at |
|
In #1411 we added a kpatch-build assertion against this option (IIRC there was some explanation in #1320), so you should had gotten an "ERROR: kernel option 'CONFIG_X86_KERNEL_IBT' not supported" error message right off the bat. The short of it is that with this kernel option, and a few others now, the kernel build will defer objtool object file manipulation to vmlinux.o instead of on individual object files. This breaks kpatch-build assumptions and we never found a great workaround, so to address that Josh created an upstream, in-kernel-tree approach just recently merged: https://www.phoronix.com/news/Linux-6.19-objtool-klp-build That said, maybe this kpatch-build patch is reasonable for completeness on !CONFIG_X86_KERNEL_IBT configs. How did you hit the create-diff-object error (ie, which version of kpatch-build are you using) and do you happen to have an input kpatch for repro? Thanks! |
For x86_64 this option uses -fpatchable-function-entry=$(CONFIG_FUNCTION_PADDING_BYTES),$(CONFIG_FUNCTION_PADDING_BYTES), so CONFIG_FUNCTION_PADDING_BYTES NOPs are placed before the function entry point (in order to store a pointer to ftrace_ops).When calculating function padding, check for the presence of the CONFIG_FUNCTION_PADDING_BYTES NOPs, and adjust the padding size by CONFIG_FUNCTION_PADDING_BYTES if they are found.
Signed-off-by: l21253 lu.haoA@h3c.com
Reviewed-by: w28894 wang.shijie@h3c.com
Reviewed-by: z17497 zhang.chunA@h3c.com