From: Stephan Mueller Subject: Re: "BUG: scheduling while atomic" in atmel-aes on Linux v4.14-rc6 Date: Wed, 25 Oct 2017 17:59:28 +0200 Message-ID: <4153220.h6BHkrSlRF@tauon.chronox.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: linux-crypto@vger.kernel.org, Cyrille Pitchen , Tudor Ambarus , Nicolas Ferre , linux-arm-kernel To: Romain Izard , Herbert Xu Return-path: Received: from mail.eperm.de ([89.247.134.16]:34994 "EHLO mail.eperm.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750923AbdJYP7h (ORCPT ); Wed, 25 Oct 2017 11:59:37 -0400 In-Reply-To: Sender: linux-crypto-owner@vger.kernel.org List-ID: Am Mittwoch, 25. Oktober 2017, 17:26:31 CEST schrieb Romain Izard: Hi Romain, Herbert, > Hello, > > While running the kcapi test suite on a SAMA5D2 Xplained board with a > v4.14-rc6 kernel, I encountered the following error: Thank you for the report. > > # kcapi -x 9 -e -c "cbc(aes)" -i 00000000000000000000000000000000 -k > 00000000000 0000000000000000000000000000000000000 -p > 1b077a6af4b7f98229de786d7516b639 BUG: scheduling while atomic: > kcapi/926/0x00000100 > CPU: 0 PID: 926 Comm: kcapi Not tainted 4.14.0-rc6 #2 > Hardware name: Atmel SAMA5 > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (__schedule_bug+0x60/0x80) > [] (__schedule_bug) from [] (__schedule+0x368/0x3fc) > [] (__schedule) from [] (schedule+0x40/0xa0) > [] (schedule) from [] (__lock_sock+0x78/0xb0) > [] (__lock_sock) from [] (lock_sock_nested+0x48/0x50) > [] (lock_sock_nested) from [] > (af_alg_async_cb+0x20/0x80) [] (af_alg_async_cb) from > [] > (atmel_aes_transfer_complete+0x38/0x68) > [] (atmel_aes_transfer_complete) from [] > (tasklet_action+0x68/0xb4) > [] (tasklet_action) from [] (__do_softirq+0xc4/0x250) > [] (__do_softirq) from [] (irq_exit+0xfc/0x130) > [] (irq_exit) from [] (__handle_domain_irq+0x58/0xa8) > [] (__handle_domain_irq) from [] (__irq_svc+0x6c/0x90) > [] (__irq_svc) from [] (skcipher_recvmsg+0x2d8/0x318) > [] (skcipher_recvmsg) from [] (sock_read_iter+0x88/0xc8) > [] (sock_read_iter) from [] > (aio_read.constprop.3+0xcc/0x178) > [] (aio_read.constprop.3) from [] > (SyS_io_submit+0x540/0x644) > [] (SyS_io_submit) from [] (ret_fast_syscall+0x0/0x48) > > After bisecting, I determined that it appeared during the 4.14 merge > window, with the following commit: > > e870456d8e7c crypto: algif_skcipher - overhaul memory management I think the culprit is the lock_sock in af_alg_async_cb. When going through the code protected by the lock, I actually do not see that the struct sock is actually accessed in any way other than with an atomic operation. Thus, I would infer that lock/unlock in af_alg_async_cb could be safely removed. Would you agree, Herbert? Ciao Stephan