Re: [PATCH v8 bpf-next] bpf/selftests: fold test_current_pid_tgid_new_ns into test_progs.

2020-12-15 Thread Carlos Antonio Neira Bustos
Andrii, Thank you very much for checking this out!, you were right the test was incorrect. I'll work on your feedback and resend. Thanks! On Tue, Dec 15, 2020 at 11:05:50AM -0800, Andrii Nakryiko wrote: > On Mon, Dec 14, 2020 at 10:39 AM Carlos Neira wrote: > > > > Currently tests for bpf_get_

Re: [PATCH v1 bpf-next] bpf: new helper bpf_get_current_pcomm

2020-09-08 Thread Carlos Antonio Neira Bustos
On Wed, Aug 26, 2020 at 10:25:55PM -0700, Andrii Nakryiko wrote: > On Wed, Aug 26, 2020 at 9:06 AM Carlos Neira wrote: > > > > In multi-threaded applications bpf_get_current_comm is returning per-thread > > names, this helper will return comm from real_parent. > > This makes a difference for some

Re: [PATCH v5] bpf/selftests: fold test_current_pid_tgid_new_ns into test_progs.

2020-08-20 Thread Carlos Antonio Neira Bustos
On Tue, Aug 18, 2020 at 05:41:57PM -0700, Andrii Nakryiko wrote: > On Tue, Aug 18, 2020 at 1:44 PM Carlos Neira wrote: > > > > Currently tests for bpf_get_ns_current_pid_tgid() are outside test_progs. > > This change folds a test case into test_progs. > > > > Changes from V4: > > - Added accident

Re: [PATCH v4 bpf-next] bpf/selftests: fold test_current_pid_tgid_new_ns into test_progs.

2020-08-06 Thread Carlos Antonio Neira Bustos
On Wed, Aug 05, 2020 at 01:15:05PM -0700, Andrii Nakryiko wrote: > On Wed, Aug 5, 2020 at 1:06 PM Carlos Neira wrote: > > > > Currently tests for bpf_get_ns_current_pid_tgid() are outside test_progs. > > This change folds a test case into test_progs. > > > > Changes from V3: > > - STAT(2) check c

Re: [PATCH v3] folds tests from test_current_pid_tgid_new_ns into test_progs.

2020-07-17 Thread Carlos Antonio Neira Bustos
My last email was missing what changed from V2. Changes from V2: - Test that does not create a new namespace has been included in test_progs - Test creating a new pid namespace is a standalone test. - Skeleton is used in both tests. On Fri, Jul 17, 2020 at 08:41:22PM -0400, Carlos Neira wrote:

Re: [PATCH v2 bpf-next] fold test_current_pid_tgid_new_ns into into test_progs

2020-06-30 Thread Carlos Antonio Neira Bustos
On Tue, Jun 23, 2020 at 11:10:51AM -0700, Andrii Nakryiko wrote: > On Tue, Jun 23, 2020 at 5:48 AM Carlos Neira wrote: > > > > folds tests from test_current_pid_tgid_new_ns into test_progs. > > > > Signed-off-by: Carlos Neira > > --- > > tools/testing/selftests/bpf/Makefile | 3 +- > >

Re: [PATCH v15 4/5] tools/testing/selftests/bpf: Add self-tests for new helper.

2019-10-23 Thread Carlos Antonio Neira Bustos
On Wed, Oct 23, 2019 at 03:02:51AM +, Yonghong Song wrote: > > > On 10/22/19 12:17 PM, Carlos Neira wrote: > > Self tests added for new helper > > Please mention the name of the new helper in the commit message. > > > > > Signed-off-by: Carlos Neira > > LGTM Ack with a few nits below. >

Re: [PATCH v14 4/5] tools/testing/selftests/bpf: Add self-tests for new helper.

2019-10-22 Thread Carlos Antonio Neira Bustos
On Mon, Oct 21, 2019 at 12:18:33PM -0700, Andrii Nakryiko wrote: > On Mon, Oct 21, 2019 at 12:14 PM Carlos Antonio Neira Bustos > wrote: > > > > On Mon, Oct 21, 2019 at 11:20:01AM -0700, Andrii Nakryiko wrote: > > > On Sat, Oct 19, 2019 at 1

Re: [PATCH v14 4/5] tools/testing/selftests/bpf: Add self-tests for new helper.

2019-10-21 Thread Carlos Antonio Neira Bustos
On Mon, Oct 21, 2019 at 11:20:01AM -0700, Andrii Nakryiko wrote: > On Sat, Oct 19, 2019 at 1:58 AM Yonghong Song wrote: > > > > > > > > On 10/17/19 8:00 AM, Carlos Neira wrote: > > > Self tests added for new helper > > > > > > Signed-off-by: Carlos Neira > > > --- > > > .../bpf/prog_tests/get_n

