Subject: [mm/debug] 87c4696d57: kernel_BUG_at_include/linux/mm.h

From: kernel test robot <[email-masked]>
Date: Fri, 27 Dec 2019 22:22:55 +0800

FYI, we noticed the following commit (built with gcc-7):

commit: 87c4696d57b5e380bc2720fdff0772b042462b7d ("[PATCH V11 RESEND] mm/debug: Add tests validating architecture page table helpers")
url: https://github.com/0day-ci/linux/commits/Anshuman-Khandual/mm-debug-Add-tests-validating-architecture-page-table-helpers/20191225-180158

in testcase: trinity
with following parameters:

	runtime: 300s

test-description: Trinity is a linux system call fuzz tester.
test-url: http://codemonkey.org.uk/projects/trinity/

on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 8G

caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):

+--------------------------------------------------+----------+------------+
|                                                  | v5.5-rc3 | 87c4696d57 |
+--------------------------------------------------+----------+------------+
| boot_successes                                   | 0        | 0          |
| boot_failures                                    | 153      | 12         |
| BUG:workqueue_lockup-pool                        | 121      |            |
| BUG:soft_lockup-CPU##stuck_for#s![dma-fence:#:#] | 25       |            |
| EIP:thread_signal_callback                       | 14       |            |
| Kernel_panic-not_syncing:softlockup:hung_tasks   | 25       |            |
| EIP:kthread_should_stop                          | 11       |            |
| BUG:kernel_hang_in_boot_stage                    | 7        |            |
| kernel_BUG_at_include/linux/mm.h                 | 0        | 12         |
| invalid_opcode:#[##]                             | 0        | 12         |
| EIP:__free_pages                                 | 0        | 12         |
| Kernel_panic-not_syncing:Fatal_exception         | 0        | 12         |
+--------------------------------------------------+----------+------------+

If you fix the issue, kindly add following tag
Reported-by: kernel test robot <[email-masked]>

[    9.781974] kernel BUG at include/linux/mm.h:592!
[    9.782810] invalid opcode: 0000 [#1] PTI
[    9.783443] CPU: 0 PID: 1 Comm: swapper Not tainted 5.5.0-rc3-00001-g87c4696d57b5e #1
[    9.784528] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
[    9.785756] EIP: __free_pages+0x14/0x40
[    9.786442] Code: 0c 9c 5e fa 89 d8 e8 5b f3 ff ff 56 9d 5b 5e 5d c3 8d 74 26 00 90 8b 48 1c 55 89 e5 85 c9 75 16 ba b4 b6 84 d6 e8 ac 49 fe ff <0f> 0b 8d b4 26 00 00 00 00 8d 76 00 ff 48 1c 75 10 85 d2 75 07 e8
[    9.789697] EAX: d68761f7 EBX: ea52f000 ECX: ea4f8520 EDX: d684b6b4
[    9.790850] ESI: 00000000 EDI: ef45e000 EBP: ea501f08 ESP: ea501f08
[    9.791879] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 EFLAGS: 00010286
[    9.792783] CR0: 80050033 CR2: ffffffff CR3: 16d00000 CR4: 000406b0
[    9.792783] Call Trace:
[    9.792783]  free_pages+0x3c/0x50
[    9.792783]  pgd_free+0x5a/0x170
[    9.792783]  __mmdrop+0x42/0xe0
[    9.792783]  debug_vm_pgtable+0x54f/0x567
[    9.792783]  kernel_init_freeable+0x90/0x1e3
[    9.792783]  ? rest_init+0xf0/0xf0
[    9.792783]  kernel_init+0x8/0xf0
[    9.792783]  ret_from_fork+0x19/0x24
[    9.792783] Modules linked in:
[    9.792803] ---[ end trace 91b7335adcf0b656 ]---

To reproduce:

        # build kernel
	cd linux
	cp config-5.5.0-rc3-00001-g87c4696d57b5e .config
	make HOSTCC=gcc-7 CC=gcc-7 ARCH=i386 olddefconfig prepare modules_prepare bzImage

        git clone https://github.com/intel/lkp-tests.git
        cd lkp-tests
        bin/lkp qemu -k <bzImage> job-script # job-script is attached in this email

Thanks,
Rong Chen