Repository navigation
Commit a96dfdd
base/memory, hotplug: fix a kernel oops in show_valid_zones()
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>1 parent deb88a2 commit a96dfdd
3 files changed
Lines changed: 23 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| 392 | + | |
392 | 393 | | |
393 | | - | |
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | | - | |
400 | 399 | | |
401 | 400 | | |
402 | | - | |
| 401 | + | |
403 | 402 | | |
404 | 403 | | |
405 | | - | |
| 404 | + | |
| 405 | + | |
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
| 411 | + | |
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
| 418 | + | |
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
| |||
| 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 | |
|---|---|---|---|
| |||
1484 | 1484 | | |
1485 | 1485 | | |
1486 | 1486 | | |
| 1487 | + | |
1487 | 1488 | | |
1488 | | - | |
| 1489 | + | |
| 1490 | + | |
1489 | 1491 | | |
1490 | 1492 | | |
| 1493 | + | |
1491 | 1494 | | |
1492 | 1495 | | |
1493 | 1496 | | |
| |||
1509 | 1512 | | |
1510 | 1513 | | |
1511 | 1514 | | |
| 1515 | + | |
| 1516 | + | |
1512 | 1517 | | |
| 1518 | + | |
1513 | 1519 | | |
1514 | 1520 | | |
1515 | 1521 | | |
1516 | | - | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
1517 | 1525 | | |
1518 | | - | |
| 1526 | + | |
1519 | 1527 | | |
| 1528 | + | |
1520 | 1529 | | |
1521 | 1530 | | |
1522 | 1531 | | |
| |||
1843 | 1852 | | |
1844 | 1853 | | |
1845 | 1854 | | |
| 1855 | + | |
1846 | 1856 | | |
1847 | 1857 | | |
1848 | 1858 | | |
| |||
1853 | 1863 | | |
1854 | 1864 | | |
1855 | 1865 | | |
1856 | | - | |
| 1866 | + | |
1857 | 1867 | | |
1858 | 1868 | | |
1859 | | - | |
| 1869 | + | |
1860 | 1870 | | |
1861 | 1871 | | |
1862 | 1872 | | |
| |||
0 commit comments