Re: [PATCH v13 2/4] bpf: added new helper bpf_get_ns_current_pid_tgid

2019-10-09 Thread Carlos Antonio Neira Bustos
On Wed, Oct 09, 2019 at 12:50:10PM -0700, Andrii Nakryiko wrote: > On Wed, Oct 9, 2019 at 10:45 AM Carlos Antonio Neira Bustos > wrote: > > > > On Wed, Oct 09, 2019 at 09:14:42AM -0700, Andrii Nakryiko wrote: > > > On Wed, Oct 9, 2019 at 8:27 AM Carlos Neira > >

Re: [PATCH v13 2/4] bpf: added new helper bpf_get_ns_current_pid_tgid

2019-10-09 Thread Carlos Antonio Neira Bustos
On Wed, Oct 09, 2019 at 09:14:42AM -0700, Andrii Nakryiko wrote: > On Wed, Oct 9, 2019 at 8:27 AM Carlos Neira wrote: > > > > New bpf helper bpf_get_ns_current_pid_tgid, > > This helper will return pid and tgid from current task > > which namespace matches dev_t and inode number provided, > > this

Re: [PATCH v13 4/4] tools/testing/selftests/bpf: Add self-tests for new helper.

2019-10-09 Thread Carlos Antonio Neira Bustos
On Wed, Oct 09, 2019 at 09:26:32AM -0700, Andrii Nakryiko wrote: > On Wed, Oct 9, 2019 at 8:29 AM Carlos Neira wrote: > > > > Self tests added for new helper > > > > Signed-off-by: Carlos Neira > > --- > > tools/testing/selftests/bpf/bpf_helpers.h | 4 + > > .../bpf/prog_tests/get_ns_curren

Re: [PATCH V12 2/4] bpf: added new helper bpf_get_ns_current_pid_tgid

2019-10-03 Thread Carlos Antonio Neira Bustos
On Thu, Oct 03, 2019 at 10:30:06AM -0700, Andrii Nakryiko wrote: > On Thu, Oct 3, 2019 at 8:01 AM Carlos Antonio Neira Bustos > wrote: > > > > On Wed, Oct 02, 2019 at 12:52:29PM +0200, Daniel Borkmann wrote: > > > On 10/1/19 11:41 PM, Carlos Neira wr

Re: [PATCH V12 2/4] bpf: added new helper bpf_get_ns_current_pid_tgid

2019-10-03 Thread Carlos Antonio Neira Bustos
On Wed, Oct 02, 2019 at 12:52:29PM +0200, Daniel Borkmann wrote: > On 10/1/19 11:41 PM, Carlos Neira wrote: > > New bpf helper bpf_get_ns_current_pid_tgid, > > This helper will return pid and tgid from current task > > which namespace matches dev_t and inode number provided, > > this will allows us

Re: [PATCH bpf-next v11 2/4] bpf: added new helper bpf_get_ns_current_pid_tgid

2019-09-27 Thread Carlos Antonio Neira Bustos
On Fri, Sep 27, 2019 at 10:24:46AM -0700, Andrii Nakryiko wrote: > On Fri, Sep 27, 2019 at 9:59 AM Yonghong Song wrote: > > > > > > > > On 9/27/19 9:15 AM, Andrii Nakryiko wrote: > > > On Thu, Sep 26, 2019 at 1:15 AM Carlos Neira > > > wrote: > > >> > > >> New bpf helper bpf_get_ns_current_pid_t

Re: [PATCH bpf-next v11 4/4] tools/testing/selftests/bpf: Add self-tests for new helper.

2019-09-25 Thread Carlos Antonio Neira Bustos
On Wed, Sep 25, 2019 at 04:07:09PM +, Yonghong Song wrote: > > > On 9/24/19 8:20 AM, Carlos Neira wrote: > > Self tests added for new helper > > > > Signed-off-by: Carlos Neira > > --- > > tools/testing/selftests/bpf/Makefile | 2 +- > > tools/testing/selftests/bpf/bpf_helpers

Re: [PATCH V11 0/4] BPF: New helper to obtain namespace data from current task

2019-09-24 Thread Carlos Antonio Neira Bustos
On Tue, Sep 24, 2019 at 08:01:17PM +0200, Daniel Borkmann wrote: > On Tue, Sep 24, 2019 at 12:20:01PM -0300, Carlos Neira wrote: > > Currently bpf_get_current_pid_tgid(), is used to do pid filtering in bcc's > > scripts but this helper returns the pid as seen by the root namespace which > > is > >

