Comment # 10 on bug 1051059 from
(In reply to Matwey Kornilov from comment #0)
> Created attachment 734212 [details]
> dmesg.txt
> 
> Hello,
> 
> I am running openSUSE Leap 42.3 with kernel 4.4.76-1-default.
> And I see the following during hibernation:
> 
> [ 2070.824241] BUG: sleeping function called from invalid context at
> ../kernel/locking/rwsem.c:21
> [ 2070.824241] in_atomic(): 1, irqs_disabled(): 1, pid: 7880, name:
> systemd-sleep
> [ 2070.824241] CPU: 0 PID: 7880 Comm: systemd-sleep Tainted: G           O  
> 4.4.76-1-default #1
> [ 2070.824241] Hardware name: LENOVO 80WQ/ , BIOS 2WCN29WW 07/12/2017
> [ 2070.824241]  0000000000000000 ffffffff81339d97 ffffffff81ecb2e0
> 000000000000040e
> [ 2070.824241]  ffffffff8162dd8c ffffffff81a22e59 ffffffff812e9f6d
> ffffffff81a22e59
> [ 2070.824241]  000000000000240f 000000000000240f ffffffff812ea06b
> ffffffff81859a80
> [ 2070.824241] Call Trace:
> [ 2070.824241]  [<ffffffff81019f29>] dump_trace+0x59/0x320
> [ 2070.824241]  [<ffffffff8101a2ea>] show_stack_log_lvl+0xfa/0x180
> [ 2070.824241]  [<ffffffff8101b091>] show_stack+0x21/0x40
> [ 2070.824241]  [<ffffffff81339d97>] dump_stack+0x5c/0x85
> [ 2070.824241]  [<ffffffff8162dd8c>] down_read+0x1c/0x40
> [ 2070.824241]  [<ffffffff812e9f6d>] crypto_alg_lookup+0x1d/0x50
> [ 2070.824241]  [<ffffffff812ea06b>] crypto_larval_lookup+0x2b/0x160
> [ 2070.824241]  [<ffffffff812ea1cd>] crypto_alg_mod_lookup+0x2d/0xa0
> [ 2070.824241]  [<ffffffff812ea433>] crypto_alloc_tfm+0x53/0xe0
> [ 2070.824241]  [<ffffffff810d3225>] swsusp_save+0x365/0x4a0
> [ 2070.824241]  [<ffffffff8151405b>] swsusp_arch_suspend+0x5b/0x60
> [ 2070.824241] DWARF2 unwinder stuck at swsusp_arch_suspend+0x5b/0x60

The CONFIG_DEBUG_ATOMIC_SLEEP is enabled on openSUSE Leap 42.3 in the kernel
default config:
  x86_64/debug:CONFIG_DEBUG_ATOMIC_SLEEP=y
  x86_64/default:CONFIG_DEBUG_ATOMIC_SLEEP=y

SLE12 doesn't enable it on default config, that's why the BUG didn't show on
SLE12 SP3.

The root cause is that hibernation uses crypto API to generate signature in the
context of sleep. The crypto_alg_lookup() calls down_read() that it calls
might_sleep() the check the sleep can not be launched in a atomic sections. The
hibernation signature verification can not pass the check.

I am looking how to avoid this problem in hibernation code. Currently doesn't
have good way to avoid this problem. At the moment, I suggest that either
disable CONFIG_HIBERNATE_VERIFICATION or CONFIG_DEBUG_ATOMIC_SLEEP in kernel
default config.


You are receiving this mail because: