On Mon, Oct 21, 2019 at 03:19:48PM +0200, Christian Brauner wrote: > On Mon, Oct 21, 2019 at 03:11:49PM +0200, Peter Zijlstra wrote: > > By popular request; here's that alternative. Completely untested :-) > > Am I not getting some mails? :) You're not on the 'right' IRC channels :-) > I prefer this one as it allows us to avoid working around this in > usercopy.c. Should especially make if this potentially helps in other > cases as well? That was Josh's argument too. Personally I think GCC is being a moron here, because with value range analysis it should be able to prove the shift-UB cannot happen (the < sizeof(unsigned long) conditions on both), but alas, it emits the UBSAN calls anyway.