-
Notifications
You must be signed in to change notification settings - Fork 304
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
ERROR: testmod_drv.o: .return_sites section header details differ from .return_sites #1300
Comments
have debugged kpatch, found that the entsize of .return_sites section changed from 4 to 0, thus kpatch reported this error. |
after adding V=1 to module Makefile, log output shows:
there is one 'ld' step after objtool generates .return_sites section, and it changed entsize of .return_sites section of testmod_drv.o from 4 to 0. |
|
Not sure should kpatch deal with this situation, or it is kernel's problem. |
Hi @he7850, I am not getting the error you mention while trying to reproduce your issue. Could you please attach a tarball including the original Could you also provide the |
I cannot upload files to github due to the firewall of my company, I will copy the code to my PC and upload it, but it may take some time. |
@he7850 Maybe just the |
sorry for the late reply. here is the command:
|
######## modify the name to the module name ########
name := testmod_ext
######## do not modify the following content ###########
CURDIR := ${shell pwd}
BINDIR=$(shell echo $(CURDIR) | sed 's/testcases\//bin\//g')
ifeq ("$(ARCH)", "arm64")
EXTRA_CFLAGS += -DCONFIG_ARM64=1
endif
SOURCES_FILE := $(wildcard *.c)
ifneq ($(KERNELRELEASE),)
obj-m:=$(name).o
$(name)-objs := testmod_drv.o
else
KVER := $(shell uname -r)
KDIR := /lib/modules/$(KVER)/build
PWD := $(shell pwd)
all:
[ -e $(BINDIR) ] || mkdir -p $(BINDIR)
$(MAKE) V=1 -C $(KDIR) M=$(PWD) modules
.PHONY: install
install:
cp *.ko $(BINDIR)
.PHONY: clean
clean:
make -C $(KDIR) M=$(PWD) clean
rm -rf $(BINDIR)/*.ko
endif |
Can the problem be reproduced without adding a new symbol export? This is something that kpatch-build does not support (for example, see #1178) |
Also, not sure what the options="$(getopt -o ha:r:s:c:v:j:t:n:o:dR ... |
@jpoimboe: (symbol exports aside) I think this is another variant of [0] objtool creating elf sections with entry size while the rest of the toolchain (ie, ld) not bothering? If we're otherwise ignoring this section, should we relax the section header check to allow for N to 0 entry size changes? [0] https://lore.kernel.org/lkml/[email protected]/T/#mea3ba10046d6a72b4ed07556f63cc537da767e15 |
-e means oot module.
|
lol, just found my version of kpatch does support exporting symbol in patch module. (there is a patch allowing this) |
I cannot figure why ld will change the entsize of .return_sites section, but I have tried one possible solution: localhost:/opt/patch_workspace/kernel-source # git diff tools/objtool/check.c*
diff --git a/tools/objtool/check.c b/tools/objtool/check.c.new
index c7b6e6b..1162bf7 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c.new
@@ -672,7 +672,7 @@ static int create_return_sites_sections(struct objtool_file *file)
if (!idx)
return 0;
- sec = elf_create_section(file->elf, ".return_sites", 0,
+ sec = elf_create_section(file->elf, ".return_sites", 0x10, // SHF_MERGE
sizeof(int), idx);
if (!sec) {
WARN("elf_create_section: .return_sites");
but I am not sure if this flag can be added to the section. currently I temporarily solve this problem by kpatch ignoring the section header change. maybe setting the entsize to 0 in objtool is better, if the entsize attrubute of .return_sites section is not actually used. |
As for the entry size changing, I'll leave it up to Josh to whether objtool should mimic the rest of the toolchain or not. |
the patch is from openEuler's forked kpatch repository: https://gitee.com/src-openeuler/kpatch |
This issue has been open for 30 days with no activity and no assignee. It will be closed in 7 days unless a comment is added. |
This issue has been open for 30 days with no activity and no assignee. It will be closed in 7 days unless a comment is added. |
This issue was closed because it was inactive for 7 days after being marked stale. |
recently kernel introduces .return_sites section, and kpatch has added support for it.
but this section causes some testcases failure.
failed testcase:
The text was updated successfully, but these errors were encountered: