ebpf
ebpf copied to clipboard
prog: unconditionally enable verifier retries, add consts, document LogLevel
With the recent addition of verifier error summaries, there are fewer reasons for disabling verifier output altogether. The existing behaviour is somewhat underspecified and underdocumented. Logging behaviour hinges on both LogLevel and LogSize, with an undocumented -1 value for LogSize to disable the verifier log. This gets rather complex with the retry mechanism involved.
This patch removes the local logSize variable, sets opts.LogSize directly to the default value, and log behaviour is now controlled by LogLevel only. Disabling the verifier log altogether can be done by setting the LogDisabled ProgramOption.
A type LogLevel was added to reflect the kernel's own constants for requesting logs on either branch or instruction level, as well as the stats summary of the current verifier pass on supported kernels. (v5.2 and up)
Documented all behaviour on the LogLevel and LogSize fields and constants.
This patch introduces one behavioural change: when ProgramOptions.LogLevel is left to its default value, a failed prog load will always result in a follow-up load with the verifier log level enabled (set to 1). The existing behaviour is to only request a verifier log if at least one of LogLevel or LogSize are set.