UBSAN warnings in kernel/sysctl.c:2215:10 for 4.10.13

From: Toralf FÃrster
Date: Mon May 01 2017 - 11:38:57 EST


Whilst I'm wondering about missing kern.log entries of my server for about 13 hours within last night I stumbled over this :


May 1 05:53:19 mr-fox kernel: [63395.062218] ================================================================================
May 1 05:53:19 mr-fox kernel: [63395.062221] UBSAN: Undefined behaviour in kernel/sysctl.c:2215:10
May 1 05:53:19 mr-fox kernel: [63395.062223] load of value 255 is not a valid value for type '_Bool'
May 1 05:53:19 mr-fox kernel: [63395.062226] CPU: 3 PID: 12243 Comm: sysctl Not tainted 4.10.13 #4
May 1 05:53:19 mr-fox kernel: [63395.062227] Hardware name: /DX79TO, BIOS SIX7910J.86A.0650.2014.0307.0138 03/07/2014
May 1 05:53:19 mr-fox kernel: [63395.062228] Call Trace:
May 1 05:53:19 mr-fox kernel: [63395.062236] dump_stack+0x60/0x9c
May 1 05:53:19 mr-fox kernel: [63395.062239] ubsan_epilogue+0xd/0x40
May 1 05:53:19 mr-fox kernel: [63395.062242] __ubsan_handle_load_invalid_value+0x75/0xa0
May 1 05:53:19 mr-fox kernel: [63395.062245] ? terminate_walk+0x10a/0x1b0
May 1 05:53:19 mr-fox kernel: [63395.062249] __do_proc_dointvec+0x447/0x4d0
May 1 05:53:19 mr-fox kernel: [63395.062250] ? do_proc_dointvec_conv+0x1f0/0x1f0
May 1 05:53:19 mr-fox kernel: [63395.062252] proc_douintvec+0x3f/0x70
May 1 05:53:19 mr-fox kernel: [63395.062254] ? do_proc_dointvec_conv+0x1f0/0x1f0
May 1 05:53:19 mr-fox kernel: [63395.062256] ? sysctl_perm+0x7e/0xe0
May 1 05:53:19 mr-fox kernel: [63395.062258] proc_sys_call_handler+0xe4/0x130
May 1 05:53:19 mr-fox kernel: [63395.062259] proc_sys_read+0xc/0x10
May 1 05:53:19 mr-fox kernel: [63395.062262] __vfs_read+0x54/0x2a0
May 1 05:53:19 mr-fox kernel: [63395.062263] vfs_read+0xbc/0x210
May 1 05:53:19 mr-fox kernel: [63395.062265] SyS_read+0x50/0xc0
May 1 05:53:19 mr-fox kernel: [63395.062269] entry_SYSCALL_64_fastpath+0x13/0x94
May 1 05:53:19 mr-fox kernel: [63395.062270] RIP: 0033:0x7f202f39da40
May 1 05:53:19 mr-fox kernel: [63395.062272] RSP: 002b:00007ffcf606b188 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
May 1 05:53:19 mr-fox kernel: [63395.062274] RAX: ffffffffffffffda RBX: 0000000000002010 RCX: 00007f202f39da40
May 1 05:53:19 mr-fox kernel: [63395.062275] RDX: 0000000000000400 RSI: 000000000070c020 RDI: 0000000000000006
May 1 05:53:19 mr-fox kernel: [63395.062276] RBP: 00007f202f66baa0 R08: 0000000000000411 R09: 0000000000000000
May 1 05:53:19 mr-fox kernel: [63395.062278] R10: 0000000000006d50 R11: 0000000000000246 R12: 00007f202f66bed1
May 1 05:53:19 mr-fox kernel: [63395.062278] R13: 00000000000000e1 R14: 0000000000000000 R15: 0000000000000000
May 1 05:53:19 mr-fox kernel: [63395.062279] ================================================================================



Line 2215 was last changed 7 years ago:

err = proc_put_long(&buffer, &left, lval, neg);

so is UBSAN wrong here ?

--
Toralf
PGP C4EACDDE 0076E94E