linux-stable/arch
Max Filippov 6ac5a11dc6 xtensa: fix high memory/reserved memory collision
Xtensa memory initialization code frees high memory pages without
checking whether they are in the reserved memory regions or not. That
results in invalid value of totalram_pages and duplicate page usage by
CMA and highmem. It produces a bunch of BUGs at startup looking like
this:

BUG: Bad page state in process swapper  pfn:70800
page:be60c000 count:0 mapcount:-127 mapping:  (null) index:0x1
flags: 0x80000000()
raw: 80000000 00000000 00000001 ffffff80 00000000 be60c014 be60c014 0000000a
page dumped because: nonzero mapcount
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Tainted: G    B            4.16.0-rc1-00015-g7928b2cbe55b-dirty #23
Stack:
 bd839d33 00000000 00000018 ba97b64c a106578c bd839d70 be60c000 00000000
 a1378054 bd86a000 00000003 ba97b64c a1066166 bd839da0 be60c000 ffe00000
 a1066b58 bd839dc0 be504000 00000000 000002f4 bd838000 00000000 0000001e
Call Trace:
 [<a1065734>] bad_page+0xac/0xd0
 [<a106578c>] free_pages_check_bad+0x34/0x4c
 [<a1066166>] __free_pages_ok+0xae/0x14c
 [<a1066b58>] __free_pages+0x30/0x64
 [<a1365de5>] init_cma_reserved_pageblock+0x35/0x44
 [<a13682dc>] cma_init_reserved_areas+0xf4/0x148
 [<a10034b8>] do_one_initcall+0x80/0xf8
 [<a1361c16>] kernel_init_freeable+0xda/0x13c
 [<a125b59d>] kernel_init+0x9/0xd0
 [<a1004304>] ret_from_kernel_thread+0xc/0x18

Only free high memory pages that are not reserved.

Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-02-15 09:46:42 -08:00
..
alpha pci-v4.16-changes 2018-02-06 09:59:40 -08:00
arc The core framework has a handful of patches this time around, mostly due 2018-02-01 16:56:07 -08:00
arm KVM changes for 4.16 2018-02-10 13:16:35 -08:00
arm64 KVM changes for 4.16 2018-02-10 13:16:35 -08:00
blackfin unify {de,}mangle_poll(), get rid of kernel-side POLL... 2018-02-11 14:37:22 -08:00
c6x The core framework has a handful of patches this time around, mostly due 2018-02-01 16:56:07 -08:00
cris vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
frv unify {de,}mangle_poll(), get rid of kernel-side POLL... 2018-02-11 14:37:22 -08:00
h8300 The core framework has a handful of patches this time around, mostly due 2018-02-01 16:56:07 -08:00
hexagon The core framework has a handful of patches this time around, mostly due 2018-02-01 16:56:07 -08:00
ia64 vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
m32r The core framework has a handful of patches this time around, mostly due 2018-02-01 16:56:07 -08:00
m68k unify {de,}mangle_poll(), get rid of kernel-side POLL... 2018-02-11 14:37:22 -08:00
metag The core framework has a handful of patches this time around, mostly due 2018-02-01 16:56:07 -08:00
microblaze Microblaze patches for 4.16-rc1 2018-02-02 09:48:36 -08:00
mips unify {de,}mangle_poll(), get rid of kernel-side POLL... 2018-02-11 14:37:22 -08:00
mn10300 The core framework has a handful of patches this time around, mostly due 2018-02-01 16:56:07 -08:00
nios2 nios2 update for v4.16-rc1 2018-02-11 13:52:32 -08:00
openrisc The core framework has a handful of patches this time around, mostly due 2018-02-01 16:56:07 -08:00
parisc The core framework has a handful of patches this time around, mostly due 2018-02-01 16:56:07 -08:00
powerpc vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
riscv RISC-V changes for 4.16 2018-02-07 11:33:08 -08:00
s390 KVM changes for 4.16 2018-02-10 13:16:35 -08:00
score arch/score/kernel/setup.c: combine two seq_printf() calls into one call in show_cpuinfo() 2018-02-06 18:32:47 -08:00
sh libnvdimm for 4.16 2018-02-06 10:41:33 -08:00
sparc unify {de,}mangle_poll(), get rid of kernel-side POLL... 2018-02-11 14:37:22 -08:00
tile The core framework has a handful of patches this time around, mostly due 2018-02-01 16:56:07 -08:00
um mconsole_proc(): don't mess with file->f_pos 2018-02-09 19:28:01 -08:00
unicore32 lib: optimize cpumask_next_and() 2018-02-06 18:32:44 -08:00
x86 vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
xtensa xtensa: fix high memory/reserved memory collision 2018-02-15 09:46:42 -08:00
.gitignore
Kconfig Makefile: introduce CONFIG_CC_STACKPROTECTOR_AUTO 2018-02-06 18:32:44 -08:00