Open 1nd0 opened 5 years ago
@1nd0 could you help debug this a little bit further?
@yonghong-song I sure can what information would you like me to provide.
I did not look at the issue yet. Just to find how to fix the issue you have.
Ill dig into net-next to see if that is where the issue is. I am guessing things have changed a bit.
It looks like in your make file you are doing
cd $(KERNEL_TREE_ROOT); make HOSTCC=clang CC=clang kernel/bpf/verifier.i kernel/bpf/linux_hook.i
This is causing make to use the make file in the net-next dir try to build the linux hook but it doesnt have any instructions on how to build it.
@yonghong-song Do you know what version of the kernel you where using the tool on ?
I have tried very early version around 4.6, I think. But I think it does not make sense to go back at this stage. If you are interested, feel free to look at the new kernel versions. It is possible that some new hooks need to be added.
@yonghong-song So we fixed the initial issue by hard copying the linux_hook.c file into the net_next/kernel/bpf/ folder now we are running into issues building the test_verifier. looks like during the make is trying to call ARG_PTR_TO_STACK that was renamed quite awhile ago.
Thanks for improving this. I indeed have not worked on this for quite a while.
I am also getting a similar error running the Makefile through "make all " command.
cd /home/azada/net-next2/net-next; make HOSTCC=clang CC=clang kernel/bpf/verifier.i kernel/bpf/linux_hook.i make[1]: Entering directory '/home/azada/net-next2/net-next' Compiler lacks asm-goto support. arch/x86/Makefile:302: recipe for target 'checkbin' failed make[1]: [checkbin] Error 1 make[1]: Leaving directory '/home/azada/net-next2/net-next' Makefile:37: recipe for target 'test_hook' failed make: [test_hook] Error 2 I am using Kernel version 4.15. What is the solution? could someone please reply it as soon as possible!
For
Compiler lacks asm-goto support.
error message, could you try clang9 which has asm goto support?
@yonghong-song : Thanks , yes upgrading to clang 9 had solved our issue of asm goto . Now we are stuck with the same error mentioned at the beginning of this issue . And even hardcopying (which i believe is creating a hard link) does not solve the issue . Could you please help with what can be done
The error mostly due to kernel code change. So some hook change might be needed for your 4.15 kernel as kernel verifier change heavily affects this.
Thanks I am looking into it now , @1nd0 : Could you please tell which kernel version you used and does hard copying mean making a copy of the file linux hook .c into the mentioned path ? And does it mean I have to skip certain lines in existing Makefile? Could you please elaborate ?
@yonghong-song : Now i believe that i fixed the changes needed in test verifier . And it compiles.But i am getting undefined references during linking for the ones in verifier.c .Could you please point out if i have to add the definitions in linux hook .c (or) am i doing something wrong with the previous steps
I guess, you will have to add some missing hooks. Some newer kernels will have additional hooks which need to be implemented.
Re: the original question, the Linux developers changed the kernel build system for single target builds. With their change, things like make kernel/bpf/verifier.i
won't work by default. See this discussion on the kernel mailing list for more details.
As a workaround, you have to add single target builds to the obj-y
or obj-m
variables in the Makefiles. After that, the above make
command should work after re-generating the config files. Here's my diff:
--- a/kernel/bpf/Makefile
+++ b/kernel/bpf/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-obj-y := core.o
+obj-y := core.o verifier.o linux_hook.o
CFLAGS_core.o += $(call cc-disable-warning, override-init)
obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o```
I am running into the following issue when doing the make process.