Subject: Re: [PATCH bpf-next] libbpf: Print hint about ulimit when getting permission denied error

From: Jesper Dangaard Brouer <[email-masked]>
Date: Mon, 16 Dec 2019 14:52:30 +0100

On Mon, 16 Dec 2019 13:40:31 +0100
Toke Høiland-Jørgensen <[email-masked]> wrote:

> Probably the single most common error newcomers to XDP are stumped by is
> the 'permission denied' error they get when trying to load their program
> and 'ulimit -r' is set too low. For examples, see [0], [1].
> 
> Since the error code is UAPI, we can't change that. Instead, this patch
> adds a few heuristics in libbpf and outputs an additional hint if they are
> met: If an EPERM is returned on map create or program load, and geteuid()
> shows we are root, and the current RLIMIT_MEMLOCK is not infinity, we
> output a hint about raising 'ulimit -r' as an additional log line.
> 
> [0] https://marc.info/?l=xdp-newbies&m=157043612505624&w=2
> [1] https://github.com/xdp-project/xdp-tutorial/issues/86
> 
> Signed-off-by: Toke Høiland-Jørgensen <[email-masked]>

Acked-by: Jesper Dangaard Brouer <[email-masked]>

This is the top #1 issue users hit again-and-again, too bad we cannot
change the return code as it is UAPI now.  Thanks for taking care of
this mitigation.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer