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: <CAADnVQ+H2n5-Gwgq-OZu-WZKRsg=kq7FtOGXJu6YNHoCEBap6w@mail.gmail.com>
Date:   Thu, 18 Aug 2022 15:49:46 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Kuniyuki Iwashima <kuniyu@...zon.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Kuniyuki Iwashima <kuni1840@...il.com>,
        bpf <bpf@...r.kernel.org>,
        Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH v1 bpf 1/4] bpf: Fix data-races around bpf_jit_enable.

On Wed, Aug 17, 2022 at 9:24 PM Kuniyuki Iwashima <kuniyu@...zon.com> wrote:
>
> A sysctl variable bpf_jit_enable is accessed concurrently, and there is
> always a chance of data-race.  So, all readers and a writer need some
> basic protection to avoid load/store-tearing.
>
> Fixes: 0a14842f5a3c ("net: filter: Just In Time compiler for x86-64")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
>  arch/arm/net/bpf_jit_32.c        | 2 +-
>  arch/arm64/net/bpf_jit_comp.c    | 2 +-
>  arch/mips/net/bpf_jit_comp.c     | 2 +-
>  arch/powerpc/net/bpf_jit_comp.c  | 5 +++--
>  arch/riscv/net/bpf_jit_core.c    | 2 +-
>  arch/s390/net/bpf_jit_comp.c     | 2 +-
>  arch/sparc/net/bpf_jit_comp_32.c | 5 +++--
>  arch/sparc/net/bpf_jit_comp_64.c | 5 +++--
>  arch/x86/net/bpf_jit_comp.c      | 2 +-
>  arch/x86/net/bpf_jit_comp32.c    | 2 +-
>  include/linux/filter.h           | 2 +-
>  net/core/sysctl_net_core.c       | 4 ++--
>  12 files changed, 19 insertions(+), 16 deletions(-)
>
> diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
> index 6a1c9fca5260..4b6b62a6fdd4 100644
> --- a/arch/arm/net/bpf_jit_32.c
> +++ b/arch/arm/net/bpf_jit_32.c
> @@ -1999,7 +1999,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
>         }
>         flush_icache_range((u32)header, (u32)(ctx.target + ctx.idx));
>
> -       if (bpf_jit_enable > 1)
> +       if (READ_ONCE(bpf_jit_enable) > 1)

Nack.
Even if the compiler decides to use single byte loads for some
odd reason there is no issue here.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