db57e98d87 ("mm/sparse.c: fix ALIGN() without power of 2 in .."): BUG: kernel reboot-without-warning in early-boot stage, last printk: early console in setup code

4 messages, 4 authors, 2020-07-17 · open the first message on its own page

db57e98d87 ("mm/sparse.c: fix ALIGN() without power of 2 in .."): BUG: kernel reboot-without-warning in early-boot stage, last printk: early console in setup code

From: kernel test robot <hidden>
Date: 2020-07-16 10:05:35

Greetings,

0day kernel testing robot got the below dmesg and the first bad commit is

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

commit db57e98d87908b8837352abe08515e42752270c1
Author:     Lecopzer Chen [off-list ref]
AuthorDate: Mon Sep 23 15:36:24 2019 -0700
Commit:     Linus Torvalds [off-list ref]
CommitDate: Tue Sep 24 15:54:09 2019 -0700

    mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()
    
    The size argument passed into sparse_buffer_alloc() has already been
    aligned with PAGE_SIZE or PMD_SIZE.
    
    If the size after aligned is not power of 2 (e.g.  0x480000), the
    PTR_ALIGN() will return wrong value.  Use roundup to round sparsemap_buf
    up to next multiple of size.
    
    Link: http://lkml.kernel.org/r/20190705114826.28586-1-lecopzer.chen@mediatek.com
    Signed-off-by: Lecopzer Chen [off-list ref]
    Signed-off-by: Mark-PK Tsai [off-list ref]
    Cc: YJ Chiang [off-list ref]
    Cc: Lecopzer Chen [off-list ref]
    Cc: Pavel Tatashin [off-list ref]
    Cc: Oscar Salvador [off-list ref]
    Cc: Michal Hocko [off-list ref]
    Cc: Mike Rapoport [off-list ref]
    Signed-off-by: Andrew Morton [off-list ref]
    Signed-off-by: Linus Torvalds [off-list ref]

ae83189405  mm/sparse.c: fix memory leak of sparsemap_buf in aligned memory
db57e98d87  mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()
+-----------------------------------------------------------------------------------------------+------------+------------+
|                                                                                               | ae83189405 | db57e98d87 |
+-----------------------------------------------------------------------------------------------+------------+------------+
| boot_successes                                                                                | 33         | 0          |
| boot_failures                                                                                 | 0          | 11         |
| BUG:kernel_reboot-without-warning_in_early-boot_stage,last_printk:early_console_in_setup_code | 0          | 11         |
+-----------------------------------------------------------------------------------------------+------------+------------+

If you fix the issue, kindly add following tag
Reported-by: kernel test robot <redacted>

early console in setup code
BUG: kernel reboot-without-warning in early-boot stage, last printk: early console in setup code
Linux version 5.3.0-11836-gdb57e98d87908 #1
Command line: root=/dev/ram0 hung_task_panic=1 debug apic=debug sysrq_always_enabled rcupdate.rcu_cpu_stall_timeout=100 net.ifnames=0 printk.devkmsg=on panic=-1 softlockup_panic=1 nmi_watchdog=panic oops=panic load_ramdisk=2 prompt_ramdisk=0 drbd.minor_count=8 systemd.log_level=err ignore_loglevel console=tty0 earlyprintk=ttyS0,115200 console=ttyS0,115200 vga=normal rw link=/cephfs/kbuild/run-queue/yocto-vm-yocto/x86_64-randconfig-r025-20200618/block:async-buffered.7:db57e98d87908b8837352abe08515e42752270c1:bisect-BUG:_kernel_reboot-without-warning_in_early-boot_.__last_printk:_early_console_in_setup_code/.vmlinuz-db57e98d87908b8837352abe08515e42752270c1-20200619041951-5:yocto-vm-yocto-23 branch=block/async-buffered.7 BOOT_IMAGE=/pkg/linux/x86_64-randconfig-r025-20200618/clang-11/db57e98d87908b8837352abe08515e42752270c1/vmlinuz-5.3.0-11836-gdb57e98d87908 rcuperf.shutdown=0 watchdog_thresh=60


                                                          # HH:MM RESULT GOOD BAD GOOD_BUT_DIRTY DIRTY_NOT_BAD
git bisect start v5.4 v5.3 --
git bisect  bad 43b815c6a8e7dbccb5b8bd9c4b099c24bc22d135  # 13:32  B      0    11   27   0  Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
git bisect good 018c6837f3e63b45163d55a1668d9f8e6fdecf6e  # 13:32  G     11     0    0   0  Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
git bisect  bad da05b5ea12c1e50b2988a63470d6b69434796f8b  # 13:32  B      0    11   27   0  Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect good 299d14d4c31aff3b37a03894e012edf8421676ee  # 13:32  G     11     0    0   0  Merge tag 'pci-v5.4-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
git bisect  bad 301310c6d24e5b135d1efd3d4a9cc6adc4fbd94a  # 13:32  B      0    11   27   0  Merge tag 'tpmdd-next-20190925' of git://git.infradead.org/users/jjs/linux-tpmdd
git bisect good 5184d449600f501a8688069f35c138c6b3bf8b94  # 13:33  G     11     0    0   0  Merge tag 'microblaze-v5.4-rc1' of git://git.monstr.eu/linux-2.6-microblaze
git bisect  bad b6cb84b4fc580098a5934078e4c8dc39e3925f07  # 13:33  B      0    11   27   0  Merge tag 'for-5.4/io_uring-2019-09-24' of git://git.kernel.dk/linux-block
git bisect  bad 9c9fa97a8edbc3668dfc7a25de516e80c146e86f  # 13:33  B      0    11   27   0  Merge branch 'akpm' (patches from Andrew)
git bisect good 29a90db9299575a4bba82158f9d4e81405c54646  # 13:33  G     11     0    0   0  mm/memory_hotplug.c: s/is/if
git bisect  bad 99cb0dbd47a15d395bf3faa78dc122bc5efe3fc0  # 13:33  B      0    11   27   0  mm,thp: add read-only THP support for (non-shmem) FS
git bisect  bad f9c645621a28e37813a1de96d9cbd89cde94a1e4  # 13:33  B      0    11   27   0  memcg, oom: don't require __GFP_FS when invoking memcg OOM killer
git bisect  bad 7ea362427c170061b8822dd41bafaa72b3bcb9ad  # 13:33  B      0    11   27   0  mm/vmalloc.c: move 'area->pages' after if statement
git bisect  bad 9f82883c6d9af516c2a7f9fe85eb09e9c25bbe0a  # 13:33  B      0    11   27   0  mm/sparse.c: don't manually decrement num_poisoned_pages
git bisect  bad db57e98d87908b8837352abe08515e42752270c1  # 13:33  B      0    11   27   0  mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()
git bisect good ae83189405ea5c693683327fa69ac95a23ec59be  # 13:33  G     33     0    0   0  mm/sparse.c: fix memory leak of sparsemap_buf in aligned memory
# first bad commit: [db57e98d87908b8837352abe08515e42752270c1] mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()
git bisect good ae83189405ea5c693683327fa69ac95a23ec59be  # 13:33  G     33     0    0   0  mm/sparse.c: fix memory leak of sparsemap_buf in aligned memory
# extra tests with debug options
git bisect  bad db57e98d87908b8837352abe08515e42752270c1  # 13:33  B      0    11   27   0  mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()
# extra tests on head commit of linus/master
# 119: [994e99a96c9b502b3f6ee411457007cd52051cf5] Merge tag 'platform-drivers-x86-v5.8-2' of git://git.infradead.org/linux-platform-drivers-x86 into master
# extra tests on revert first bad commit
# 119: [b04d46c8db7f7a7b4a65e6eba0004958a81109c8] Revert "mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()"
# extra tests on linus/master
# duplicated: [994e99a96c9b502b3f6ee411457007cd52051cf5] Merge tag 'platform-drivers-x86-v5.8-2' of git://git.infradead.org/linux-platform-drivers-x86 into master
# extra tests on linux-next/master
# 119: [ca0e494af5edb59002665bf12871e94b4163a257] Add linux-next specific files for 20200715

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/lkp@lists.01.org

Re: db57e98d87 ("mm/sparse.c: fix ALIGN() without power of 2 in .."): BUG: kernel reboot-without-warning in early-boot stage, last printk: early console in setup code

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2020-07-16 22:06:16

On Thu, 16 Jul 2020 16:32:00 +0800 kernel test robot [off-list ref] wrote:
Greetings,

0day kernel testing robot got the below dmesg and the first bad commit is

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

commit db57e98d87908b8837352abe08515e42752270c1
Author:     Lecopzer Chen [off-list ref]
AuthorDate: Mon Sep 23 15:36:24 2019 -0700
Commit:     Linus Torvalds [off-list ref]
CommitDate: Tue Sep 24 15:54:09 2019 -0700

    mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()
