Ticket 17210

Summary: load_ebpf_prog() fails for long bpf() logs
Product: Slurm Reporter: jnooree
Component: LimitsAssignee: Oriol Vilarrubi <jvilarru>
Status: RESOLVED FIXED QA Contact:
Severity: C - Contributions    
Priority: --- CC: jnooree
Version: 23.02.3   
Hardware: Linux   
OS: Linux   
Site: -Other- Alineos Sites: ---
Atos/Eviden Sites: --- Confidential Site: ---
Coreweave sites: --- Cray Sites: ---
DS9 clusters: --- Google sites: ---
HPCnow Sites: --- HPE Sites: ---
IBM Sites: --- NOAA SIte: ---
NoveTech Sites: --- Nvidia HWinf-CS Sites: ---
OCF Sites: --- Recursion Pharma Sites: ---
SFW Sites: --- SNIC sites: ---
Tzag Elita Sites: --- Linux Distro: Ubuntu
Machine Name: CLE Version:
Version Fixed: 23.02.4 Target Release: ---
DevPrio: --- Emory-Cloud Sites: ---
Attachments: The bug fix patch.

Description jnooree 2023-07-14 04:30:35 MDT
Created attachment 31233 [details]
The bug fix patch.

bpf(BPF_PROG_LOAD, ...) fails with ENOSPC if the provided log_buf is too small (https://man7.org/linux/man-pages/man2/bpf.2.html):

> log_size size of the buffer pointed to by log_buf.  If the
> size of the buffer is not large enough to store all verifier
> messages, -1 is returned and errno is set to ENOSPC.

Current implementation only allows max 8192 chars for log. However,
as the log is not being used in the function, we could simply ignore the log
by setting log_level to zero.

This patch will fix the bug.
Comment 4 Tim Wickberg 2023-07-17 10:30:05 MDT
Comment on attachment 31233 [details]
The bug fix patch.

Thank you for the bug report and the patch submission. I've updated the commit message with a bit more detail, and merged this into our 23.02 branch so that it'll be included in 23.02.4 when released.

We'll keep this ticket open briefly while we look at some additional log changes on our master branch.

thanks again,
- Tim

commit eafacf30d90c24ea48144671944a88953513070a
Author:     Nuri Jung <jnooree@snu.ac.kr>
AuthorDate: Fri Jul 14 19:20:33 2023 +0900

    Ignore log from bpf(BPF_PROG_LOAD, ...)
    
    If the log buffer is too short for the verifier messages, bpf() will
    fail with ENOSPC. Since the log itself is current unused, it's simpler
    to disable logging here at present.
    
    Bug 17210.