mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-18 18:31:07 +00:00
bpf: initialize the verifier log
If program loading fails before verifier prints its first message, the verifier log will not be initialized. Always set the first character of the log buffer to zero to make sure we don't dump non-printable characters to the terminal. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
de3ddbc27d
commit
f6a54d72a5
@ -1153,7 +1153,7 @@ static int bpf_log_realloc(struct bpf_elf_ctx *ctx)
|
||||
{
|
||||
const size_t log_max = UINT_MAX >> 8;
|
||||
size_t log_size = ctx->log_size;
|
||||
void *ptr;
|
||||
char *ptr;
|
||||
|
||||
if (!ctx->log) {
|
||||
log_size = 65536;
|
||||
@ -1169,6 +1169,7 @@ static int bpf_log_realloc(struct bpf_elf_ctx *ctx)
|
||||
if (!ptr)
|
||||
return -ENOMEM;
|
||||
|
||||
ptr[0] = 0;
|
||||
ctx->log = ptr;
|
||||
ctx->log_size = log_size;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user