Are we sure about this?  That patch is a year old - has something
in the test setup changed to make it visible at this late stage?

Re: [LKP] Re: db57e98d87 ("mm/sparse.c: fix ALIGN() without power of 2 in .."): BUG: kernel reboot-without-warning in early-boot stage, last printk: early console in setup code

From: Philip Li <hidden>
Date: 2020-07-17 00:27:05

On Thu, Jul 16, 2020 at 03:06:13PM -0700, Andrew Morton wrote:
On Thu, 16 Jul 2020 16:32:00 +0800 kernel test robot [off-list ref] wrote:
quoted
Greetings,

0day kernel testing robot got the below dmesg and the first bad commit is

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

commit db57e98d87908b8837352abe08515e42752270c1
Author:     Lecopzer Chen [off-list ref]
AuthorDate: Mon Sep 23 15:36:24 2019 -0700
Commit:     Linus Torvalds [off-list ref]
CommitDate: Tue Sep 24 15:54:09 2019 -0700

    mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()
Are we sure about this?  That patch is a year old - has something
in the test setup changed to make it visible at this late stage?
sorry, kindly ignore this, this looks like a false positive which
probably due to test environment. We will double check, if any finding
related to kernel, we will provide udpdate.

Thanks
_______________________________________________
LKP mailing list -- lkp@lists.01.org
To unsubscribe send an email to lkp-leave@lists.01.org

Re: [LKP] Re: db57e98d87 ("mm/sparse.c: fix ALIGN() without power of 2 in .."): BUG: kernel reboot-without-warning in early-boot stage, last printk: early console in setup code

From: Rong Chen <hidden>
Date: 2020-07-17 08:07:53


On 7/17/20 6:06 AM, Andrew Morton wrote:
On Thu, 16 Jul 2020 16:32:00 +0800 kernel test robot [off-list ref] wrote:
quoted
Greetings,

0day kernel testing robot got the below dmesg and the first bad commit is

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

commit db57e98d87908b8837352abe08515e42752270c1
Author:     Lecopzer Chen [off-list ref]
AuthorDate: Mon Sep 23 15:36:24 2019 -0700
Commit:     Linus Torvalds [off-list ref]
CommitDate: Tue Sep 24 15:54:09 2019 -0700

     mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()
Are we sure about this?  That patch is a year old - has something
in the test setup changed to make it visible at this late stage?
Hi Andrew,

The issue can be reproduced if CONFIG_SPARSEMEM_VMEMMAP is not set
$ grep CONFIG_SPARSEMEM .config
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
# CONFIG_SPARSEMEM_VMEMMAP is not set

$ ./reproduce-yocto-vm-yocto-23:20200619042212:x86_64-randconfig-r025-20200618:5.3.0-11836-gdb57e98d87908:1 vmlinuz-5.3.0-11836-gdb57e98d87908
early console in setup code

and kernel can boot if enable CONFIG_SPARSEMEM_VMEMMAP
$ grep CONFIG_SPARSEMEM .config
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_SPARSEMEM_VMEMMAP=y

$ ./reproduce-yocto-vm-yocto-23:20200619042212:x86_64-randconfig-r025-20200618:5.3.0-11836-gdb57e98d87908:1 vmlinuz-5.3.0-11836-gdb57e98d87908.CONFIG_SPARSEMEM_VMEMMAP | head
early console in setup code
[    0.000000] Linux version 5.3.0-11836-gdb57e98d87908 (kbuild@6c2adaf8a115) (clang version 12.0.0 (git://gitmirror/llvm_project ed6b578040a85977026c93bf4188f996148f3218)) #1 SMP Fri Jul 17 15:41:47 CST 2020
[    0.000000] Command line: root=/dev/ram0 hung_task_panic=1 debug apic=debug sysrq_always_enabled rcupdate.rcu_cpu_stall_timeout=100 net.ifnames=0 printk.devkmsg=on panic=-1 softlockup_panic=1 nmi_watchdog=panic oops=panic load_ramdisk=2 prompt_ramdisk=0 drbd.minor_count=8 systemd.log_level=err ignore_loglevel console=tty0 earlyprintk=ttyS0,115200 console=ttyS0,115200 vga=normal rw rcuperf.shutdown=0 watchdog_thresh=60
[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]: 256
[    0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
qemu-system-x86_64: terminating on signal 2

Best Regards,
Rong Chen
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help