Skip to content

Commit

Permalink
elf: don't set BPF_F_MMAPABLE on .kconfig
Browse files Browse the repository at this point in the history
We don't need to set the MMAPABLE flag on .kconfig section since
the library never mmaps it. This allows using .kconfig on kernel
>=5.2 instead of >=5.5.

Signed-off-by: Lorenz Bauer <[email protected]>
  • Loading branch information
lmb committed Sep 11, 2023
1 parent 01ebd4c commit 0d9b9fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion elf_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ func (ec *elfCode) loadKconfigSection() error {
KeySize: uint32(4),
ValueSize: ds.Size,
MaxEntries: 1,
Flags: unix.BPF_F_RDONLY_PROG | unix.BPF_F_MMAPABLE,
Flags: unix.BPF_F_RDONLY_PROG,
Freeze: true,
Key: &btf.Int{Size: 4},
Value: ds,
Expand Down
3 changes: 2 additions & 1 deletion elf_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,9 @@ func TestKconfigKernelVersion(t *testing.T) {
Main *Program `ebpf:"kernel_version"`
}

testutils.SkipOnOldKernel(t, "5.2", "readonly maps")

err = spec.LoadAndAssign(&obj, nil)
testutils.SkipIfNotSupported(t, err)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 0d9b9fb

Please sign in to comment.