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]
Date:   Thu, 17 Feb 2022 10:37:23 -0800
From:   Brian Vazquez <brianvv@...gle.com>
To:     Eric Dumazet <eric.dumazet@...il.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        "David S . Miller" <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>,
        Eric Dumazet <edumazet@...gle.com>, bpf <bpf@...r.kernel.org>,
        Stanislav Fomichev <sdf@...gle.com>,
        syzbot <syzkaller@...glegroups.com>
Subject: Re: [PATCH bpf] bpf: add schedule points in batch ops

Acked-by: Brian Vazquez <brianvv@...gle.com>


On Thu, Feb 17, 2022 at 10:19 AM Eric Dumazet <eric.dumazet@...il.com> wrote:
>
> From: Eric Dumazet <edumazet@...gle.com>
>
> syzbot reported various soft lockups caused by bpf batch operations.
>
>  INFO: task kworker/1:1:27 blocked for more than 140 seconds.
>  INFO: task hung in rcu_barrier
>
> Nothing prevents batch ops to process huge amount of data,
> we need to add schedule points in them.
>
> Note that maybe_wait_bpf_programs(map) calls from
> generic_map_delete_batch() can be factorized by moving
> the call after the loop.
>
> This will be done later in -next tree once we get this fix merged,
> unless there is strong opinion doing this optimization sooner.
>
> Fixes: aa2e93b8e58e ("bpf: Add generic support for update and delete batch ops")
> Fixes: cb4d03ab499d ("bpf: Add generic support for lookup batch op")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Brian Vazquez <brianvv@...gle.com>
> Cc: Stanislav Fomichev <sdf@...gle.com>
> Reported-by: syzbot <syzkaller@...glegroups.com>
> ---
>  kernel/bpf/syscall.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index fa4505f9b6119bcb219ab9733847a98da65d1b21..ca70fe6fba387937dfb54f10826f19ac55a8a8e7 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -1355,6 +1355,7 @@ int generic_map_delete_batch(struct bpf_map *map,
>                 maybe_wait_bpf_programs(map);
>                 if (err)
>                         break;
> +               cond_resched();
>         }
>         if (copy_to_user(&uattr->batch.count, &cp, sizeof(cp)))
>                 err = -EFAULT;
> @@ -1412,6 +1413,7 @@ int generic_map_update_batch(struct bpf_map *map,
>
>                 if (err)
>                         break;
> +               cond_resched();
>         }
>
>         if (copy_to_user(&uattr->batch.count, &cp, sizeof(cp)))
> @@ -1509,6 +1511,7 @@ int generic_map_lookup_batch(struct bpf_map *map,
>                 swap(prev_key, key);
>                 retry = MAP_LOOKUP_RETRIES;
>                 cp++;
> +               cond_resched();
>         }
>
>         if (err == -EFAULT)
> --
> 2.35.1.265.g69c8d7142f-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