On Tue, Apr 4, 2023 at 5:37 AM Andrii Nakryiko <andrii@xxxxxxxxxx> wrote: > > Drop the log_size>0 and log_buf!=NULL condition when log_level>0. This > allows users to request log_size_actual of a full log without providing > actual (even if small) log buffer. Verifier log handling code was mostly ready to handle NULL log->ubuf, so only few small changes were necessary to prevent NULL log->ubuf from causing problems. > > Note, that user is basically guaranteed to receive -ENOSPC when > providing log_level>0 and log_buf==NULL. We also still enforce that > either (log_buf==NULL && log_size==0) or (log_buf!=NULL && log_size>0). Is it possible to change it so that log_buf == NULL && log_size == 0 && log_level > 0 only fills in log_size_actual and doesn't return ENOSPC? Otherwise we can't do oneshot loading. if PROG_LOAD(buf=NULL, size=0, level=1) >= 0: return fd else retry PROG_LOAD(buf!=NULL, size=log_size_actual, level=1) If the first PROG_LOAD returned ENOSPC we'd have to re-run it without the log enabled to see whether ENOSPC is masking a real verification error. With the current semantics we can work around this with three syscalls, but that seems wasteful? if PROG_LOAD(buf=NULL, size=0, level=0) >= 0: return fd PROG_LOAD(buf=NULL, size=0, level=1) == ENOSPC PROG_LOAD(buf!=NULL, size=log_size_actual, level=1)