[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201117200922.195ba28c@oasis.local.home>
Date: Tue, 17 Nov 2020 20:09:22 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Matt Mullins <mmullins@...x.us>
Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
paulmck <paulmck@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Dmitry Vyukov <dvyukov@...gle.com>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
netdev <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH] bpf: don't fail kmalloc while releasing raw_tp
On Tue, 17 Nov 2020 16:42:44 -0800
Matt Mullins <mmullins@...x.us> wrote:
> > Indeed with a stub function, I don't see any need for READ_ONCE/WRITE_ONCE.
>
> I'm not sure if this is a practical issue, but without WRITE_ONCE, can't
> the write be torn? A racing __traceiter_ could potentially see a
> half-modified function pointer, which wouldn't work out too well.
This has been discussed before, and Linus said:
"We add READ_ONCE and WRITE_ONCE annotations when they make sense. Not
because of some theoretical "compiler is free to do garbage"
arguments. If such garbage happens, we need to fix the compiler"
https://lore.kernel.org/lkml/CAHk-=wi_KeD1M-_-_SU_H92vJ-yNkDnAGhAS=RR1yNNGWKW+aA@mail.gmail.com/
>
> This was actually my gut instinct before I wrote the __GFP_NOFAIL
> instead -- currently that whole array's memory ordering is provided by
> RCU and I didn't dive deep enough to evaluate getting too clever with
> atomic modifications to it.
The pointers are always going to be the architecture word size (by
definition), and any compiler that tears a write of a long is broken.
-- Steve
Powered by blists - more mailing lists