All of lore.kernel.org
 help / color / mirror / Atom feed
* [xdp-tutorial] : permission denied when I try to execute a program
@ 2019-09-25  9:10 Théo Mainguet
  2019-09-26 12:17 ` Anton Protopopov
  0 siblings, 1 reply; 4+ messages in thread
From: Théo Mainguet @ 2019-09-25  9:10 UTC (permalink / raw)
  To: xdp-newbies

Hi,


Thank you very much for your xdp tutorial. Currently, I try to write a 
simple xdp program to count the number of TCP and UDP packets I receive. 
For that, I created a BPF_MAP_TYPE_ARRAY map in my kern.c file. I can 
read into this map with the bpf_map_lookup_elem function but when I try 
to update a value, I have an error message "libbpf: load bpf program 
failed: Permission denied". To solve this issue, I've try to run it in 
sudo, I've verify my kernel configuration (everything needed seems 
enable) ....

I searched a solution on the internet but I didn't found anything 
relevant. I hope you can help me.

Théo Mainguet


My kernel configuration :

$ cat /boot/config-4.19.0-6-amd64 | grep BPF

CONFIG_CGROUP_BPF=y
CONFIG_BPF=y
CONFIG_BPF_SYSCALL=y
# CONFIG_BPF_JIT_ALWAYS_ON is not set
CONFIG_IPV6_SEG6_BPF=y
CONFIG_NETFILTER_XT_MATCH_BPF=m
# CONFIG_BPFILTER is not set
CONFIG_NET_CLS_BPF=m
CONFIG_NET_ACT_BPF=m
CONFIG_BPF_JIT=y
CONFIG_BPF_STREAM_PARSER=y
CONFIG_LWTUNNEL_BPF=y
CONFIG_HAVE_EBPF_JIT=y
CONFIG_BPF_EVENTS=y
# CONFIG_BPF_KPROBE_OVERRIDE is not set
CONFIG_TEST_BPF=m

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [xdp-tutorial] : permission denied when I try to execute a program
  2019-09-25  9:10 [xdp-tutorial] : permission denied when I try to execute a program Théo Mainguet
@ 2019-09-26 12:17 ` Anton Protopopov
  2019-09-26 12:34   ` Andy Gospodarek
  0 siblings, 1 reply; 4+ messages in thread
From: Anton Protopopov @ 2019-09-26 12:17 UTC (permalink / raw)
  To: Théo Mainguet; +Cc: xdp-newbies

чт, 26 сент. 2019 г. в 05:22, Théo Mainguet <theo.mainguet.etu@univ-lille.fr>:
>
> Hi,
>
>
> Thank you very much for your xdp tutorial. Currently, I try to write a
> simple xdp program to count the number of TCP and UDP packets I receive.
> For that, I created a BPF_MAP_TYPE_ARRAY map in my kern.c file. I can
> read into this map with the bpf_map_lookup_elem function but when I try
> to update a value, I have an error message "libbpf: load bpf program
> failed: Permission denied". To solve this issue, I've try to run it in
> sudo, I've verify my kernel configuration (everything needed seems
> enable) ....

What's the error message when you are trying to load your program with sudo?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [xdp-tutorial] : permission denied when I try to execute a program
  2019-09-26 12:17 ` Anton Protopopov
@ 2019-09-26 12:34   ` Andy Gospodarek
  2019-09-26 12:41     ` Anton Protopopov
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Gospodarek @ 2019-09-26 12:34 UTC (permalink / raw)
  To: Anton Protopopov; +Cc: Théo Mainguet, xdp-newbies

On Thu, Sep 26, 2019 at 08:17:48AM -0400, Anton Protopopov wrote:
> чт, 26 сент. 2019 г. в 05:22, Théo Mainguet <theo.mainguet.etu@univ-lille.fr>:
> >
> > Hi,
> >
> >
> > Thank you very much for your xdp tutorial. Currently, I try to write a
> > simple xdp program to count the number of TCP and UDP packets I receive.
> > For that, I created a BPF_MAP_TYPE_ARRAY map in my kern.c file. I can
> > read into this map with the bpf_map_lookup_elem function but when I try
> > to update a value, I have an error message "libbpf: load bpf program
> > failed: Permission denied". To solve this issue, I've try to run it in
> > sudo, I've verify my kernel configuration (everything needed seems
> > enable) ....
> 
> What's the error message when you are trying to load your program with sudo?

That information would be helpful as some distros will not run some of
the sample BPF programs without some ulimit changes.  For example the
command:

# ulimit -l 1024

or even

# ulimit -l $VERY_LARGE_VALUE

may be needed on Fedora or Ubuntu, but not on other distros.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [xdp-tutorial] : permission denied when I try to execute a program
  2019-09-26 12:34   ` Andy Gospodarek
@ 2019-09-26 12:41     ` Anton Protopopov
  0 siblings, 0 replies; 4+ messages in thread
From: Anton Protopopov @ 2019-09-26 12:41 UTC (permalink / raw)
  To: Andy Gospodarek; +Cc: Théo Mainguet, xdp-newbies

чт, 26 сент. 2019 г. в 08:34, Andy Gospodarek <andy@greyhouse.net>:
>
> On Thu, Sep 26, 2019 at 08:17:48AM -0400, Anton Protopopov wrote:
> > чт, 26 сент. 2019 г. в 05:22, Théo Mainguet <theo.mainguet.etu@univ-lille.fr>:
> > >
> > > Hi,
> > >
> > >
> > > Thank you very much for your xdp tutorial. Currently, I try to write a
> > > simple xdp program to count the number of TCP and UDP packets I receive.
> > > For that, I created a BPF_MAP_TYPE_ARRAY map in my kern.c file. I can
> > > read into this map with the bpf_map_lookup_elem function but when I try
> > > to update a value, I have an error message "libbpf: load bpf program
> > > failed: Permission denied". To solve this issue, I've try to run it in
> > > sudo, I've verify my kernel configuration (everything needed seems
> > > enable) ....
> >
> > What's the error message when you are trying to load your program with sudo?
>
> That information would be helpful as some distros will not run some of
> the sample BPF programs without some ulimit changes.  For example the
> command:
>
> # ulimit -l 1024
>
> or even
>
> # ulimit -l $VERY_LARGE_VALUE
>
> may be needed on Fedora or Ubuntu, but not on other distros.
>

Or even

# ulimit -l unlimited

:-)

Also this can be done from the loader itself, as, e.g., here:
https://github.com/xdp-project/xdp-tutorial/blob/master/advanced03-AF_XDP/af_xdp_user.c#L557

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-26 12:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-25  9:10 [xdp-tutorial] : permission denied when I try to execute a program Théo Mainguet
2019-09-26 12:17 ` Anton Protopopov
2019-09-26 12:34   ` Andy Gospodarek
2019-09-26 12:41     ` Anton Protopopov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.