From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753376AbcG2RtP (ORCPT ); Fri, 29 Jul 2016 13:49:15 -0400 Received: from smtp78.mediacombb.net ([68.66.77.78]:56250 "EHLO dsmdc-mail-smtp.mcomdc.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753184AbcG2RtL (ORCPT ); Fri, 29 Jul 2016 13:49:11 -0400 X-Greylist: delayed 495 seconds by postgrey-1.27 at vger.kernel.org; Fri, 29 Jul 2016 13:49:11 EDT X-Originating-IP: 173.23.250.243 X-Authenticated-User: shaun@helios.aeonazure.com X-COS-Tag: onnet X-Outbound-Route: TO X-Authenticated-Sender: shaun@helios.aeonazure.com X-Authority-Analysis: v=2.1 cv=DPgB4k9b c=1 sm=1 tr=0 a=OCiMecrhrNRzvyrd/uXHhg==:117 a=OCiMecrhrNRzvyrd/uXHhg==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=cAmyUtKerLwA:10 a=3go8odswAAAA:8 a=PLfwSiKdnt_Teyx6oUAA:9 a=WCphLhRDQySbTNkkd-8K:22 X-Authenticated-Sender: shaun@helios.aeonazure.com From: Shaun Tancheff To: Linux Kernel Cc: Shaun Tancheff , Shaun Tancheff Subject: [PATCH] Change MPI alloc from GFP_KERNEL to GFP_ATOMIC Date: Fri, 29 Jul 2016 12:40:39 -0500 Message-Id: <1469814039-17703-1-git-send-email-shaun@tancheff.com> X-Mailer: git-send-email 2.8.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Running Ubuntu 14.04 for testing against 4.8 merge window I am getting. One quick fix is to change GFP_KERNEL to GFP_ATOMIC. BUG: sleeping function called from invalid context at mm/slab.h:393 in_atomic(): 1, irqs_disabled(): 0, pid: 594, name: modprobe no locks held by modprobe/594. CPU: 1 PID: 594 Comm: modprobe Not tainted 4.7.0-zdm #64 Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 0000000000000000 ffff8ef5d4e5b978 ffffffff8b5eded3 ffff8ef5d9021940 ffffffff8bee5c08 ffff8ef5d4e5b9a0 ffffffff8b0b5109 ffffffff8bee5c08 0000000000000189 0000000000000000 ffff8ef5d4e5b9c8 ffffffff8b0b5209 Call Trace: [] dump_stack+0x85/0xc2 [] ___might_sleep+0x179/0x230 [] __might_sleep+0x49/0x80 [] kmem_cache_alloc_trace+0x1ba/0x2f0 [] ? mpi_alloc+0x20/0x80 [] mpi_alloc+0x20/0x80 [] mpi_read_raw_from_sgl+0xc7/0x1d0 [] rsa_verify+0x57/0xd0 [] ? pkcs1pad_sg_set_buf+0x40/0xb0 [] pkcs1pad_verify+0xbb/0x100 [] public_key_verify_signature+0x1c0/0x2a0 [] ? debug_check_no_locks_freed+0xd0/0x160 [] public_key_verify_signature_2+0x15/0x20 [] verify_signature+0x3c/0x50 [] pkcs7_validate_trust+0x1fa/0x260 [] verify_pkcs7_signature+0x7d/0x100 [] mod_verify_sig+0x7c/0xb0 [] load_module+0x170/0x2ac0 [] ? __vfs_read+0xbd/0x110 [] ? ima_post_read_file+0x7d/0xa0 [] ? kernel_read_file+0x191/0x1b0 [] SYSC_finit_module+0xc3/0xf0 [] SyS_finit_module+0xe/0x10 [] entry_SYSCALL_64_fastpath+0x23/0xc1 Signed-off-by: Shaun Tancheff --- lib/mpi/mpiutil.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/mpi/mpiutil.c b/lib/mpi/mpiutil.c index 314f4df..420ace3 100644 --- a/lib/mpi/mpiutil.c +++ b/lib/mpi/mpiutil.c @@ -31,7 +31,7 @@ MPI mpi_alloc(unsigned nlimbs) { MPI a; - a = kmalloc(sizeof *a, GFP_KERNEL); + a = kmalloc(sizeof *a, GFP_ATOMIC); if (!a) return a; @@ -61,7 +61,7 @@ mpi_ptr_t mpi_alloc_limb_space(unsigned nlimbs) if (!len) return NULL; - return kmalloc(len, GFP_KERNEL); + return kmalloc(len, GFP_ATOMIC); } void mpi_free_limb_space(mpi_ptr_t a) @@ -91,14 +91,14 @@ int mpi_resize(MPI a, unsigned nlimbs) return 0; /* no need to do it */ if (a->d) { - p = kmalloc(nlimbs * sizeof(mpi_limb_t), GFP_KERNEL); + p = kmalloc(nlimbs * sizeof(mpi_limb_t), GFP_ATOMIC); if (!p) return -ENOMEM; memcpy(p, a->d, a->alloced * sizeof(mpi_limb_t)); kzfree(a->d); a->d = p; } else { - a->d = kzalloc(nlimbs * sizeof(mpi_limb_t), GFP_KERNEL); + a->d = kzalloc(nlimbs * sizeof(mpi_limb_t), GFP_ATOMIC); if (!a->d) return -ENOMEM; } -- 2.8.1