-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
program, btf: probe correct log buffer size
The kernel exposes a log of operations to aid debugging a program or BTF load. Until recently there was no way to know the size of that buffer, so the library forces the user to specify a buffer size. From a cursory survey on sourcegraph.com it seems that users either hardcode a large fixed buffer or probe the correct size by doubling the buffer size when hitting ENOSPC. Since commit 47a71c1f9af0 ("bpf: Add log_true_size output field to return necessary log buffer size") the kernel does provide a hint to user space. Move probing of the correct log buffer size into the library. On recent (>= 6.4) kernels this is guaranteed to work in a single call. On older kernels we use the doubling strategy employed by cilium and tetragon. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
- Loading branch information
Showing
6 changed files
with
113 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.