Xuefeng Wang
73f28f714a
rtc: lib: check whether tm->tm_year in int32 range
...
When setting rtc alarm (RTC_WKALM_SET), the tm_year is not checked if it
is in suiteable range. Use INT_MAX - 1900 to check it.
UBSAN: Undefined behaviour in drivers/rtc/rtc-lib.c:119:30
signed integer overflow:
2147483647 + 1900 cannot be represented in type 'int'
CPU: 1 PID: 20994 Comm: syz-executor0 Not tainted 4.19.18-514.55.6.9.x86_64
+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1
04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0xca/0x13e lib/dump_stack.c:113
ubsan_epilogue+0xe/0x81 lib/ubsan.c:159
handle_overflow+0x193/0x1e2 lib/ubsan.c:190
rtc_tm_to_time64+0x267/0x280 drivers/rtc/rtc-lib.c:119
rtc_tm_to_ktime+0x16/0x70 drivers/rtc/rtc-lib.c:129
rtc_set_alarm+0x1a9/0x2d0 drivers/rtc/interface.c:466
rtc_dev_ioctl+0x6db/0x810 drivers/rtc/rtc-dev.c:380
vfs_ioctl fs/ioctl.c:46 [inline]
do_vfs_ioctl+0x1a5/0x10b0 fs/ioctl.c:690
ksys_ioctl+0x89/0xa0 fs/ioctl.c:705
__do_sys_ioctl fs/ioctl.c:712 [inline]
__se_sys_ioctl fs/ioctl.c:710 [inline]
__x64_sys_ioctl+0x74/0xb0 fs/ioctl.c:710
do_syscall_64+0xc8/0x580 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x462589
Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89
f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08
0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8
64 89 01 48
RSP: 002b:00007f5348896c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000072bf00 RCX: 0000000000462589
RDX: 0000000020000000 RSI: 000000004028700f RDI: 0000000000000003
RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f53488976bc
R13: 00000000004bf67e R14: 00000000006f96e0 R15: 00000000ffffffff
==========================================================================
Signed-off-by: Xuefeng Wang <wxf.wang@hisilicon.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-06 15:05:31 +02:00
..
2019-04-04 10:07:08 +02:00
2019-04-04 10:07:08 +02:00
2019-04-04 10:07:08 +02:00
2019-04-04 10:07:11 +02:00
2019-04-04 10:07:11 +02:00
2019-04-06 15:05:31 +02:00
2019-04-04 10:07:10 +02:00
2019-04-04 10:07:08 +02:00
2019-04-04 10:07:08 +02:00
2019-04-04 10:07:08 +02:00
2019-02-08 09:30:13 +01:00
2018-03-01 10:49:41 +01:00
2018-09-28 14:36:49 +02:00
2019-04-04 10:07:08 +02:00
2019-02-18 22:39:30 +01:00
2019-03-18 03:36:01 +01:00
2018-06-06 11:15:43 -07:00
2018-09-28 14:21:03 +02:00
2016-10-19 08:45:48 +02:00
2019-04-04 10:07:10 +02:00
2018-12-10 22:39:39 +01:00
2019-04-04 10:07:09 +02:00
2018-03-02 10:09:58 +01:00
2018-03-17 14:20:56 +01:00
2018-07-11 20:41:01 +02:00
2019-04-04 10:07:10 +02:00
2019-01-22 19:18:27 +01:00
2018-11-07 17:13:55 +01:00
2019-01-22 19:01:19 +01:00
2018-09-28 14:20:59 +02:00
2018-07-07 17:52:26 +02:00
2018-06-07 20:09:49 +02:00
2018-03-02 10:11:02 +01:00
2018-03-02 10:11:02 +01:00
2019-04-04 10:07:10 +02:00
2016-09-02 01:24:06 +02:00
2016-09-02 01:24:06 +02:00
2019-04-04 10:07:09 +02:00
2018-05-03 22:08:00 +02:00
2018-03-02 10:09:58 +01:00
2018-03-02 10:09:58 +01:00
2018-03-02 10:09:58 +01:00
2019-02-07 20:55:48 +01:00
2018-03-02 10:09:58 +01:00
2018-03-02 10:09:58 +01:00
2017-05-04 14:46:25 +02:00
2018-03-02 10:09:58 +01:00
2018-05-03 22:08:00 +02:00
2018-05-03 22:08:00 +02:00
2019-02-05 23:11:31 +01:00
2018-10-22 17:53:12 +02:00
2018-05-21 22:34:36 +02:00
2018-03-02 10:09:58 +01:00
2018-03-02 10:09:58 +01:00
2017-11-02 11:10:55 +01:00
2018-03-02 10:09:58 +01:00
2017-09-01 01:10:11 +02:00
2018-11-12 23:14:07 +01:00
2018-03-02 10:09:58 +01:00
2018-07-07 17:52:26 +02:00
2016-06-04 00:23:35 +02:00
2019-04-04 10:07:09 +02:00
2018-11-16 11:42:12 +00:00
2019-01-22 19:03:43 +01:00
2019-03-03 22:12:38 +01:00
2017-06-20 12:19:14 +02:00
2019-02-17 21:29:10 +01:00
2018-04-03 16:40:46 +02:00
2018-03-17 14:20:51 +01:00
2018-03-01 10:49:41 +01:00
2018-03-02 10:09:58 +01:00
2018-05-03 22:08:00 +02:00
2018-05-18 09:38:22 +02:00
2018-12-10 22:39:47 +01:00
2018-03-02 10:12:19 +01:00
2018-03-02 10:09:58 +01:00
2018-03-02 10:09:58 +01:00
2018-12-10 22:39:49 +01:00
2018-03-02 10:09:58 +01:00
2018-03-17 14:20:46 +01:00
2018-03-02 10:09:58 +01:00
2018-11-12 23:14:07 +01:00
2017-07-31 00:17:48 +02:00
2018-11-22 18:11:35 +01:00
2018-08-14 23:38:45 +02:00
2018-11-14 10:44:43 +01:00
2018-07-07 17:52:26 +02:00
2019-01-22 19:05:32 +01:00
2018-12-10 22:39:52 +01:00
2019-02-17 21:28:39 +01:00
2018-03-01 10:49:41 +01:00
2018-08-31 11:17:41 +02:00
2018-03-02 10:09:58 +01:00
2019-04-04 10:07:10 +02:00
2018-04-03 16:40:48 +02:00
2019-04-04 10:06:54 +02:00
2018-07-07 17:52:26 +02:00
2019-04-04 10:07:11 +02:00
2018-03-02 10:12:17 +01:00
2019-04-04 10:07:10 +02:00
2019-04-04 10:07:10 +02:00
2016-09-02 01:24:06 +02:00
2018-05-03 22:08:00 +02:00
2018-12-18 22:53:35 +01:00
2018-11-07 17:13:56 +01:00
2019-01-22 18:57:08 +01:00
2017-11-09 01:16:36 +01:00
2018-12-10 22:39:54 +01:00
2019-04-04 10:07:11 +02:00
2018-12-11 00:48:17 +01:00
2019-03-04 20:23:15 +01:00
2018-09-11 13:56:35 +02:00
2018-09-11 13:56:35 +02:00
2019-02-08 09:30:13 +01:00
2019-04-04 10:07:10 +02:00
2018-12-10 22:40:01 +01:00
2018-06-07 20:11:08 +02:00
2018-07-07 17:52:26 +02:00
2018-03-02 10:09:58 +01:00
2016-07-19 18:15:21 +02:00
2018-12-10 22:40:03 +01:00
2018-03-02 10:09:58 +01:00
2018-09-28 14:21:03 +02:00
2019-02-11 09:41:21 +01:00
2017-09-05 09:55:02 +02:00
2019-02-17 21:29:10 +01:00
2017-10-12 16:24:19 +02:00
2019-03-04 20:21:19 +01:00
2018-03-02 10:12:24 +01:00
2018-12-10 22:40:05 +01:00
2018-03-02 10:09:58 +01:00
2018-12-10 22:40:07 +01:00
2019-03-02 22:20:58 +01:00
2019-01-22 18:36:27 +01:00
2018-12-10 22:40:10 +01:00
2018-10-22 19:29:43 +02:00
2018-07-25 15:29:43 +02:00
2017-11-02 11:10:55 +01:00
2018-10-25 02:35:42 +02:00
2019-01-23 15:42:31 +01:00
2019-04-04 10:07:09 +02:00
2018-03-01 10:49:27 +01:00
2019-04-04 10:07:11 +02:00
2018-03-02 10:12:21 +01:00
2018-05-23 09:26:19 +02:00
2018-03-01 10:49:41 +01:00
2018-05-03 22:08:00 +02:00
2018-05-22 20:10:54 +02:00
2018-07-11 20:42:08 +02:00
2019-04-04 10:07:10 +02:00
2018-12-06 18:13:46 +01:00
2018-06-04 14:36:14 +02:00
2018-12-10 22:40:12 +01:00
2019-04-04 10:07:08 +02:00
2018-05-17 22:54:24 +02:00
2018-05-17 22:37:11 +02:00
2017-09-04 14:41:02 +01:00
2019-03-04 20:21:19 +01:00
2016-07-09 10:24:21 +02:00
2018-10-03 11:07:22 +02:00
2019-02-21 21:36:53 +01:00
2019-04-04 10:07:10 +02:00
2017-03-16 22:59:54 +01:00
2019-04-04 10:07:08 +02:00
2019-04-04 10:07:08 +02:00
2019-03-18 03:36:01 +01:00
2019-04-04 10:07:08 +02:00
2019-03-18 03:36:01 +01:00