Commit 87ebcc5
base/memory, hotplug: fix a kernel oops in show_valid_zones()
commit a96dfddbcc04336bbed50dc2b24823e45e09e80c upstream.
Reading a sysfs "memoryN/valid_zones" file leads to the following oops
when the first page of a range is not backed by struct page.
show_valid_zones() assumes that 'start_pfn' is always valid for
page_zone().
BUG: unable to handle kernel paging request at ffffea017a000000
IP: show_valid_zones+0x6f/0x160
This issue may happen on x86-64 systems with 64GiB or more memory since
their memory block size is bumped up to 2GiB. [1] An example of such
systems is desribed below. 0x3240000000 is only aligned by 1GiB and
this memory block starts from 0x3200000000, which is not backed by
struct page.
BIOS-e820: [mem 0x0000003240000000-0x000000603fffffff] usable
Since test_pages_in_a_zone() already checks holes, fix this issue by
extending this function to return 'valid_start' and 'valid_end' for a
given range. show_valid_zones() then proceeds with the valid range.
[1] 'Commit bdee237 ("x86: mm: Use 2GB memory block size on
large-memory x86-64 systems")'
Link: http://lkml.kernel.org/r/20170127222149.30893-3-toshi.kani@hpe.com
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Zhang Zhen <zhenzhang.zhang@huawei.com>
Cc: Reza Arbab <arbab@linux.vnet.ibm.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: <stable@vger.kernel.org> [4.4+]
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>1 parent 374d066 commit 87ebcc5
3 files changed
Lines changed: 22 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
| 391 | + | |
391 | 392 | | |
392 | | - | |
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
398 | 397 | | |
399 | 398 | | |
400 | | - | |
| 399 | + | |
401 | 400 | | |
402 | 401 | | |
403 | | - | |
| 402 | + | |
404 | 403 | | |
405 | 404 | | |
406 | 405 | | |
407 | | - | |
| 406 | + | |
408 | 407 | | |
409 | 408 | | |
410 | 409 | | |
411 | 410 | | |
412 | 411 | | |
413 | 412 | | |
414 | | - | |
| 413 | + | |
415 | 414 | | |
416 | 415 | | |
417 | 416 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1372 | 1372 | | |
1373 | 1373 | | |
1374 | 1374 | | |
| 1375 | + | |
1375 | 1376 | | |
1376 | | - | |
| 1377 | + | |
| 1378 | + | |
1377 | 1379 | | |
1378 | 1380 | | |
| 1381 | + | |
1379 | 1382 | | |
1380 | 1383 | | |
1381 | 1384 | | |
| |||
1397 | 1400 | | |
1398 | 1401 | | |
1399 | 1402 | | |
| 1403 | + | |
| 1404 | + | |
1400 | 1405 | | |
| 1406 | + | |
1401 | 1407 | | |
1402 | 1408 | | |
1403 | 1409 | | |
1404 | | - | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
1405 | 1413 | | |
1406 | | - | |
| 1414 | + | |
1407 | 1415 | | |
| 1416 | + | |
1408 | 1417 | | |
1409 | 1418 | | |
1410 | 1419 | | |
| |||
1722 | 1731 | | |
1723 | 1732 | | |
1724 | 1733 | | |
| 1734 | + | |
1725 | 1735 | | |
1726 | 1736 | | |
1727 | 1737 | | |
| |||
1732 | 1742 | | |
1733 | 1743 | | |
1734 | 1744 | | |
1735 | | - | |
| 1745 | + | |
1736 | 1746 | | |
1737 | 1747 | | |
1738 | | - | |
| 1748 | + | |
1739 | 1749 | | |
1740 | 1750 | | |
1741 | 1751 | | |
| |||
0 commit comments