Skip to content

Support for kernels without module support #4802

@31KM

Description

@31KM

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem?

My kernel does not have module support (CONFIG_MODULES=n) and also some other tailoring configurations. I also build Tetragon from source. Before make I dump my kernels BTF and use that instead of the vmlinux_generated_x86.h provided in the Tetragon source. However, the build fails with:

error: incomplete definition of type 'const struct load_info'

Because my kernel does not have module support the BTF does not contain struct load_info.

As a workaround I use indirection: I dump my kernels BTF to bpf/include/vmlinux_generated_x86.h.custom and add a new file bpf/include/module_defs.h:

#ifndef __VMLINUX_MODULE_DEFS_H__
#define __VMLINUX_MODULE_DEFS_H__

struct load_info {
	...
};

#endif

Then, I overwrite the provided vmlinux_generated_x86.h like so:

#ifndef __VMLINUX_GENERATED_X86_H__
#define __VMLINUX_GENERATED_X86_H__

#include "vmlinux_generated.h.custom"
#include "module_defs.h"

#endif

That way the build works. I think the dependency to load_info was introduced via #1433.

Describe the feature you would like

Could you please introduce some kind of feature flag to allow building Tetragon from source for kernels that do not have module support?

Describe your proposed solution

A flag for make that controls a preprocessor directive perhaps?

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions