next-20230720: BUG: kernel NULL pointer dereference

From: Aithal, Srikanth
Date: Thu Jul 20 2023 - 23:48:50 EST


Hello all,

Linux next build next-20230720 hits BUG: kernel NULL pointer dereference while booting SEV guest:

===============
Recreation steps
===============
1. Run shutdown tests for around 10 times with SVM guest having around 85% of Host RAM [note: nothing else is running on host as well as inside guest].
2. Then try to boot a SEV guest with 85% of Host RAM, we hit below call trace:

===============
Call trace:
===============
[ 775.069108] BUG: kernel NULL pointer dereference, address: 0000000000000498
[ 775.076069] #PF: supervisor read access in kernel mode
[ 775.081200] #PF: error_code(0x0000) - not-present page
[ 775.086329] PGD 0 P4D 0
[ 775.088861] Oops: 0000 [#1] PREEMPT SMP NOPTI
[ 775.093211] CPU: 45 PID: 796 Comm: kcompactd1 Kdump: loaded Not tainted 6.5.0-rc2-next-20230720-next-20230720- #1
[ 775.103465] Hardware name: Dell Inc. PowerEdge R6515/07PXPY, BIOS 2.8.5 08/18/2022
[ 775.111029] RIP: 0010:arch_tlbbatch_flush+0xcf/0x130
[ 775.115995] Code: 48 83 c2 3f 48 c1 ea 06 48 c1 e2 03 e8 3a 17 e1 00 65 ff 0d 2b b6 38 4e 74 5b 65 48 8b 04 25 40 2e 03 00 48 8b b8 e0 08 00 00 <48> 83 bf 98 04 00 00 00 75 31 5b 41 5c 41 5d 41 5e 5d c3 cc cc cc
[ 775.134732] RSP: 0018:ffffb4a20e7aba58 EFLAGS: 00010286
[ 775.139949] RAX: ffff974907fd3300 RBX: 000000000000002d RCX: 0000000000000000
[ 775.147073] RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000000000
[ 775.154197] RBP: ffffb4a20e7aba78 R08: 0000000000000080 R09: ffff974907fd4220
[ 775.161322] R10: 0000000000000002 R11: 0000000000000002 R12: ffff974907fd4220
[ 775.168454] R13: ffff9787d6372f80 R14: 000000000000002e R15: ffffb4a20e7abc80
[ 775.175577] FS: 0000000000000000(0000) GS:ffff9787d6340000(0000) knlGS:0000000000000000
[ 775.183654] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 775.189392] CR2: 0000000000000498 CR3: 0008003cca62e003 CR4: 0000000000770ee0
[ 775.196517] PKRU: 55555554
[ 775.199227] Call Trace:
[ 775.201672] <TASK>
[ 775.203771] ? show_regs+0x6e/0x80
[ 775.207174] ? __die+0x29/0x70
[ 775.210224] ? page_fault_oops+0x160/0x460
[ 775.214315] ? __mod_lruvec_page_state+0xa4/0x150
[ 775.219012] ? page_vma_mapped_walk+0xfd/0x8e0
[ 775.223450] ? page_remove_rmap+0xac/0x250
[ 775.227540] ? do_user_addr_fault+0x306/0x690
[ 775.231900] ? exc_page_fault+0x7d/0x190
[ 775.235825] ? asm_exc_page_fault+0x2b/0x30
[ 775.240003] ? arch_tlbbatch_flush+0xcf/0x130
[ 775.244352] ? arch_tlbbatch_flush+0xb6/0x130
[ 775.248705] try_to_unmap_flush+0x2c/0x40
[ 775.252716] migrate_pages_batch+0x678/0xbe0
[ 775.256989] ? __pfx_compaction_free+0x10/0x10
[ 775.261435] ? __pfx_compaction_alloc+0x10/0x10
[ 775.265958] migrate_pages+0x9be/0xc50
[ 775.269702] ? cgroup_rstat_updated+0xc4/0xe0
[ 775.274063] ? __mod_lruvec_state+0x3b/0x50
[ 775.278238] ? __pfx_compaction_free+0x10/0x10
[ 775.282677] ? __pfx_compaction_alloc+0x10/0x10
[ 775.287203] compact_zone+0x7a8/0xef0
[ 775.290866] ? psi_task_switch+0xd9/0x240
[ 775.294879] ? finish_task_switch.isra.0+0x85/0x290
[ 775.299759] proactive_compact_node+0x88/0xe0
[ 775.304118] kcompactd+0x37a/0x400
[ 775.307514] ? __pfx_autoremove_wake_function+0x10/0x10
[ 775.312740] ? __pfx_kcompactd+0x10/0x10
[ 775.316658] kthread+0xfb/0x130
[ 775.319803] ? __pfx_kthread+0x10/0x10
[ 775.323547] ret_from_fork+0x40/0x60
[ 775.327127] ? __pfx_kthread+0x10/0x10
[ 775.330870] ret_from_fork_asm+0x1b/0x30
[ 775.334798] </TASK>
[ 775.336988] Modules linked in: xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT xt_tcpudp nft_compat x_tables nf_nat_tftp nf_conntrack_tftp bridge stp llc ib_core nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nf_tables nfnetlink sunrpc nls_iso8859_1 ipmi_ssif intel_rapl_msr intel_rapl_common amd64_edac kvm_amd kvm acpi_ipmi ipmi_si rapl ipmi_devintf joydev wmi_bmof input_leds pcspkr efi_pstore i2c_piix4 k10temp ipmi_msghandler acpi_power_meter evbug mac_hid sch_fq_codel xfs libcrc32c hid_generic usbkbd usbmouse usbhid hid mgag200 drm_kms_helper i2c_algo_bit drm_shmem_helper drm crct10dif_pclmul crc32_pclmul ghash_clmulni_intel sha512_ssse3 aesni_intel mpt3sas crypto_simd cryptd tg3 ccp raid_class scsi_transport_sas sp5100_tco wmi dm_mirror dm_region_hash dm_log msr autofs4
[ 775.417215] CR2: 0000000000000498
[ 775.420532] ---[ end trace 0000000000000000 ]---
[ 775.504479] pstore: backend (erst) writing error (-28)
[ 775.509615] RIP: 0010:arch_tlbbatch_flush+0xcf/0x130
[ 775.514581] Code: 48 83 c2 3f 48 c1 ea 06 48 c1 e2 03 e8 3a 17 e1 00 65 ff 0d 2b b6 38 4e 74 5b 65 48 8b 04 25 40 2e 03 00 48 8b b8 e0 08 00 00 <48> 83 bf 98 04 00 00 00 75 31 5b 41 5c 41 5d 41 5e 5d c3 cc cc cc
[ 775.533326] RSP: 0018:ffffb4a20e7aba58 EFLAGS: 00010286
[ 775.538543] RAX: ffff974907fd3300 RBX: 000000000000002d RCX: 0000000000000000
[ 775.545666] RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000000000
[ 775.552789] RBP: ffffb4a20e7aba78 R08: 0000000000000080 R09: ffff974907fd4220
[ 775.559914] R10: 0000000000000002 R11: 0000000000000002 R12: ffff974907fd4220
[ 775.567039] R13: ffff9787d6372f80 R14: 000000000000002e R15: ffffb4a20e7abc80
[ 775.574162] FS: 0000000000000000(0000) GS:ffff9787d6340000(0000) knlGS:0000000000000000
[ 775.582238] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 775.587978] CR2: 0000000000000498 CR3: 0008003cca62e003 CR4: 0000000000770ee0
[ 775.595109] PKRU: 55555554
[ 775.597814] note: kcompactd1[796] exited with irqs disabled