kernel panic in reading /proc/kpageflags when enabling RAM-simulated PMEM
From: Naoya Horiguchi
Date: Mon Jun 04 2018 - 20:56:14 EST
Hi everyone,
I detected a kernel panic in mmotm on 5/25.
[ 33.316734] BUG: unable to handle kernel paging request at fffffffffffffffe
[ 33.318157] PGD 9b20e067 P4D 9b20e067 PUD 9b210067 PMD 0
[ 33.319201] Oops: 0000 [#1] SMP PTI
[ 33.319876] CPU: 2 PID: 1728 Comm: page-types Not tainted 4.17.0-rc6-mm1-v4.17-rc6-180605-0816-00236-g2dfb086ef02c+ #160
[ 33.321952] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.fc28 04/01/2014
[ 33.323626] RIP: 0010:stable_page_flags+0x27/0x3c0
[ 33.324550] Code: 00 00 00 0f 1f 44 00 00 48 85 ff 0f 84 a0 03 00 00 41 54 55 49 89 fc 53 48 8b 57 08 48 8b 2f 48 8d 42 ff 83 e2 01 48 0f 44 c7 <48> 8b 00 f6 c4 01 0f 84 10 03 00 00 31 db 49 8b 54 24 08 4c 89 e7
[ 33.328149] RSP: 0018:ffffbbd44111fde0 EFLAGS: 00010202
[ 33.329152] RAX: fffffffffffffffe RBX: 00007fffffffeff9 RCX: 0000000000000000
[ 33.330509] RDX: 0000000000000001 RSI: 0000000000000202 RDI: ffffed1182fff5c0
[ 33.331864] RBP: ffffffffffffffff R08: 0000000000000001 R09: 0000000000000001
[ 33.333223] R10: ffffbbd44111fed8 R11: 0000000000000000 R12: ffffed1182fff5c0
[ 33.334575] R13: 00000000000bffd7 R14: 0000000002fff5c0 R15: ffffbbd44111ff10
[ 33.335941] FS: 00007efc4335a500(0000) GS:ffff93a5bfc00000(0000) knlGS:0000000000000000
[ 33.337478] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 33.338580] CR2: fffffffffffffffe CR3: 00000000b2a58000 CR4: 00000000001406e0
[ 33.339946] Call Trace:
[ 33.340433] kpageflags_read+0xc7/0x120
[ 33.341182] proc_reg_read+0x3c/0x60
[ 33.341874] __vfs_read+0x36/0x170
[ 33.342540] vfs_read+0x89/0x130
[ 33.343172] ksys_pread64+0x71/0x90
[ 33.343851] do_syscall_64+0x5b/0x160
[ 33.344567] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 33.345538] RIP: 0033:0x7efc42e75e23
[ 33.346235] Code: 09 00 ba 9f 01 00 00 e8 ab 81 f4 ff 66 2e 0f 1f 84 00 00 00 00 00 90 83 3d 29 0a 2d 00 00 75 13 49 89 ca b8 11 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 34 c3 48 83 ec 08 e8 db d3 01 00 48 89 04 24
[ 33.349813] RSP: 002b:00007ffc33c35208 EFLAGS: 00000246 ORIG_RAX: 0000000000000011
[ 33.351255] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007efc42e75e23
[ 33.352628] RDX: 0000000000080000 RSI: 00007ffc33cb52b0 RDI: 0000000000000003
[ 33.353994] RBP: 00007ffc33c35250 R08: 0000000000010000 R09: 0000000000000000
[ 33.355352] R10: 0000000000580000 R11: 0000000000000246 R12: 0000000000401560
[ 33.356710] R13: 00007ffc33d35410 R14: 0000000000000000 R15: 0000000000000000
[ 33.358072] Modules linked in: fuse btrfs xor zstd_compress raid6_pq zstd_decompress xxhash ufs hfsplus hfs minix vfat msdos fat jfs ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_raw iptable_security ebtable_filter ebtables ip6table_filter ip6_tables sunrpc dax_pmem device_dax joydev virtio_balloon pcspkr i2c_piix4 xfs libcrc32c virtio_blk 8139too crc32c_intel floppy serio_raw virtio_pci virtio_ring virtio 8139cp mii ata_generic pata_acpi qemu_fw_cfg
[ 33.370035] CR2: fffffffffffffffe
[ 33.370680] ---[ end trace d6df609ab41af1c5 ]---
Reproduction precedure is like this:
- enable RAM based PMEM (with a kernel boot parameter like memmap=1G!4G)
- read /proc/kpageflags (or call tools/vm/page-types with no arguments)
(- my kernel config is attached)
I spent a few days on this, but didn't reach any solutions.
So let me report this with some details below ...
In the critial page request, stable_page_flags() is called with an argument
page whose ->compound_head was somehow filled with '0xffffffffffffffff'.
And compound_head() returns (struct page *)(head - 1), which explains the
address 0xfffffffffffffffe in the above message.
It seems that this kernel panic happens when reading kpageflags of pfn range
[0xbffd7, 0xc0000), which coresponds to a 'reserved' range.
[ 0.000000] user-defined physical RAM map:
[ 0.000000] user: [mem 0x0000000000000000-0x000000000009fbff] usable
[ 0.000000] user: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[ 0.000000] user: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[ 0.000000] user: [mem 0x0000000000100000-0x00000000bffd6fff] usable
[ 0.000000] user: [mem 0x00000000bffd7000-0x00000000bfffffff] reserved
[ 0.000000] user: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[ 0.000000] user: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[ 0.000000] user: [mem 0x0000000100000000-0x000000013fffffff] persistent (type 12)
So I guess 'memmap=' parameter might badly affect the memory initialization process.
This problem doesn't reproduce on v4.17, so some pre-released patch introduces it.
I hope this info helps you find the solution/workaround.
Thanks,
Naoya Horiguchi
Attachment:
config.gz
Description: config.gz