lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4Bzb9EOHCPfYGnRNtw8xDytB+9aPtU12X=GXJ2_4+fyC8UA@mail.gmail.com>
Date:   Thu, 20 Aug 2020 23:22:38 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Carlos Neira <cneirabustos@...il.com>
Cc:     Networking <netdev@...r.kernel.org>, Yonghong Song <yhs@...com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        Jesper Dangaard Brouer <brouer@...hat.com>,
        bpf <bpf@...r.kernel.org>, Andrii Nakryiko <andriin@...com>
Subject: Re: [PATCH v7 bpf-next] bpf/selftests: fold test_current_pid_tgid_new_ns
 into test_progs.

On Thu, Aug 20, 2020 at 6:29 PM Carlos Neira <cneirabustos@...il.com> wrote:
>
> Currently tests for bpf_get_ns_current_pid_tgid() are outside test_progs.
> This change folds test cases into test_progs.
>
> Changes from V6:
>  - Rebased changes.
>
> Signed-off-by: Carlos Neira <cneirabustos@...il.com>
> ---

Acked-by: Andrii Nakryiko <andriin@...com>

>  tools/testing/selftests/bpf/.gitignore        |   1 -
>  tools/testing/selftests/bpf/Makefile          |   3 +-
>  .../bpf/prog_tests/ns_current_pid_tgid.c      |  85 ----------
>  .../bpf/prog_tests/ns_current_pidtgid.c       | 133 +++++++++++++++
>  .../bpf/progs/test_ns_current_pid_tgid.c      |  37 ----
>  .../bpf/progs/test_ns_current_pidtgid.c       |  25 +++
>  .../bpf/test_current_pid_tgid_new_ns.c        | 160 ------------------
>  7 files changed, 159 insertions(+), 285 deletions(-)
>  delete mode 100644 tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
>  create mode 100644 tools/testing/selftests/bpf/prog_tests/ns_current_pidtgid.c
>  delete mode 100644 tools/testing/selftests/bpf/progs/test_ns_current_pid_tgid.c
>  create mode 100644 tools/testing/selftests/bpf/progs/test_ns_current_pidtgid.c
>  delete mode 100644 tools/testing/selftests/bpf/test_current_pid_tgid_new_ns.c
>

[...]

> diff --git a/tools/testing/selftests/bpf/prog_tests/ns_current_pidtgid.c b/tools/testing/selftests/bpf/prog_tests/ns_current_pidtgid.c
> new file mode 100644
> index 000000000000..f41c1ff5de94
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/ns_current_pidtgid.c
> @@ -0,0 +1,133 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2020 Carlos Neira cneirabustos@...il.com */
> +
> +#define _GNU_SOURCE
> +#include <test_progs.h>
> +#include "test_ns_current_pidtgid.skel.h"
> +#include <sys/stat.h>
> +#include <sys/types.h>
> +#include <unistd.h>
> +#include <sys/syscall.h>
> +#include <sched.h>
> +#include <sys/wait.h>
> +#include <sys/mount.h>
> +#include <sys/fcntl.h>
> +
> +#define STACK_SIZE (1024 * 1024)
> +static char child_stack[STACK_SIZE];
> +
> +void test_ns_current_pid_tgid_global_ns(void)
> +{

[...]

> +cleanup:
> +       setns(pidns_fd, CLONE_NEWPID);
> +       test_ns_current_pidtgid__destroy(skel);
> +
> +       return err;
> +}
> +
> +void test_ns_current_pid_tgid_new_ns(void)

nit: this and test_ns_current_pid_tgid_global_ns() above would ideally
be static functions

> +{
> +       int wstatus, duration = 0;
> +       pid_t cpid;
> +

[..]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