Skip to content

Commit

Permalink
program: deprecate LogSize and VerifierError.Truncated
Browse files Browse the repository at this point in the history
We removed LogSize and VerifierError.Truncated in a previous commit,
but this causes lots of headache when trying to update the dependency
in cilium/cilium and cilium/tetragon. We won't be the only ones suffering,
so deprecate the field instead of removing it outright.

Signed-off-by: Lorenz Bauer <[email protected]>
  • Loading branch information
lmb committed Jul 23, 2024
1 parent 63c6cf8 commit 218b9f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func ErrorWithLog(source string, err error, log []byte) *VerifierError {

log = bytes.Trim(log, whitespace)
if len(log) == 0 {
return &VerifierError{source, err, nil}
return &VerifierError{source, err, nil, false}
}

logLines := bytes.Split(log, []byte{'\n'})
Expand All @@ -34,7 +34,7 @@ func ErrorWithLog(source string, err error, log []byte) *VerifierError {
lines = append(lines, string(bytes.TrimRight(line, whitespace)))
}

return &VerifierError{source, err, lines}
return &VerifierError{source, err, lines, false}
}

// VerifierError includes information from the eBPF verifier.
Expand All @@ -46,6 +46,8 @@ type VerifierError struct {
Cause error
// The verifier output split into lines.
Log []string
// Deprecated: the log is never truncated anymore.
Truncated bool
}

func (le *VerifierError) Unwrap() error {
Expand Down
8 changes: 8 additions & 0 deletions prog.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ const (
outputPad = 256 + 2
)

// Deprecated: the correct log size is now detected automatically and this
// constant is unused.
const DefaultVerifierLogSize = 64 * 1024

// minVerifierLogSize is the default number of bytes allocated for the
// verifier log.
const minVerifierLogSize = 64 * 1024
Expand All @@ -69,6 +73,10 @@ type ProgramOptions struct {
// attempt at loading the program.
LogLevel LogLevel

// Deprecated: the correct log buffer size is determined automatically
// and this field is ignored.
LogSize int

// Disables the verifier log completely, regardless of other options.
LogDisabled bool

Expand Down

0 comments on commit 218b9f9

Please sign in to comment.