Re: [PATCH] fix UBSAN splat in test_scanf

From: Christoph von Recklinghausen
Date: Tue Aug 10 2021 - 09:37:12 EST



On 8/10/21 9:31 AM, Andy Shevchenko wrote:
On Mon, Aug 09, 2021 at 06:20:13AM -0400, Chris von Recklinghausen wrote:

Thanks for the report and fix!

First of all, have you seen this:
https://lore.kernel.org/lkml/20210727150132.28920-1-andriy.shevchenko@xxxxxxxxxxxxxxx/T/#u
?


No I hadn't seen it. I'll defer to this fix then.

Thanks,

Chris



On a system with CONFIG_UBSAN_SHIFT=y, the following splat was observed:
[ 104.676826] test_scanf: loaded.
[ 104.680862] ================================================================================
[ 104.690304] UBSAN: shift-out-of-bounds in lib/test_scanf.c:274:51
[ 104.697144] shift exponent 32 is too large for 32-bit type 'unsigned int'
As you may see in the above the rule of thumb is to include only meaningful
parts of the oops.