Re: linux-next: build failure after merge of the block tree

2020-12-07 Thread Florent Revest
On Mon, 2020-12-07 at 14:09 +1100, Stephen Rothwell wrote: > Hi all, > > After merging the block tree, today's linux-next build (powerpc > ppc64_defconfig) failed like this: > > fs/io_uring.c: In function 'io_shutdown': > fs/io_uring.c:3782:9: error: too many arguments to function > 'sock_from_fi

Re: [PATCH bpf-next v4 6/6] bpf: Test bpf_sk_storage_get in tcp iterators

2020-12-04 Thread Florent Revest
On Thu, 2020-12-03 at 18:05 -0800, Martin KaFai Lau wrote: > On Wed, Dec 02, 2020 at 09:55:27PM +0100, Florent Revest wrote: > > This extends the existing bpf_sk_storage_get test where a socket is > > created and tagged with its creator's pid by a task_file iterator. > >

[PATCH bpf-next v5 6/6] selftests/bpf: Test bpf_sk_storage_get in tcp iterators

2020-12-04 Thread Florent Revest
tored in the local storage. Signed-off-by: Florent Revest Acked-by: Yonghong Song Acked-by: Martin KaFai Lau --- .../selftests/bpf/prog_tests/bpf_iter.c| 18 -- .../progs/bpf_iter_bpf_sk_storage_helpers.c| 18 ++ 2 files changed, 34 insertions(

[PATCH bpf-next v5 3/6] bpf: Expose bpf_sk_storage_* to iterator programs

2020-12-04 Thread Florent Revest
to selectively delete local storage values. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau Acked-by: KP Singh --- net/core/bpf_sk_storage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index a32037daa933..4edd033e899c

[PATCH bpf-next v5 5/6] selftests/bpf: Add an iterator selftest for bpf_sk_storage_get

2020-12-04 Thread Florent Revest
his information could be used from a cgroup_skb/*gress hook to try to associate network traffic with processes. The test makes sure that a socket it created is tagged with prog_tests's pid. Signed-off-by: Florent Revest Acked-by: Yonghong Song Acked-by: Martin KaFai Lau --- .../self

[PATCH bpf-next v5 4/6] selftests/bpf: Add an iterator selftest for bpf_sk_storage_delete

2020-12-04 Thread Florent Revest
The eBPF program iterates over all entries (well, only one) of a socket local storage map and deletes them all. The test makes sure that the entry is indeed deleted. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau --- .../selftests/bpf/prog_tests/bpf_iter.c | 64

[PATCH bpf-next v5 1/6] net: Remove the err argument from sock_from_file

2020-12-04 Thread Florent Revest
hether the returned socket is NULL or not. Suggested-by: Al Viro Signed-off-by: Florent Revest Reviewed-by: KP Singh --- fs/eventpoll.c | 3 +-- fs/io_uring.c| 16 include/linux/net.h | 2 +- net/core/netclassid_cgroup.c | 3 +--

[PATCH bpf-next v5 2/6] bpf: Add a bpf_sock_from_file helper

2020-12-04 Thread Florent Revest
o other program types inheriting this set of helpers such as iterators or LSM programs. Signed-off-by: Florent Revest Acked-by: KP Singh Acked-by: Martin KaFai Lau --- include/uapi/linux/bpf.h | 9 + kernel/trace/bpf_trace.c | 20 scripts/bpf_helpers_doc.py

[PATCH bpf-next v4 2/6] bpf: Add a bpf_sock_from_file helper

2020-12-02 Thread Florent Revest
o other program types inheriting this set of helpers such as iterators or LSM programs. Signed-off-by: Florent Revest Acked-by: KP Singh Acked-by: Martin KaFai Lau --- include/uapi/linux/bpf.h | 9 + kernel/trace/bpf_trace.c | 20 scripts/bpf_helpers_doc.py

[PATCH bpf-next v4 1/6] net: Remove the err argument from sock_from_file

2020-12-02 Thread Florent Revest
hether the returned socket is NULL or not. Suggested-by: Al Viro Signed-off-by: Florent Revest Reviewed-by: KP Singh --- fs/eventpoll.c | 3 +-- fs/io_uring.c| 16 include/linux/net.h | 2 +- net/core/netclassid_cgroup.c | 3 +--

[PATCH bpf-next v4 6/6] bpf: Test bpf_sk_storage_get in tcp iterators

2020-12-02 Thread Florent Revest
tored in the local storage. Signed-off-by: Florent Revest Acked-by: Yonghong Song --- .../selftests/bpf/prog_tests/bpf_iter.c| 13 + .../progs/bpf_iter_bpf_sk_storage_helpers.c| 18 ++ 2 files changed, 31 insertions(+) diff --git a/tools/testing/selftest

[PATCH bpf-next v4 5/6] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-12-02 Thread Florent Revest
his information could be used from a cgroup_skb/*gress hook to try to associate network traffic with processes. The test makes sure that a socket it created is tagged with prog_tests's pid. Signed-off-by: Florent Revest Acked-by: Yonghong Song --- .../selftests/bpf/prog_tests/b

[PATCH bpf-next v4 4/6] bpf: Add an iterator selftest for bpf_sk_storage_delete

2020-12-02 Thread Florent Revest
The eBPF program iterates over all entries (well, only one) of a socket local storage map and deletes them all. The test makes sure that the entry is indeed deleted. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau --- .../selftests/bpf/prog_tests/bpf_iter.c | 64

[PATCH bpf-next v4 3/6] bpf: Expose bpf_sk_storage_* to iterator programs

2020-12-02 Thread Florent Revest
to selectively delete local storage values. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau Acked-by: KP Singh --- net/core/bpf_sk_storage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index a32037daa933..4edd033e899c

Re: [PATCH bpf-next v3 5/6] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-11-27 Thread Florent Revest
On Thu, 2020-11-26 at 23:00 -0800, Yonghong Song wrote: > On 11/26/20 8:44 AM, Florent Revest wrote: > > +SEC("iter/task_file") > > +int fill_socket_owner(struct bpf_iter__task_file *ctx) > > +{ > > + struct task_struct *task = ctx->task; > > +

[PATCH bpf-next v3 1/6] net: Remove the err argument from sock_from_file

2020-11-26 Thread Florent Revest
hether the returned socket is NULL or not. Suggested-by: Al Viro Signed-off-by: Florent Revest --- fs/eventpoll.c | 3 +-- fs/io_uring.c| 16 include/linux/net.h | 2 +- net/core/netclassid_cgroup.c | 3 +-- net/core/netprio_cgroup.c|

[PATCH bpf-next v3 4/6] bpf: Add an iterator selftest for bpf_sk_storage_delete

2020-11-26 Thread Florent Revest
The eBPF program iterates over all entries (well, only one) of a socket local storage map and deletes them all. The test makes sure that the entry is indeed deleted. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau --- .../selftests/bpf/prog_tests/bpf_iter.c | 64

[PATCH bpf-next v3 6/6] bpf: Test bpf_sk_storage_get in tcp iterators

2020-11-26 Thread Florent Revest
tored in the local storage. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/bpf_iter.c| 13 + .../progs/bpf_iter_bpf_sk_storage_helpers.c| 18 ++ 2 files changed, 31 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter

[PATCH bpf-next v3 5/6] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-11-26 Thread Florent Revest
his information could be used from a cgroup_skb/*gress hook to try to associate network traffic with processes. The test makes sure that a socket it created is tagged with prog_tests's pid. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/bpf_iter.c | 40 ++

[PATCH bpf-next v3 2/6] bpf: Add a bpf_sock_from_file helper

2020-11-26 Thread Florent Revest
o other program types inheriting this set of helpers such as iterators or LSM programs. Signed-off-by: Florent Revest Acked-by: KP Singh Acked-by: Martin KaFai Lau --- include/uapi/linux/bpf.h | 9 + kernel/trace/bpf_trace.c | 20 scripts/bpf_helpers_doc.py

[PATCH bpf-next v3 3/6] bpf: Expose bpf_sk_storage_* to iterator programs

2020-11-26 Thread Florent Revest
to selectively delete local storage values. Signed-off-by: Florent Revest Acked-by: Martin KaFai Lau --- net/core/bpf_sk_storage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index a32037daa933..4edd033e899c 100644 --- a/net/core

Re: [PATCH v2 5/5] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-11-26 Thread Florent Revest
On Thu, 2020-11-19 at 16:32 -0800, Martin KaFai Lau wrote: > Does it affect all sk(s) in the system? Can it be limited to > the sk that the test is testing? Oh I just realized I haven't answered you here yet! Thanks for the reviews. :D I'm sending a v3 addressing your comments

[PATCH v2 2/5] bpf: Add a bpf_sock_from_file helper

2020-11-19 Thread Florent Revest
From: Florent Revest While eBPF programs can check whether a file is a socket by file->f_op == &socket_file_ops, they cannot convert the void private_data pointer to a struct socket BTF pointer. In order to do this a new helper wrapping sock_from_file is added. This is useful to

[PATCH v2 4/5] bpf: Add an iterator selftest for bpf_sk_storage_delete

2020-11-19 Thread Florent Revest
From: Florent Revest The eBPF program iterates over all entries (well, only one) of a socket local storage map and deletes them all. The test makes sure that the entry is indeed deleted. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/bpf_iter.c | 64

[PATCH v2 5/5] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-11-19 Thread Florent Revest
From: Florent Revest The eBPF program iterates over all files and tasks. For all socket files, it stores the tgid of the last task it encountered with a handle to that socket. This is a heuristic for finding the "owner" of a socket similar to what's done by lsof, ss, n

[PATCH v2 3/5] bpf: Expose bpf_sk_storage_* to iterator programs

2020-11-19 Thread Florent Revest
From: Florent Revest Iterators are currently used to expose kernel information to userspace over fast procfs-like files but iterators could also be used to manipulate local storage. For example, the task_file iterator could be used to initialize a socket local storage with associations between

[PATCH v2 1/5] net: Remove the err argument from sock_from_file

2020-11-19 Thread Florent Revest
From: Florent Revest Currently, the sock_from_file prototype takes an "err" pointer that is either not set or set to -ENOTSOCK IFF the returned socket is NULL. This makes the error redundant and it is ignored by a few callers. This patch simplifies the API by letting callers deduce

Re: saner sock_from_file() calling conventions (was Re: [PATCH] bpf: Expose a bpf_sock_from_file helper to tracing programs)

2020-11-13 Thread Florent Revest
On Thu, 2020-11-12 at 20:28 +, Al Viro wrote: > On Thu, Nov 12, 2020 at 09:09:44PM +0100, Florent Revest wrote: > > From: Florent Revest > > > > eBPF programs can already check whether a file is a socket using > > file->f_op == &socket_file