Skip to content
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

Updated version? #1

Open
vsoch opened this issue May 18, 2024 · 1 comment
Open

Updated version? #1

vsoch opened this issue May 18, 2024 · 1 comment

Comments

@vsoch
Copy link

vsoch commented May 18, 2024

Hi! I'm trying to test this out (just locally with kind to start) and there is an issue with the init-headers:

Fetching upstream kernel sources for 6.5.
+ curl -skL https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.5.tar.gz
+ tar --strip-components=1 -xzf - -C /linux-generic-6.5.0-1022-oem

real	0m33.813s
user	0m14.658s
sys	0m7.119s
+ generate_headers
+ echo 'Generating kernel headers'
+ cd /linux-generic-6.5.0-1022-oem
+ '[' -e /proc/config.gz ']'
+ '[' -e /boot.host/config-6.5.0-1022-oem ']'
Generating kernel headers
+ make ARCH=x86 oldconfig

Error in reading or end of file.

Error in reading or end of file.

Error in reading or end of file.

Error in reading or end of file.

And then it looks like an issue with diff:

Warning: Kernel ABI header at 'tools/arch/x86/include/asm/insn.h' differs from latest version at 'arch/x86/include/asm/insn.h'
diff: unrecognized option: I
BusyBox v1.28.4 (2018-12-31 18:05:13 UTC) multi-call binary.

Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

Compare files line by line and output the differences between them.
This implementation supports unified diffs only.

	-a	Treat all files as text
	-b	Ignore changes in the amount of whitespace
	-B	Ignore changes whose lines are all blank
	-d	Try hard to find a smaller set of changes
	-i	Ignore case differences
	-L	Use LABEL instead of the filename in the unified header
	-N	Treat absent files as empty
	-q	Output only whether files differ
	-r	Recurse
        --no-dereference Don't follow symlinks
	-S	Start with FILE when comparing directories
	-T	Make tabs line up by prefixing a tab when necessary
	-s	Report when two files are the same
	-t	Expand tabs to spaces in output
	-U	Output LINES lines of context
	-w	Ignore all whitespace
Warning: Kernel ABI header at 'tools/arch/x86/lib/inat.c' differs from latest version at 'arch/x86/lib/inat.c'
diff: unrecognized option: I
BusyBox v1.28.4 (2018-12-31 18:05:13 UTC) multi-call binary.

And then (maybe logically) the ebpf code does not compile in the main container:

include/linux/signal.h:241:10: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
  241 |         case 2: set->sig[1] = 0;
      |                 ^        ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
   24 |         unsigned long sig[_NSIG_WORDS];
      |         ^
In file included from /virtual/main.c:16:
In file included from include/net/sock.h:46:
In file included from include/linux/netdevice.h:38:
In file included from include/net/net_namespace.h:43:
In file included from include/linux/skbuff.h:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:5:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:254:10: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
  254 |         case 2: set->sig[1] = -1;
      |                 ^        ~
arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here
   24 |         unsigned long sig[_NSIG_WORDS];
      |         ^
49 warnings and 1 error generated.
Traceback (most recent call last):
  File "/app/main.py", line 3, in <module>
    from prober import probe
  File "/app/prober.py", line 32, in <module>
    b = BPF(text=bpf_text)
        ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bcc/__init__.py", line 479, in __init__
    raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>

There aren't many examples of basic setups to write and deploy an ebpf program to kubernetes, so I'm hoping we can update the example here to get it working. Thank you!

@isala404
Copy link
Owner

isala404 commented Jun 9, 2024

Hi, sorry for the late reply. This project was built on top of the BCC library which requires Linux headers to be installed on each node. To do that, I was using the script found at https://github.com/mclenhard/ebpf-summit/blob/master/init/fetch-linux-headers.sh. However, it looks like it hasn't held up against newer kernel versions. The last time I checked, it was working with kernel version 5.4.

As of now, most of my eBPF work is done with aya, which doesn't have this requirement. When I get the time, I will see if this script can be fixed. In the meantime, if this is just a local setup, you can simply install the Linux kernel headers and get this to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants