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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALvZod79Z114rHPpq7nvCJ2rkLYiV8EEH-WEMXAPB9yyAH3WEQ@mail.gmail.com>
Date:   Wed, 26 Aug 2020 18:19:39 -0700
From:   Shakeel Butt <shakeelb@...gle.com>
To:     Roman Gushchin <guro@...com>
Cc:     bpf@...r.kernel.org, netdev <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Kernel Team <kernel-team@...com>,
        LKML <linux-kernel@...r.kernel.org>,
        Johannes Weiner <hannes@...xchg.org>,
        Linux MM <linux-mm@...ck.org>, Song Liu <songliubraving@...com>
Subject: Re: [PATCH bpf-next v4 04/30] bpf: refine memcg-based memory
 accounting for arraymap maps

On Fri, Aug 21, 2020 at 8:11 AM Roman Gushchin <guro@...com> wrote:
>
> Include percpu arrays and auxiliary data into the memcg-based memory
> accounting.
>
> Signed-off-by: Roman Gushchin <guro@...com>
> Acked-by: Song Liu <songliubraving@...com>
> ---
>  kernel/bpf/arraymap.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
> index 8ff419b632a6..9597fecff8da 100644
> --- a/kernel/bpf/arraymap.c
> +++ b/kernel/bpf/arraymap.c
> @@ -28,12 +28,12 @@ static void bpf_array_free_percpu(struct bpf_array *array)
>
>  static int bpf_array_alloc_percpu(struct bpf_array *array)
>  {
> +       const gfp_t gfp = GFP_USER | __GFP_NOWARN | __GFP_ACCOUNT;
>         void __percpu *ptr;
>         int i;
>
>         for (i = 0; i < array->map.max_entries; i++) {
> -               ptr = __alloc_percpu_gfp(array->elem_size, 8,
> -                                        GFP_USER | __GFP_NOWARN);
> +               ptr = __alloc_percpu_gfp(array->elem_size, 8, gfp);
>                 if (!ptr) {
>                         bpf_array_free_percpu(array);
>                         return -ENOMEM;
> @@ -969,7 +969,7 @@ static struct bpf_map *prog_array_map_alloc(union bpf_attr *attr)
>         struct bpf_array_aux *aux;
>         struct bpf_map *map;
>
> -       aux = kzalloc(sizeof(*aux), GFP_KERNEL);
> +       aux = kzalloc(sizeof(*aux), GFP_KERNEL_ACCOUNT);
>         if (!aux)
>                 return ERR_PTR(-ENOMEM);
>

There are a couple other allocations in the file. Can you please
comment why those are fine without __GFP_ACCOUNT flag. One seems to be
iterator allocation which should be temporary and fine without
__GFP_ACCOUNT but what about the ones in prog_array_map_poke_track()
and bpf_event_entry_gen()?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