Re: [PATCH v2 02/10] netfilter: Avoid assigning 'const' pointer to non-const pointer
From: Peter Zijlstra
Date: Fri Jan 24 2020 - 17:00:26 EST
On Fri, Jan 24, 2020 at 09:36:54AM -0800, Linus Torvalds wrote:
> On Fri, Jan 24, 2020 at 12:25 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > Just for curiosity's sake. What does clang actually do in that case?
>
> This shouldn't necessarily be clang-specific. If the variable itself
> is 'const', it might go into a read-only section. So trying to modify
> it will quite possibly hit a SIGSEGV in user space (and in kernel
> space cause an oops).
Quite; but I worried clang would use the UB to omit the access entirely,
and therefore rob us of the well deserved crash or something.
Let me go read Nick's email tho, see what it actually does.