Re: [PATCH bpf-next v10 2/4] bpf: new helper to obtain namespace data from current task New bpf helper bpf_get_current_pidns_info.

2019-09-13 Thread Carlos Antonio Neira Bustos
On Fri, Sep 13, 2019 at 02:56:43AM +, Yonghong Song wrote: Yonghong, Great, I'll submit this new interface along self tests as version 12. Thanks for your help. Bests > > > On 9/12/19 3:03 PM, carlos antonio neira bustos wrote: > > Yonghong, > > > > I t

Re: [PATCH bpf-next v10 2/4] bpf: new helper to obtain namespace data from current task New bpf helper bpf_get_current_pidns_info.

2019-09-10 Thread Carlos Antonio Neira Bustos
Thanks for reviewing the rest of the code, I'll include these changes in ver 11. Bests On Tue, Sep 10, 2019 at 10:46:45PM +, Yonghong Song wrote: > > > On 9/6/19 4:09 PM, Carlos Neira wrote: > > This helper(bpf_get_current_pidns_info) obtains the active namespace from > > current and retur

Re: [PATCH bpf-next v10 2/4] bpf: new helper to obtain namespace data from current task New bpf helper bpf_get_current_pidns_info.

2019-09-10 Thread Carlos Antonio Neira Bustos
#1 and then have > all your other patches? In your kernel change, please use > interface function ns_get_inum_dev() to get pidns inode number > and dev number. > > On 9/9/19 6:45 PM, Carlos Antonio Neira Bustos wrote: > > Thanks a lot, Al Viro and Yonghong for taking th

Re: [PATCH bpf-next v10 2/4] bpf: new helper to obtain namespace data from current task New bpf helper bpf_get_current_pidns_info.

2019-09-09 Thread Carlos Antonio Neira Bustos
Thanks a lot, Al Viro and Yonghong for taking the time to review this patch and provide technical insights needed on this one. But how do we move this forward? Al Viro's review is clear that this will not work and we should strip the name resolution code (thanks for your detailed analysis). As th

Re: [PATCH bpf-next V9 1/3] bpf: new helper to obtain namespace data from current task

2019-09-03 Thread Carlos Antonio Neira Bustos
05:03:35PM -0400, Carlos Antonio Neira Bustos wrote: > Thanks, I'll work on the net/netif_receive_skb selftest using this helper. > I hope I could complete this work this week. > > Bests. > > On Wed, Aug 28, 2019 at 08:53:25PM +, Yonghong Song wrote: > > > >

Re: [PATCH bpf-next V9 1/3] bpf: new helper to obtain namespace data from current task

2019-08-28 Thread Carlos Antonio Neira Bustos
Thanks, I'll work on the net/netif_receive_skb selftest using this helper. I hope I could complete this work this week. Bests. On Wed, Aug 28, 2019 at 08:53:25PM +, Yonghong Song wrote: > > > On 8/28/19 1:39 PM, Carlos Antonio Neira Bustos wrote: > > Yonghong, >

Re: [PATCH bpf-next V9 1/3] bpf: new helper to obtain namespace data from current task

2019-08-28 Thread Carlos Antonio Neira Bustos
doing some more testing. I think I'll remove the tests on samples/bpf as they are mostly end on -EPERM as the fix intended. Is ok to remove them and just focus to finish the self tests code?. Bests On Wed, Aug 14, 2019 at 01:25:06AM -0400, carlos antonio neira bustos wrote: > Thank yo

Re: [PATCH bpf-next V9 1/3] bpf: new helper to obtain namespace data from current task

2019-08-20 Thread Carlos Antonio Neira Bustos
Hi Yonghong, Thanks for taking the time to review this. > > + * > > + * **-EINVAL** if *size_of_pidns* is not valid or unable to get > > ns, pid > > + * or tgid of the current task. > > + * > > + * **-ECHILD** if /proc/self/ns/pid does not exists. > > + * > > + *

Re: [PATCH bpf-next V9 1/3] bpf: new helper to obtain namespace data from current task

2019-08-13 Thread Carlos Antonio Neira Bustos
On Tue, Aug 13, 2019 at 11:11:14PM +, Yonghong Song wrote: > > > On 8/13/19 11:47 AM, Carlos Neira wrote: > > From: Carlos > > > > New bpf helper bpf_get_current_pidns_info. > > This helper obtains the active namespace from current and returns > > pid, tgid, device and namespace id as seen

Re: [PATCH v5 bpf-next] BPF: helpers: New helper to obtain namespacedata from current task

