Colin Ian King
97e6fe106c
mm/page_idle.c: fix oops because end_pfn is larger than max_pfn
...
commit 7298e3b0a149c91323b3205d325e942c3b3b9ef6 upstream.
Currently the calcuation of end_pfn can round up the pfn number to more
than the actual maximum number of pfns, causing an Oops. Fix this by
ensuring end_pfn is never more than max_pfn.
This can be easily triggered when on systems where the end_pfn gets
rounded up to more than max_pfn using the idle-page stress-ng stress test:
sudo stress-ng --idle-page 0
BUG: unable to handle kernel paging request at 00000000000020d8
#PF error: [normal kernel read fault]
PGD 0 P4D 0
Oops: 0000 [#1 ] SMP PTI
CPU: 1 PID: 11039 Comm: stress-ng-idle- Not tainted 5.0.0-5-generic #6-Ubuntu
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
RIP: 0010:page_idle_get_page+0xc8/0x1a0
Code: 0f b1 0a 75 7d 48 8b 03 48 89 c2 48 c1 e8 33 83 e0 07 48 c1 ea 36 48 8d 0c 40 4c 8d 24 88 49 c1 e4 07 4c 03 24 d5 00 89 c3 be <49> 8b 44 24 58 48 8d b8 80 a1 02 00 e8 07 d5 77 00 48 8b 53 08 48
RSP: 0018:ffffafd7c672fde8 EFLAGS: 00010202
RAX: 0000000000000005 RBX: ffffe36341fff700 RCX: 000000000000000f
RDX: 0000000000000284 RSI: 0000000000000275 RDI: 0000000001fff700
RBP: ffffafd7c672fe00 R08: ffffa0bc34056410 R09: 0000000000000276
R10: ffffa0bc754e9b40 R11: ffffa0bc330f6400 R12: 0000000000002080
R13: ffffe36341fff700 R14: 0000000000080000 R15: ffffa0bc330f6400
FS: 00007f0ec1ea5740(0000) GS:ffffa0bc7db00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000000020d8 CR3: 0000000077d68000 CR4: 00000000000006e0
Call Trace:
page_idle_bitmap_write+0x8c/0x140
sysfs_kf_bin_write+0x5c/0x70
kernfs_fop_write+0x12e/0x1b0
__vfs_write+0x1b/0x40
vfs_write+0xab/0x1b0
ksys_write+0x55/0xc0
__x64_sys_write+0x1a/0x20
do_syscall_64+0x5a/0x110
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Link: http://lkml.kernel.org/r/20190618124352.28307-1-colin.king@canonical.com
Fixes: 33c3fc71c8cf ("mm: introduce idle page tracking")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-03 13:15:59 +02:00
..
2018-08-24 13:09:12 +02:00
2019-03-05 17:58:01 +01:00
2018-10-13 09:27:30 +02:00
2017-11-02 11:10:55 +01:00
2017-06-05 16:59:12 +02:00
2019-06-15 11:54:51 +02:00
2019-06-15 11:54:51 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-09-19 22:43:48 +02:00
2017-02-27 18:43:47 -08:00
2018-02-25 11:08:03 +01:00
2018-09-15 09:45:28 +02:00
2017-11-02 11:10:55 +01:00
2018-04-24 09:36:39 +02:00
2018-03-03 10:24:21 +01:00
2016-07-26 16:19:19 -07:00
2019-05-04 09:15:17 +02:00
2017-11-02 11:10:55 +01:00
2019-01-13 10:01:02 +01:00
2018-12-05 19:41:08 +01:00
2016-05-20 17:58:30 -07:00
2019-06-15 11:54:51 +02:00
2017-05-03 15:52:12 -07:00
2017-11-02 11:10:55 +01:00
2017-09-06 17:27:30 -07:00
2017-09-08 18:26:49 -07:00
2019-06-15 11:54:51 +02:00
2018-02-22 15:42:24 +01:00
2019-06-22 08:16:19 +02:00
2016-03-17 15:09:34 -07:00
2019-05-08 07:20:53 +02:00
2018-07-03 11:25:03 +02:00
2019-06-19 08:20:54 +02:00
2016-05-22 17:21:27 -07:00
2018-10-10 08:54:22 +02:00
2018-02-22 15:42:24 +01:00
2018-03-28 18:24:39 +02:00
2018-09-05 09:26:32 +02:00
2019-03-13 14:03:18 -07:00
2019-03-23 14:35:24 +01:00
2019-05-16 19:42:31 +02:00
2019-07-03 13:15:59 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-04-03 06:25:20 +02:00
2019-05-21 18:50:16 +02:00
2017-11-02 11:10:55 +01:00
2016-03-17 15:09:34 -07:00
2019-04-27 09:35:37 +02:00
2017-03-02 08:42:38 +01:00
2017-08-31 16:13:00 -07:00
2017-11-02 11:10:55 +01:00
2018-08-15 18:12:51 +02:00
2018-10-20 09:48:53 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-09-14 18:13:32 -07:00
2019-02-06 17:31:36 +01:00
2019-06-15 11:54:51 +02:00
2017-11-02 11:10:55 +01:00
2019-04-05 22:31:27 +02:00
2019-07-03 13:15:59 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-05-30 07:52:21 +02:00
2019-04-05 22:31:28 +02:00
2018-11-13 11:15:08 -08:00
2019-01-26 09:37:06 +01:00
2017-11-24 08:37:04 +01:00
2017-11-02 11:10:55 +01:00
2019-02-12 19:46:05 +01:00
2017-09-27 14:45:57 -07:00
2018-04-08 14:26:29 +02:00
2019-06-15 11:54:59 +02:00
2017-11-02 11:10:55 +01:00
2017-03-02 08:42:28 +01:00
2017-11-02 11:10:55 +01:00
2018-09-09 19:55:53 +02:00
2018-10-13 09:27:22 +02:00
2017-10-03 17:54:24 -07:00
2019-03-23 14:35:17 +01:00
2018-12-01 09:42:51 +01:00
2019-06-15 11:54:51 +02:00
2018-02-22 15:42:23 +01:00
2017-11-02 11:10:55 +01:00
2018-10-03 17:00:55 -07:00
2017-11-02 11:10:55 +01:00
2018-05-16 10:10:27 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-10-03 17:54:24 -07:00
2019-01-26 09:37:06 +01:00
2018-12-08 13:03:40 +01:00
2017-04-05 12:30:18 -07:00
2019-05-31 06:47:12 -07:00
2019-01-16 22:07:11 +01:00
2018-09-19 22:43:48 +02:00
2019-04-05 22:31:27 +02:00
2017-07-10 16:32:31 -07:00
2019-06-19 08:20:54 +02:00
2019-04-27 09:35:41 +02:00
2017-11-02 11:10:55 +01:00
2018-12-01 09:42:54 +01:00
2016-01-15 11:40:52 -08:00
2015-11-06 17:50:42 -08:00
2017-12-14 09:53:10 +01:00
2018-09-05 09:26:30 +02:00