Re: [PATCH bpf-next 5/5] selftests/bpf: add benchmark for uprobe vs. user_prog

2020-08-05 Thread Alexei Starovoitov
On Wed, Aug 05, 2020 at 10:27:28AM -0700, Andrii Nakryiko wrote: > On Wed, Aug 5, 2020 at 10:16 AM Alexei Starovoitov > wrote: > > > > On Wed, Aug 05, 2020 at 04:47:30AM +, Song Liu wrote: > > > > > > Being able to trigger BPF program on a different C

Re: [PATCH bpf-next 5/5] selftests/bpf: add benchmark for uprobe vs. user_prog

2020-08-05 Thread Alexei Starovoitov
On Wed, Aug 05, 2020 at 04:47:30AM +, Song Liu wrote: > > Being able to trigger BPF program on a different CPU could enable many > use cases and optimizations. The use case I am looking at is to access > perf_event and percpu maps on the target CPU. For example: > 0. trigger the program

Re: [PATCH bpf-next] bpf: fix build on architectures with special bpf_user_pt_regs_t

2020-07-25 Thread Alexei Starovoitov
On Fri, Jul 24, 2020 at 1:08 PM Song Liu wrote: > > Architectures like s390, powerpc, arm64, riscv have speical definition of > bpf_user_pt_regs_t. So we need to cast the pointer before passing it to > bpf_get_stack(). This is similar to bpf_get_stack_tp(). > > Fixes: 03d42fd2d83f ("bpf: Separate

Re: [PATCH v5 bpf-next 5/5] selftests/bpf: add get_stackid_cannot_attach

2020-07-23 Thread Alexei Starovoitov
On Thu, Jul 23, 2020 at 11:06:48AM -0700, Song Liu wrote: > + pmu_fd = syscall(__NR_perf_event_open, , -1 /* pid */, > + 0 /* cpu 0 */, -1 /* group id */, > + 0 /* flags */); > + if (pmu_fd < 0 && errno == ENOENT) { > +

Re: [PATCH] bpf: BPF_SYSCALL depends INET

2020-07-23 Thread Alexei Starovoitov
On Thu, Jul 23, 2020 at 7:19 AM wrote: > > From: Tom Rix > > A link error > > kernel/bpf/net_namespace.o: In function `bpf_netns_link_release': > net_namespace.c: undefined reference to `bpf_sk_lookup_enabled' > > bpf_sk_lookup_enabled is defined with INET > net_namespace is controlled by

Re: [PATCH v4 bpf-next 2/4] bpf: fail PERF_EVENT_IOC_SET_BPF when bpf_get_[stack|stackid] cannot work

2020-07-23 Thread Alexei Starovoitov
On Wed, Jul 22, 2020 at 11:20 PM Song Liu wrote: > > > > > On Jul 22, 2020, at 10:55 PM, Alexei Starovoitov > > wrote: > > > > On Wed, Jul 22, 2020 at 11:42:08AM -0700, Song Liu wrote: > >> diff --git a/kernel/events/core.c b/kernel/events/core.c >

Re: [PATCH v4 bpf-next 2/4] bpf: fail PERF_EVENT_IOC_SET_BPF when bpf_get_[stack|stackid] cannot work

2020-07-22 Thread Alexei Starovoitov
On Wed, Jul 22, 2020 at 11:42:08AM -0700, Song Liu wrote: > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 856d98c36f562..f77d009fcce95 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -9544,6 +9544,24 @@ static int perf_event_set_bpf_handler(struct >

Re: [PATCH bpf-next v5 5/7] bpf: Implement bpf_local_storage for inodes

2020-07-22 Thread Alexei Starovoitov
On Wed, Jul 22, 2020 at 5:22 PM kernel test robot wrote: > > All warnings (new ones prefixed by >>): > >kernel/bpf/bpf_inode_storage.c: In function 'unlink_inode_storage': > >> kernel/bpf/bpf_inode_storage.c:34:32: warning: variable 'smap' set but not > >> used [-Wunused-but-set-variable]

Re: linux-next: manual merge of the bpf-next tree with the net tree

2020-07-22 Thread Alexei Starovoitov
On Wed, Jul 22, 2020 at 8:50 AM Willem de Bruijn wrote: > > > TBH, I don't what is the preferred way to handle it. Perhaps DaveM or > > Alexei/Daniel can say what would make their life easiest? > > Good point. > > With the above, there still remains a merge conflict, of course. But > then we can

Re: get rid of the address_space override in setsockopt

2020-07-22 Thread Alexei Starovoitov
On Wed, Jul 22, 2020 at 12:56 AM Christoph Hellwig wrote: > > On Mon, Jul 20, 2020 at 01:47:56PM -0700, Alexei Starovoitov wrote: > > > a kernel pointer. This is something that works for most common sockopts > > > (and is something that the ePBF support relie

Re: [PATCH v3 bpf-next 1/2] bpf: separate bpf_get_[stack|stackid] for perf events BPF

2020-07-21 Thread Alexei Starovoitov
On Tue, Jul 21, 2020 at 3:40 PM Song Liu wrote: > > We only need to block precise_ip >= 2. precise_ip == 1 is OK. Are you sure? intel_pmu_hw_config() has: if (event->attr.precise_ip) { if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) event->attr.sample_type |=

Re: [PATCH bpf-next v1 0/3] bpf, riscv: Add compressed instructions to rv64 JIT

2020-07-21 Thread Alexei Starovoitov
On Tue, Jul 21, 2020 at 12:27 AM Björn Töpel wrote: > > On Tue, 21 Jul 2020 at 04:52, Luke Nelson wrote: > > > > This patch series enables using compressed riscv (RVC) instructions > > in the rv64 BPF JIT. > > > > RVC is a standard riscv extension that adds a set of compressed, > > 2-byte

Re: [PATCH v2] tools/bpftool: Fix error handing in do_skeleton()

2020-07-21 Thread Alexei Starovoitov
On Fri, Jul 17, 2020 at 5:31 AM YueHaibing wrote: > > Fix pass 0 to PTR_ERR, also dump more err info using > libbpf_strerror. > > Fixes: 5dc7a8b21144 ("bpftool, selftests/bpf: Embed object file inside > skeleton") > Signed-off-by: YueHaibing > Reviewed-by: Quentin Monnet Applied. Thanks

Re: [PATCH v2] libbpf bpf_helpers: Use __builtin_offsetof for offsetof

2020-07-21 Thread Alexei Starovoitov
On Sun, Jul 19, 2020 at 11:21 PM Andrii Nakryiko wrote: > > On Sun, Jul 19, 2020 at 11:18 PM Ian Rogers wrote: > > > > The non-builtin route for offsetof has a dependency on size_t from > > stdlib.h/stdint.h that is undeclared and may break targets. > > The offsetof macro in bpf_helpers may

Re: [PATCH] ebpf: fix parameter naming confusing

2020-07-21 Thread Alexei Starovoitov
On Thu, Jul 16, 2020 at 7:08 PM YangYuxi wrote: > > Signed-off-by: YangYuxi > --- > kernel/bpf/syscall.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c > index 0fd80ac81f70..300ae16baffc 100644 > ---

Re: [PATCH v3 bpf-next 1/2] bpf: separate bpf_get_[stack|stackid] for perf events BPF

2020-07-21 Thread Alexei Starovoitov
On Thu, Jul 16, 2020 at 03:59:32PM -0700, Song Liu wrote: > + > +BPF_CALL_3(bpf_get_stackid_pe, struct bpf_perf_event_data_kern *, ctx, > +struct bpf_map *, map, u64, flags) > +{ > + struct perf_event *event = ctx->event; > + struct perf_callchain_entry *trace; > + bool

Re: get rid of the address_space override in setsockopt

2020-07-20 Thread Alexei Starovoitov
On Mon, Jul 20, 2020 at 02:47:13PM +0200, Christoph Hellwig wrote: > Hi Dave, > > setsockopt is the last place in architecture-independ code that still > uses set_fs to force the uaccess routines to operate on kernel pointers. > > This series adds a new sockptr_t type that can contained either a

Re: [PATCH bpf-next] bpf: allow loading instructions from a fd

2020-07-20 Thread Alexei Starovoitov
On Thu, Jul 16, 2020 at 08:47:36PM +0200, Matteo Croce wrote: > On Tue, Jul 14, 2020 at 7:31 PM Alexei Starovoitov > wrote: > > > > On Mon, Jul 13, 2020 at 03:05:11PM +0200, Matteo Croce wrote: > > > From: Matteo Croce > > > > > > Allow to lo

Re: linux-next: Tree for Jul 20 (kernel/bpf/net_namespace)

2020-07-20 Thread Alexei Starovoitov
On Mon, Jul 20, 2020 at 11:49 AM Stephen Rothwell wrote: > > Hi all, > > On Mon, 20 Jul 2020 08:51:54 -0700 Randy Dunlap wrote: > > > > on i386 or x86_64: > > > > # CONFIG_INET is not set > > # CONFIG_NET_NS is not set > > > > ld: kernel/bpf/net_namespace.o: in function `bpf_netns_link_release':

Re: [merged][PATCH v3 00/16] Make the user mode driver code a better citizen

2020-07-14 Thread Alexei Starovoitov
On Thu, Jul 09, 2020 at 05:05:09PM -0500, Eric W. Biederman wrote: > > I have merged all of this into my exec-next tree. > > The code is also available on the frozen branch: > >git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git > usermode-driver-cleanup > >

Re: [PATCH] bpfilter: allow to build bpfilter_umh as a module without static library

2020-07-14 Thread Alexei Starovoitov
On Wed, Jul 1, 2020 at 10:50 AM Masahiro Yamada wrote: > > On Thu, Jul 2, 2020 at 2:46 AM Alexei Starovoitov > wrote: > > > > On Wed, Jul 01, 2020 at 06:26:44PM +0900, Masahiro Yamada wrote: > > > Originally, bpfilter_umh was linked with -static only wh

Re: [PATCH bpf-next] bpf: allow loading instructions from a fd

2020-07-14 Thread Alexei Starovoitov
On Mon, Jul 13, 2020 at 03:05:11PM +0200, Matteo Croce wrote: > From: Matteo Croce > > Allow to load the BPF instructons from a file descriptor, > other than a pointer. > > This is required by the Integrity Subsystem to validate the source of > the instructions. > > In bpf_attr replace

Re: [Linux-kernel-mentees] [PATCH v2] bpf: Fix NULL pointer dereference in __btf_resolve_helper_id()

2020-07-14 Thread Alexei Starovoitov
On Mon, Jul 13, 2020 at 9:38 PM Andrii Nakryiko wrote: > > On Mon, Jul 13, 2020 at 6:29 PM Peilin Ye wrote: > > > > Prevent __btf_resolve_helper_id() from dereferencing `btf_vmlinux` > > as NULL. This patch fixes the following syzbot bug: > > > > > >

Re: linux-next: build warning after merge of the bpf-next tree

2020-07-14 Thread Alexei Starovoitov
On Tue, Jul 14, 2020 at 4:15 AM Jiri Olsa wrote: > > On Tue, Jul 14, 2020 at 12:47:02PM +0200, Jiri Olsa wrote: > > On Tue, Jul 14, 2020 at 08:33:41PM +1000, Stephen Rothwell wrote: > > > > SNIP > > > > > > diff --git a/tools/bpf/resolve_btfids/Makefile > > > >

Re: [PATCH v3 bpf-next 0/2] bpf: fix use of trace_printk() in BPF

2020-07-13 Thread Alexei Starovoitov
On Mon, Jul 13, 2020 at 4:53 AM Alan Maguire wrote: > > Steven suggested a way to resolve the appearance of the warning banner > that appears as a result of using trace_printk() in BPF [1]. > Applying the patch and testing reveals all works as expected; we > can call bpf_trace_printk() and see

Re: [PATCH v3 13/16] exit: Factor thread_group_exited out of pidfd_poll

2020-07-03 Thread Alexei Starovoitov
On Fri, Jul 03, 2020 at 04:37:47PM -0500, Eric W. Biederman wrote: > > > The rest all looks good to me. Tested with and without bpf_preload patches. > > Feel free to create a frozen branch with this set. > > Can I have your Tested-by and Acked-by? For the set: Acked-b

Re: [PATCH v3 13/16] exit: Factor thread_group_exited out of pidfd_poll

2020-07-03 Thread Alexei Starovoitov
On Thu, Jul 02, 2020 at 11:41:37AM -0500, Eric W. Biederman wrote: > Create an independent helper thread_group_exited report return true > when all threads have passed exit_notify in do_exit. AKA all of the > threads are at least zombies and might be dead or completely gone. > > Create this

Re: [PATCH] Replace HTTP links with HTTPS ones: BPF (Safe dynamic programs and tools)

2020-07-02 Thread Alexei Starovoitov
c | 2 +- > tools/lib/bpf/bpf.h | 2 +- > tools/testing/selftests/bpf/test_maps.c | 2 +- > tools/testing/selftests/bpf/test_verifier.c | 2 +- > 34 files changed, 35 insertions(+), 35 deletions(-) Nacked-by: Alexei Starovoitov Pls don't touch anything bpf related with such changes.

Re: [PATCH bpf-next v2] selftests/bpf: Switch test_vmlinux to use hrtimer_range_start_ns.

2020-07-01 Thread Alexei Starovoitov
On Wed, Jul 1, 2020 at 11:04 AM Yonghong Song wrote: > > > > On 7/1/20 10:53 AM, Hao Luo wrote: > > The test_vmlinux test uses hrtimer_nanosleep as hook to test tracing > > programs. But in a kernel built by clang, which performs more aggresive > > inlining, that function gets inlined into its

Re: [PATCH] bpfilter: allow to build bpfilter_umh as a module without static library

2020-07-01 Thread Alexei Starovoitov
On Wed, Jul 01, 2020 at 06:26:44PM +0900, Masahiro Yamada wrote: > Originally, bpfilter_umh was linked with -static only when > CONFIG_BPFILTER_UMH=y. > > Commit 8a2cc0505cc4 ("bpfilter: use 'userprogs' syntax to build > bpfilter_umh") silently, accidentally dropped the CONFIG_BPFILTER_UMH=y >

Re: [PATCH v2 05/15] umh: Separate the user mode driver and the user mode helper support

2020-07-01 Thread Alexei Starovoitov
On Wed, Jul 1, 2020 at 10:23 AM Eric W. Biederman wrote: > > Linus Torvalds writes: > > > On Mon, Jun 29, 2020 at 1:05 PM Eric W. Biederman > > wrote: > >> > >> This makes it clear which code is part of the core user mode > >> helper support and which code is needed to implement user mode > >>

Re: [PATCH 01/18] tools: bpf: Use local copy of headers including uapi/linux/filter.h

2020-07-01 Thread Alexei Starovoitov
d by the 'headers_install' target) into tools/include/uapi/linux/ > and adjust the BPF tool Makefile to reference the local include > directories instead of those in the main source tree. > > Cc: Alexei Starovoitov > Cc: Masahiro Yamada > Suggested-by: Daniel Borkmann > Reported-by: Xiao Yang > Signed-off-by: Will Deacon Acked-by: Alexei Starovoitov

Re: [PATCH -next] bpf: fix net/core/filter build errors when INET is not enabled

2020-07-01 Thread Alexei Starovoitov
t' > > (.text+0x2b3b): undefined reference to `tcp_prot' > > > > Signed-off-by: Randy Dunlap > > Cc: Alexei Starovoitov > > Cc: Daniel Borkmann > > Cc: Martin KaFai Lau > > Cc: Song Liu > > Cc: Yonghong Song > > Cc: Andrii Nakryiko > > Cc: Jo

Re: [PATCH v5 bpf-next 0/4] bpf: introduce bpf_get_task_stack()

2020-07-01 Thread Alexei Starovoitov
On Mon, Jun 29, 2020 at 11:28 PM Song Liu wrote: > > This set introduces a new helper bpf_get_task_stack(). The primary use case > is to dump all /proc/*/stack to seq_file via bpf_iter__task. > > A few different approaches have been explored and compared: > > 1. A simple wrapper around

Re: [PATCH v2 10/15] exec: Remove do_execve_file

2020-06-30 Thread Alexei Starovoitov
On Tue, Jun 30, 2020 at 09:28:10AM -0500, Eric W. Biederman wrote: > Christoph Hellwig writes: > > > On Tue, Jun 30, 2020 at 07:14:23AM -0500, Eric W. Biederman wrote: > >> Christoph Hellwig writes: > >> > >> > FYI, this clashes badly with my exec rework. I'd suggest you > >> > drop

Re: [PATCH v2 00/15] Make the user mode driver code a better citizen

2020-06-30 Thread Alexei Starovoitov
On Tue, Jun 30, 2020 at 07:29:34AM -0500, Eric W. Biederman wrote: > > diff --git a/net/bpfilter/bpfilter_kern.c b/net/bpfilter/bpfilter_kern.c > index 91474884ddb7..3e1874030daa 100644 > --- a/net/bpfilter/bpfilter_kern.c > +++ b/net/bpfilter/bpfilter_kern.c > @@ -19,8 +19,8 @@ static void

Re: [PATCH 04/16] net: bpfilter: use 'userprogs' syntax to build bpfilter_umh

2020-06-30 Thread Alexei Starovoitov
On Tue, Jun 30, 2020 at 03:30:04PM +0900, Masahiro Yamada wrote: > Hi Michal, Alexei, > > On Mon, Jun 8, 2020 at 8:56 PM Michal Kubecek wrote: > > > > On Thu, Apr 23, 2020 at 04:39:17PM +0900, Masahiro Yamada wrote: > > > The user mode helper should be compiled for the same architecture as > > >

Re: [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option

2020-06-29 Thread Alexei Starovoitov
On Sun, Jun 28, 2020 at 07:43:34PM -0400, Steven Rostedt wrote: > On Sun, 28 Jun 2020 18:28:42 -0400 > Steven Rostedt wrote: > > > You create a bpf event just like you create any other event. When a bpf > > program that uses a bpf_trace_printk() is loaded, you can enable that > > event from

Re: [PATCH v4 bpf-next 2/4] bpf: introduce helper bpf_get_task_stack()

2020-06-29 Thread Alexei Starovoitov
On Sun, Jun 28, 2020 at 10:58 PM Song Liu wrote: > > Introduce helper bpf_get_task_stack(), which dumps stack trace of given > task. This is different to bpf_get_stack(), which gets stack track of > current task. One potential use case of bpf_get_task_stack() is to call > it from bpf_iter__task

Re: [PATCH v2 00/15] Make the user mode driver code a better citizen

2020-06-29 Thread Alexei Starovoitov
On Mon, Jun 29, 2020 at 02:55:05PM -0500, Eric W. Biederman wrote: > > I have tested thes changes by booting with the code compiled in and > by killing "bpfilter_umh" and running iptables -vnL to restart > the userspace driver. > > I have compiled tested each change with and without

Re: [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option

2020-06-28 Thread Alexei Starovoitov
On Sun, Jun 28, 2020 at 03:43:31PM -0400, Steven Rostedt wrote: > On Sun, 28 Jun 2020 12:21:07 -0700 > Alexei Starovoitov wrote: > > > > Re-teach them, or are you finally admitting that the tracing system is > > > a permanent API? This is the reason peopl

Re: [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option

2020-06-28 Thread Alexei Starovoitov
On Sun, Jun 28, 2020 at 02:46:16PM -0400, Steven Rostedt wrote: > > > > By now everyone has learned to use bpf_trace_printk() and expects > > to see the output in /sys/kernel/debug/tracing/trace. > > It's documented in uapi/bpf.h and various docs. > > Re-teach them, or are you finally admitting

Re: [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option

2020-06-28 Thread Alexei Starovoitov
On Fri, Jun 26, 2020 at 06:14:55PM -0400, Steven Rostedt wrote: > On Wed, 24 Jun 2020 20:59:13 -0700 > Alexei Starovoitov wrote: > > > > > > > > > Nack. > > I nack your nack ;-) ok. let's take it up to Linus to decide. > > > > >

Re: [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option

2020-06-24 Thread Alexei Starovoitov
On Thu, Jun 25, 2020 at 10:00:09AM +0800, Nicolas Boichat wrote: > On Thu, Jun 25, 2020 at 1:25 AM Alexei Starovoitov > wrote: > > > > On Wed, Jun 24, 2020 at 9:07 AM Steven Rostedt wrote: > > > > > > On Wed, 24 Jun 2020 16:45:24 +0800 > > > Nicol

Re: [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option

2020-06-24 Thread Alexei Starovoitov
On Wed, Jun 24, 2020 at 9:07 AM Steven Rostedt wrote: > > On Wed, 24 Jun 2020 16:45:24 +0800 > Nicolas Boichat wrote: > > > trace_printk is only meant as a debugging tool, and should never be > > compiled into production code without source code changes, as > > indicated by the warning that

Re: [PATCH bpf v2] restore behaviour of CAP_SYS_ADMIN allowing the loading of networking bpf programs

2020-06-23 Thread Alexei Starovoitov
DMIN but not NET_ADMIN) and creates maps and loads bpf programs > > for later use by Android's netd (which has NET_ADMIN but not SYS_ADMIN). > > > > Cc: Alexei Starovoitov > > Cc: Daniel Borkmann > > Reported-by: John Stultz > > Fixes: 2c78ee898d8f ("b

Re: [PATCH] restore behaviour of CAP_SYS_ADMIN allowing the loading of net bpf program

2020-06-18 Thread Alexei Starovoitov
On Thu, Jun 18, 2020 at 1:00 PM Maciej Żenczykowski wrote: > > From: Maciej Żenczykowski > > This is a 5.8-rc1 regression. Please add full explanation here. Also use [PATCH bpf] in the subject for future submission. > Cc: Alexei Starovoitov > Cc: Daniel Borkmann > Fixe

Re: [PATCH bpf 1/2] flow_dissector: reject invalid attach_flags

2020-06-16 Thread Alexei Starovoitov
On Tue, Jun 16, 2020 at 1:30 AM Lorenz Bauer wrote: > > On Tue, 16 Jun 2020 at 04:55, Alexei Starovoitov > wrote: > > > > On Mon, Jun 15, 2020 at 7:43 AM Lorenz Bauer wrote: > > > > > > On Fri, 12 Jun 2020 at 23:36, Alexei Starovoitov > > > wro

Re: [PATCH bpf 1/2] flow_dissector: reject invalid attach_flags

2020-06-15 Thread Alexei Starovoitov
On Mon, Jun 15, 2020 at 7:43 AM Lorenz Bauer wrote: > > On Fri, 12 Jun 2020 at 23:36, Alexei Starovoitov > wrote: > > > > On Fri, Jun 12, 2020 at 9:02 AM Lorenz Bauer wrote: > > > > > > Using BPF_PROG_ATTACH on a flow dissector program supports neither fl

Re: [PATCH bpf 1/2] flow_dissector: reject invalid attach_flags

2020-06-12 Thread Alexei Starovoitov
On Fri, Jun 12, 2020 at 9:02 AM Lorenz Bauer wrote: > > Using BPF_PROG_ATTACH on a flow dissector program supports neither flags > nor target_fd but accepts any value. Return EINVAL if either are non-zero. > > Signed-off-by: Lorenz Bauer > Fixes: b27f7bb590ba ("flow_dissector: Move out netns_bpf

Re: [PATCH bpf] bpf: cgroup: allow multi-attach program to replace itself

2020-06-09 Thread Alexei Starovoitov
On Mon, Jun 8, 2020 at 9:22 AM Lorenz Bauer wrote: > > When using BPF_PROG_ATTACH to attach a program to a cgroup in > BPF_F_ALLOW_MULTI mode, it is not possible to replace a program > with itself. This is because the check for duplicate programs > doesn't take the replacement program into

Re: [PATCH] tracing/probe: Fix bpf_task_fd_query() for kprobes and uprobes

2020-06-09 Thread Alexei Starovoitov
On Tue, Jun 9, 2020 at 12:12 AM Masami Hiramatsu wrote: > > On Mon, 8 Jun 2020 14:45:32 +0200 > Jean-Philippe Brucker wrote: > > > Commit 60d53e2c3b75 ("tracing/probe: Split trace_event related data from > > trace_probe") removed the trace_[ku]probe structure from the > > trace_event_call->data

Re: WARNING: CPU: 1 PID: 52 at mm/page_alloc.c:4826 __alloc_pages_nodemask (Re: [PATCH 5/5] sysctl: pass kernel pointers to ->proc_handler)

2020-06-08 Thread Alexei Starovoitov
On Mon, Jun 8, 2020 at 6:05 AM Christoph Hellwig wrote: > > On Mon, Jun 08, 2020 at 09:45:49AM +0200, Vegard Nossum wrote: > > Just a test case. > > > > Allowing the kernel to allocate an unbounded amount of memory on behalf > > of userspace is an easy DOS. > > > > All the length checks were

Re: [GIT PULL] SELinux patches for v5.8

2020-06-03 Thread Alexei Starovoitov
On Wed, Jun 03, 2020 at 03:00:05PM -0700, Casey Schaufler wrote: > On 6/3/2020 2:02 PM, Alexei Starovoitov wrote: > > On Wed, Jun 03, 2020 at 10:37:47AM -0700, Linus Torvalds wrote: > >> On Wed, Jun 3, 2020 at 10:20 AM Casey Schaufler > >> wrote: > >>> We c

Re: [GIT PULL] SELinux patches for v5.8

2020-06-03 Thread Alexei Starovoitov
On Wed, Jun 03, 2020 at 10:37:47AM -0700, Linus Torvalds wrote: > On Wed, Jun 3, 2020 at 10:20 AM Casey Schaufler > wrote: > > > > We could have inode->i_security be the blob, rather than a pointer to it. > > That will have its own performance issues. > > It wouldn't actually really fix

Re: [PATCH bpf] bpf: fix unused-var without NETDEVICES

2020-06-03 Thread Alexei Starovoitov
On Wed, Jun 3, 2020 at 11:41 AM Matthieu Baerts wrote: > > Hi Alexei, > > On 03/06/2020 20:14, Alexei Starovoitov wrote: > > On Wed, Jun 03, 2020 at 11:12:01AM +0200, Matthieu Baerts wrote: > >> Hi Ferenc, > >> > >> On 03/06/2020 10:56, Ferenc Fejes wr

Re: [PATCH bpf] bpf: fix unused-var without NETDEVICES

2020-06-03 Thread Alexei Starovoitov
On Wed, Jun 03, 2020 at 11:12:01AM +0200, Matthieu Baerts wrote: > Hi Ferenc, > > On 03/06/2020 10:56, Ferenc Fejes wrote: > > Matthieu Baerts ezt írta (időpont: > > 2020. jún. 3., Sze, 10:11): > > > > > > A recent commit added new variables only used if CONFIG_NETDEVICES is > > > set. > > > >

Re: [PATCH v2 net-next 0/3] Extending bpf_setsockopt with SO_BINDTODEVICE sockopt

2020-06-01 Thread Alexei Starovoitov
On Sat, May 30, 2020 at 2:11 PM Ferenc Fejes wrote: > > This option makes it possible to programatically bind sockets > to netdevices. With the help of this option sockets > of VRF unaware applications could be distributed between > multiple VRFs with an eBPF program. This lets the applications >

Re: [PATCH] bpf: Change kvfree to kfree in generic_map_lookup_batch()

2020-06-01 Thread Alexei Starovoitov
On Mon, Jun 1, 2020 at 1:18 PM Song Liu wrote: > > On Mon, Jun 1, 2020 at 9:29 AM Denis Efremov wrote: > > > > buf_prevkey in generic_map_lookup_batch() is allocated with > > kmalloc(). It's safe to free it with kfree(). > > > > Signed-off-by: Denis Efremov > > Please add prefix "PATCH bpf" or

Re: [PATCH 9/9] bpf: make bpf_check_uarg_tail_zero() use check_zeroed_user()

2020-05-31 Thread Alexei Starovoitov
On Sat, May 30, 2020 at 12:28:14AM +0100, Al Viro wrote: > From: Al Viro > > ... rather than open-coding it, and badly, at that. > > Signed-off-by: Al Viro > --- > kernel/bpf/syscall.c | 25 ++--- > 1 file changed, 6 insertions(+), 19 deletions(-

Re: [PATCH bpf-next 2/4] bpf: Implement bpf_local_storage for inodes

2020-05-26 Thread Alexei Starovoitov
On Tue, May 26, 2020 at 06:33:34PM +0200, KP Singh wrote: > > +static struct bpf_local_storage_data *inode_storage_update( > + struct inode *inode, struct bpf_map *map, void *value, u64 map_flags) > +{ > + struct bpf_local_storage_data *old_sdata = NULL; > + struct

Re: [PATCH bpf] security: Fix hook iteration for secid_to_secctx

2020-05-20 Thread Alexei Starovoitov
On Wed, May 20, 2020 at 7:02 PM James Morris wrote: > > On Wed, 20 May 2020, Alexei Starovoitov wrote: > > > On Wed, May 20, 2020 at 8:15 AM Casey Schaufler > > wrote: > > > > > > > > > On 5/20/2020 5:56 AM, KP Singh wrote: > &g

Re: [PATCH bpf] security: Fix hook iteration for secid_to_secctx

2020-05-20 Thread Alexei Starovoitov
: > > //lore.kernel.org/bpf/9d0eb6c6-803a-ff3a-5603-9ad6d9edf...@schaufler-ca.com/#t > > > > Fixes: 98e828a0650f ("security: Refactor declaration of LSM hooks") > > Fixes: 625236ba3832 ("security: Fix the default value of secid_to_secctx > > hook

Re: seccomp feature development

2020-05-19 Thread Alexei Starovoitov
On Wed, May 20, 2020 at 11:20:45AM +1000, Aleksa Sarai wrote: > > No it won't become copy_from_user(), nor will there be a TOCTOU race. > > The idea is that seccomp will proactively copy the struct (and > recursively any of the struct pointers inside) before the syscall runs > -- as this is done

Re: seccomp feature development

2020-05-19 Thread Alexei Starovoitov
On Mon, May 18, 2020 at 7:53 PM Aleksa Sarai wrote: > > On 2020-05-19, Jann Horn wrote: > > On Mon, May 18, 2020 at 11:05 PM Kees Cook wrote: > > > ## deep argument inspection > > > > > > Background: seccomp users would like to write filters that traverse > > > the user pointers passed into

Re: [PATCH] security: fix the default value of secid_to_secctx hook

2020-05-15 Thread Alexei Starovoitov
On Thu, May 14, 2020 at 12:47 PM Alexei Starovoitov wrote: > > On Thu, May 14, 2020 at 12:43 PM James Morris > wrote: > > > > On Wed, 13 May 2020, Alexei Starovoitov wrote: > > > > > James, > > > > > > since you took the previous similar

Re: [PATCH][next] selftest/bpf: fix spelling mistake "SIGALARM" -> "SIGALRM"

2020-05-14 Thread Alexei Starovoitov
On Thu, May 14, 2020 at 8:01 AM Yonghong Song wrote: > > > > On 5/14/20 5:15 AM, Colin King wrote: > > From: Colin Ian King > > > > There is a spelling mistake in an error message, fix it. > > > > Signed-off-by: Colin Ian King > Acked-by: Yonghong Song Applied. Thanks

Re: [PATCH v2 bpf-next 4/7] printk: add type-printing %pT format specifier which uses BTF

2020-05-14 Thread Alexei Starovoitov
On Thu, May 14, 2020 at 04:43:24PM -0700, Joe Perches wrote: > The ``BTF_INT_BITS()`` specifies the number of actual bits held by this int > type. For example, a 4-bit bitfield encodes ``BTF_INT_BITS()`` equals to 4. > diff --git a/include/uapi/linux/btf.h b/include/uapi/linux/btf.h > index

Re: [PATCH] security: fix the default value of secid_to_secctx hook

2020-05-14 Thread Alexei Starovoitov
On Thu, May 14, 2020 at 12:43 PM James Morris wrote: > > On Wed, 13 May 2020, Alexei Starovoitov wrote: > > > James, > > > > since you took the previous similar patch are you going to pick this > > one up as well? > > Or we can route it via bpf tree t

Re: [PATCH bpf] samples: bpf: fix build error

2020-05-14 Thread Alexei Starovoitov
On Mon, May 11, 2020 at 1:32 PM Yonghong Song wrote: > > > > On 5/11/20 4:32 AM, Matteo Croce wrote: > > GCC 10 is very strict about symbol clash, and lwt_len_hist_user contains > > a symbol which clashes with libbpf: > > > > /usr/bin/ld: samples/bpf/lwt_len_hist_user.o:(.bss+0x0): multiple > >

Re: [PATCH v2 bpf-next 4/7] printk: add type-printing %pT format specifier which uses BTF

2020-05-13 Thread Alexei Starovoitov
On Wed, May 13, 2020 at 4:05 PM Joe Perches wrote: > > On Tue, 2020-05-12 at 06:56 +0100, Alan Maguire wrote: > > printk supports multiple pointer object type specifiers (printing > > netdev features etc). Extend this support using BTF to cover > > arbitrary types. "%pT" specifies the typed

Re: [PATCH v2 bpf-next 0/7] bpf, printk: add BTF-based type printing

2020-05-13 Thread Alexei Starovoitov
On Wed, May 13, 2020 at 3:48 PM Joe Perches wrote: > > On Wed, 2020-05-13 at 15:24 -0700, Alexei Starovoitov wrote: > > On Tue, May 12, 2020 at 06:56:38AM +0100, Alan Maguire wrote: > > > The printk family of functions support printing specific pointer types > > > u

Re: [PATCH v2 bpf-next 0/7] bpf, printk: add BTF-based type printing

2020-05-13 Thread Alexei Starovoitov
On Tue, May 12, 2020 at 06:56:38AM +0100, Alan Maguire wrote: > The printk family of functions support printing specific pointer types > using %p format specifiers (MAC addresses, IP addresses, etc). For > full details see Documentation/core-api/printk-formats.rst. > > This patchset proposes

Re: [PATCH] security: fix the default value of secid_to_secctx hook

2020-05-13 Thread Alexei Starovoitov
James, since you took the previous similar patch are you going to pick this one up as well? Or we can route it via bpf tree to Linus asap. Thanks On Tue, May 12, 2020 at 10:46 AM Anders Roxell wrote: > > security_secid_to_secctx is called by the bpf_lsm hook and a successful > return value

Re: [PATCH] bpfilter: check if $(CC) can static link in Kconfig

2020-05-09 Thread Alexei Starovoitov
; Signed-off-by: Masahiro Yamada Thanks! Acked-by: Alexei Starovoitov

Re: [PATCH] bpf: Tweak BPF jump table optimizations for objtool compatibility

2020-05-08 Thread Alexei Starovoitov
On Thu, May 07, 2020 at 09:07:33AM -0500, Josh Poimboeuf wrote: > On Wed, May 06, 2020 at 05:03:57PM -0700, Alexei Starovoitov wrote: > > > > > > diff --git a/include/linux/compiler-gcc.h > > > > > > b/include/linux/compiler-gcc.h > > &g

Re: [PATCH bpf] security: Fix the default value of fs_context_parse_param hook

2020-05-06 Thread Alexei Starovoitov
On Thu, Apr 30, 2020 at 8:46 PM James Morris wrote: > > On Thu, 30 Apr 2020, KP Singh wrote: > > > From: KP Singh > > > > Applied to: > git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git > for-v5.7 > James, could you please send PR to Linus this week to make sure the fix

Re: pulling cap_perfmon

2020-05-06 Thread Alexei Starovoitov
On Wed, May 6, 2020 at 2:51 PM Thomas Gleixner wrote: > > Alexei, > > Thomas Gleixner writes: > > Alexei Starovoitov writes: > >> > >> I'd like to pull > >> commit 980737282232 ("capabilities: Introduce CAP_PERFMON to kernel > >>

Re: [PATCH] bpf: Tweak BPF jump table optimizations for objtool compatibility

2020-05-06 Thread Alexei Starovoitov
On Wed, May 06, 2020 at 04:19:45PM -0500, Josh Poimboeuf wrote: > On Wed, May 06, 2020 at 09:45:01AM -0700, Alexei Starovoitov wrote: > > On Wed, May 6, 2020 at 8:53 AM Josh Poimboeuf wrote: > > > > > > On Tue, May 05, 2020 at 04:59:39PM -0700, Alexei Starov

Re: pulling cap_perfmon

2020-05-06 Thread Alexei Starovoitov
On Mon, May 4, 2020 at 1:52 PM Alexei Starovoitov wrote: > > On Thu, Apr 30, 2020 at 11:03 AM Alexei Starovoitov > wrote: > > > > Hi Ingo, > > > > I'd like to pull > > commit 980737282232 ("capabilities: Introduce CAP_PERFMON to kernel > > and

Re: [PATCH] bpf: Tweak BPF jump table optimizations for objtool compatibility

2020-05-06 Thread Alexei Starovoitov
On Wed, May 6, 2020 at 8:53 AM Josh Poimboeuf wrote: > > On Tue, May 05, 2020 at 04:59:39PM -0700, Alexei Starovoitov wrote: > > As far as workaround I prefer the following: > > From 94bbc27c5a70d78846a5cb675df4cf8732883564 Mon Sep 17 00:00:00 2001 > > From: Alexei Staro

Re: [PATCH 1/1] selftests/bpf: add cls_redirect classifier

2020-05-05 Thread Alexei Starovoitov
On Tue, May 5, 2020 at 6:37 AM Daniel Borkmann wrote: > > On 5/5/20 1:48 AM, Alexei Starovoitov wrote: > > On Sat, May 02, 2020 at 01:48:51AM +0200, Daniel Borkmann wrote: > >> On 4/27/20 11:45 AM, Lorenz Bauer wrote: > >>> On Sun, 26 Apr 2020 at 18:33

Re: [PATCH] bpf: Tweak BPF jump table optimizations for objtool compatibility

2020-05-05 Thread Alexei Starovoitov
On Tue, May 05, 2020 at 03:28:23PM -0500, Josh Poimboeuf wrote: > On Tue, May 05, 2020 at 12:53:20PM -0700, Alexei Starovoitov wrote: > > On Tue, May 05, 2020 at 01:11:08PM -0500, Josh Poimboeuf wrote: > > > On Tue, May 05, 2020 at 10:43:00AM -0700, Alexei Starovoitov wrote: &g

Re: [PATCH] bpf: Tweak BPF jump table optimizations for objtool compatibility

2020-05-05 Thread Alexei Starovoitov
On Tue, May 05, 2020 at 01:11:08PM -0500, Josh Poimboeuf wrote: > On Tue, May 05, 2020 at 10:43:00AM -0700, Alexei Starovoitov wrote: > > > Or, if you want to minimize the patch's impact on other arches, and keep > > > the current patch the way it is (with bug fi

Re: [PATCH] bpf: Tweak BPF jump table optimizations for objtool compatibility

2020-05-05 Thread Alexei Starovoitov
> > Hi, > > I see the objtool warning: > kernel/bpf/core.o: warning: objtool: ___bpf_prog_run()+0x33: call without > frame pointer save/setup > > when using: > gcc (SUSE Linux) 9.3.1 20200406 [revision > 6db837a5288ee3ca5ec504fbd5a765817e556ac2] > > with the attached config file. Thanks

Re: [PATCH] sysctl: fix unused function warning

2020-05-05 Thread Alexei Starovoitov
On Tue, May 5, 2020 at 11:25 AM Song Liu wrote: > > > > > On May 5, 2020, at 7:07 AM, Arnd Bergmann wrote: > > > > The newly added bpf_stats_handler function has the wrong #ifdef > > check around it, leading to an unused-function warning when > > CONFIG_SYSCTL is disabled: > > > >

Re: [PATCH] bpf: Tweak BPF jump table optimizations for objtool compatibility

2020-05-05 Thread Alexei Starovoitov
On Sat, May 02, 2020 at 02:21:05PM -0500, Josh Poimboeuf wrote: > > Ideally we would get rid of that label and just change all the 'goto > select_insn' to 'goto *jumptable[insn->code]'. That allows objtool to > follow the code in both retpoline and non-retpoline cases. It also > simplifies the

Re: [PATCH 1/1] selftests/bpf: add cls_redirect classifier

2020-05-04 Thread Alexei Starovoitov
On Sat, May 02, 2020 at 01:48:51AM +0200, Daniel Borkmann wrote: > On 4/27/20 11:45 AM, Lorenz Bauer wrote: > > On Sun, 26 Apr 2020 at 18:33, Alexei Starovoitov > > wrote: > [...] > > > > +/* Linux packet pointers are either aligned to NET_

Re: pulling cap_perfmon

2020-05-04 Thread Alexei Starovoitov
On Thu, Apr 30, 2020 at 11:03 AM Alexei Starovoitov wrote: > > Hi Ingo, > > I'd like to pull > commit 980737282232 ("capabilities: Introduce CAP_PERFMON to kernel > and user space") > into bpf-next to base my CAP_BPF work on top of it. > could you please p

Re: [PATCH] bpf: Tweak BPF jump table optimizations for objtool compatibility

2020-05-01 Thread Alexei Starovoitov
On Fri, May 01, 2020 at 02:56:17PM -0500, Josh Poimboeuf wrote: > On Fri, May 01, 2020 at 12:40:53PM -0700, Alexei Starovoitov wrote: > > On Fri, May 01, 2020 at 02:22:04PM -0500, Josh Poimboeuf wrote: > > > On Fri, May 01, 2020 at 12:09:30PM -0700, Alexei Starovoitov wrote: >

Re: [PATCH] bpf: Tweak BPF jump table optimizations for objtool compatibility

2020-05-01 Thread Alexei Starovoitov
On Fri, May 01, 2020 at 02:22:04PM -0500, Josh Poimboeuf wrote: > On Fri, May 01, 2020 at 12:09:30PM -0700, Alexei Starovoitov wrote: > > On Thu, Apr 30, 2020 at 02:07:43PM -0500, Josh Poimboeuf wrote: > > > Objtool decodes instructions and follows all potential code bra

Re: [PATCH] bpf: Tweak BPF jump table optimizations for objtool compatibility

2020-05-01 Thread Alexei Starovoitov
On Thu, Apr 30, 2020 at 02:07:43PM -0500, Josh Poimboeuf wrote: > Objtool decodes instructions and follows all potential code branches > within a function. But it's not an emulator, so it doesn't track > register values. For that reason, it usually can't follow > intra-function indirect

Re: BPFilter: bit size mismatch between bpfiter_umh and vmliux

2020-04-30 Thread Alexei Starovoitov
On Thu, Apr 30, 2020 at 9:06 PM Masahiro Yamada wrote: > > Hi Alexei, > > On Wed, Apr 29, 2020 at 1:14 AM Alexei Starovoitov > wrote: > > > > > > At least, the build was successful, > > > but does this work at runtime? > > > > > >

pulling cap_perfmon

2020-04-30 Thread Alexei Starovoitov
Hi Ingo, I'd like to pull commit 980737282232 ("capabilities: Introduce CAP_PERFMON to kernel and user space") into bpf-next to base my CAP_BPF work on top of it. could you please prepare a stable tag for me to pull ? Last release cycle Thomas did a tag for bpf+rt prerequisite patches and it all

Re: BPF vs objtool again

2020-04-29 Thread Alexei Starovoitov
On Wed, Apr 29, 2020 at 10:53:15PM -0500, Josh Poimboeuf wrote: > On Wed, Apr 29, 2020 at 07:10:52PM -0700, Alexei Starovoitov wrote: > > > For example: > > > > > > #define GOTO({ goto *jumptable[insn->code]; }) > > > > > >

Re: BPF vs objtool again

2020-04-29 Thread Alexei Starovoitov
On Wed, Apr 29, 2020 at 07:13:00PM -0500, Josh Poimboeuf wrote: > On Wed, Apr 29, 2020 at 04:41:59PM -0700, Alexei Starovoitov wrote: > > On Wed, Apr 29, 2020 at 04:51:59PM -0500, Josh Poimboeuf wrote: > > > On Thu, Jul 18, 2019 at 12:14:08PM -0700, tip-bot for Josh Poim

Re: BPF vs objtool again

2020-04-29 Thread Alexei Starovoitov
On Wed, Apr 29, 2020 at 04:51:59PM -0500, Josh Poimboeuf wrote: > On Thu, Jul 18, 2019 at 12:14:08PM -0700, tip-bot for Josh Poimboeuf wrote: > > Commit-ID: 3193c0836f203a91bef96d88c64cccf0be090d9c > > Gitweb: > > https://git.kernel.org/tip/3193c0836f203a91bef96d88c64cccf0be090d9c > >

Re: linux-next: manual merge of the akpm-current tree with the bpf-next tree

2020-04-29 Thread Alexei Starovoitov
On Tue, Apr 28, 2020 at 11:47 PM Christoph Hellwig wrote: > > On Wed, Apr 29, 2020 at 04:45:07PM +1000, Stephen Rothwell wrote: > > Hi all, > > > > Today's linux-next merge of the akpm-current tree got a conflict in: > > > > kernel/sysctl.c > > > > between commit: > > > > f461d2dcd511

Re: [PATCH] [RFC] net: bpf: make __bpf_skb_max_len(skb) an skb-independent constant

2020-04-28 Thread Alexei Starovoitov
On Tue, Apr 21, 2020 at 01:36:08PM -0700, Maciej Żenczykowski wrote: > > > This function is used from: > > > bpf_skb_adjust_room > > > __bpf_skb_change_tail > > > __bpf_skb_change_head > > > > > > but in the case of forwarding we're likely calling these functions > > > during receive

Re: BPFilter: bit size mismatch between bpfiter_umh and vmliux

2020-04-28 Thread Alexei Starovoitov
On Tue, Apr 28, 2020 at 3:54 AM Masahiro Yamada wrote: > > Hi. > > I have a question about potential bit size > mismatch between vmlinux and bpfilter_umh. > > > net/bpfilter/bpfilter_umh is compiled for the > default machine bit of the compiler. > This may not match to the kernel bit size. > > >

<    1   2   3   4   5   6   7   8   9   10   >