2019-08-09 Thread Carlos Antonio Neira Bustos
_pmu; + + /* trigger some syscalls */ + sleep(1); + + err = bpf_map_lookup_elem(nsidmap_fd, &key, &knsid); + if (CHECK(err, "bpf_map_lookup_elem", "err %d errno %d\n", err, errno)) + goto close_pmu; + + if (stat("/proc/self/ns/pid&quo

Re: [PATCH v5 bpf-next] BPF: helpers: New helper to obtain namespacedata from current task

2019-08-08 Thread Carlos Antonio Neira Bustos
Thanks a lot, Yonghong. I'll fix and split up the patch. Thanks again for your help. Bests On Thu, Aug 08, 2019 at 08:47:14PM +, Yonghong Song wrote: > > > On 8/8/19 1:26 PM, carlos antonio neira bustos wrote: > > Hi Yonghong, > > > > I’m sorry, just to be

Re: [PATCH v5 bpf-next] BPF: helpers: New helper to obtain namespace data from current task

2019-08-08 Thread Carlos Antonio Neira Bustos
unable to get the inode from /proc/self/ns/pid an error > > > > code > > > > + * will be returned. > > > > > > You do not need this. The description of error code cases should cover > > > this. > On Thu, Aug 08, 2019 at 12:44:22PM -0700

Re: [PATCH v5 bpf-next] BPF: helpers: New helper to obtain namespace data from current task

2019-08-08 Thread Carlos Antonio Neira Bustos
%d\n", err, + errno)) + goto close_pmu; + + /* trigger some syscalls */ + sleep(1); + + err = bpf_map_lookup_elem(nsidmap_fd, &key, &knsid); + if (CHECK(err, "bpf_map_lookup_elem", "err %d errno %d\n", err, errno)) +

[PATCH v5 bpf-next] BPF: helpers: New helper to obtain namespace data from current task

2019-08-07 Thread Carlos Antonio Neira Bustos
The code has been modified to avoid syscalls that could sleep. Please let me know if any other modification is needed. >From be0384c0fa209a78c1567936e8db4e35b9a7c0f8 Mon Sep 17 00:00:00 2001 From: Carlos Date: Wed, 7 Aug 2019 20:04:30 -0400 Subject: [PATCH] [PATCH v5 bpf-next] BPF: New helper to

Re: [PATCH v3 bpf-next 1/3] BPF: helpers: New helper to obtain namespace data from current task

2019-03-21 Thread Carlos Antonio Neira Bustos
On Wed, Mar 20, 2019 at 06:23:20PM -0700, Alexei Starovoitov wrote: > On Wed, Mar 20, 2019 at 01:49:22PM -0300, Carlos Antonio Neira Bustos wrote: > > > > This is a series of patches to introduce a new helper called > > bpf_get_current_pidns_info, > > this change

[PATCH v4 bpf-next 2/3] BPF: helpers: New helper to obtain namespace data from current task

2019-03-20 Thread Carlos Antonio Neira Bustos
return 0; To find out the name PID namespace id of a process, you could use this command: $ ps -h -o pidns -p Or this other command: $ ls -Li /proc//ns/pid Signed-off-by: Carlos Antonio Neira Bustos --- tools/include/uapi/linux/bpf.h| 26 +++

Re: [PATCH v3 bpf-next 3/3] BPF: helpers: New helper to obtain namespace data from current task

2019-03-20 Thread Carlos Antonio Neira Bustos
e this command: $ ps -h -o pidns -p Or this other command: $ ls -Li /proc//ns/pid Signed-off-by: Carlos Antonio Neira Bustos --- --- samples/bpf/Makefile | 3 + samples/bpf/trace_ns_info_user.c | 35 ++ samples/bpf/trace_ns_info_user_kern

Re: [PATCH v3 bpf-next 2/3] BPF: helpers: New helper to obtain namespace data from current task

2019-03-20 Thread Carlos Antonio Neira Bustos
use this command: $ ps -h -o pidns -p Or this other command: $ ls -Li /proc//ns/pid Signed-off-by: Carlos Antonio Neira Bustos --- tools/include/uapi/linux/bpf.h| 25 - tools/testing/selftests/bpf/bpf_helpers.h | 3 +++ 2 files changed, 27 insertions(+

[PATCH v3 bpf-next 1/3] BPF: helpers: New helper to obtain namespace data from current task

2019-03-20 Thread Carlos Antonio Neira Bustos
/proc//ns/pid Signed-off-by: Carlos Antonio Neira Bustos - --- include/linux/bpf.h | 1 + include/uapi/linux/bpf.h | 26 ++- kernel/bpf/core.c| 1 + kernel/bpf/helpers.c | 67 kernel/trace/bpf_trace.c | 2 ++