Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2724422imm; Fri, 24 Aug 2018 04:23:44 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbalewzr2oqhBeQ3dfrAG0EG/aewUvAbJl7nsJM15F1/0wQJIjMKlgRhTOC+Tm5N+NuVYnL X-Received: by 2002:a63:f713:: with SMTP id x19-v6mr1263200pgh.233.1535109824649; Fri, 24 Aug 2018 04:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535109824; cv=none; d=google.com; s=arc-20160816; b=BqxuTIzuaFzuWSIxFoFfKeoBj42p+33yGO3PBvYRaEzhfYo1FAh4XPqtYjIjjCG6Vn 8mMp1wOubnhnNbG87xQvqrM96HCqPF3kTuGkRXLvyrGW/CDM89zinPlDjTAXlMNoSuPY Msm+Dg8b26zXQb4CY3DtJhLFWdT4U9LXVdLBoB3rFdepQVSrGwYZaZLKOEA49F8ZXpRM Nvpekx34kh2fs6E9mbhfMbuZypPM+EGwaCftYwYRC1ytTXR3gWPCcVhMaWKFuZDu7qfq uyWbh5J8L8k473h4/OQPn8/i1ZB5TvYNhjjiGFwAEpP0OEH2XqznzgF0W0gR42QWh/Ih sHVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=s8KXsP82LAIG1yydhG07HmcpZbAdPTdpqEralfjIkzw=; b=fn9kmgGv/b43VCdvhRONkm6YrhJVZ+4K8nkU2KMFBhyIMS70/J4EPp6Icmo77GAOrq 7lRFnA0OnenpeTToHBNUzTKLITH9lp1xCVOTblJbBkb52r13X2K+De2B7TQdyNw4vBP5 yRcq52RuVGKlQYy7o39zkkPgl/vnj1p2jtBwJ7sKfkkPXUxbKu73LV2/AfwvOE3GurqP ND7C4nwl+W8hRkvShXV1VE8ruZ0vaMdfLKvS6fDmeSZVIUoN03iyzDtPZlQkxbjq36/q Fr0JCa4g2Z+GX2Ofi5O4ZhHbYKxWBme3GDFr1tWbeMhx6+E0ERVDK/WD3TeM9xQvGeEy dozQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s195-v6si6887796pgs.492.2018.08.24.04.23.28; Fri, 24 Aug 2018 04:23:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727414AbeHXO4e (ORCPT + 99 others); Fri, 24 Aug 2018 10:56:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47260 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726462AbeHXO4e (ORCPT ); Fri, 24 Aug 2018 10:56:34 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6859A4023475; Fri, 24 Aug 2018 11:22:21 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8A5022156889; Fri, 24 Aug 2018 11:22:19 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id w7OBMJwV030774; Fri, 24 Aug 2018 07:22:19 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w7OBMJwl030770; Fri, 24 Aug 2018 07:22:19 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Fri, 24 Aug 2018 07:22:19 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Herbert Xu cc: "David S. Miller" , linux-crypto@vger.kernel.org, Mike Snitzer , dm-devel@redhat.com, linux-kernel@vger.kernel.org Subject: Re: Deadlock when using crypto API for block devices In-Reply-To: Message-ID: References: <20180824021010.hfar7gasp34ddrib@gondor.apana.org.au> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 24 Aug 2018 11:22:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 24 Aug 2018 11:22:21 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mpatocka@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 24 Aug 2018, Mikulas Patocka wrote: > > > On Fri, 24 Aug 2018, Herbert Xu wrote: > > > On Thu, Aug 23, 2018 at 04:39:23PM -0400, Mikulas Patocka wrote: > > > > > > 1. don't set CRYPTO_TFM_REQ_MAY_SLEEP in dm-crypt > > > ================================================= > > > If we don't set it, dm-crypt will use GFP_ATOMIC and GFP_ATOMIC may fail. > > > The function init_crypt in xts.c handles the failure gracefully - but the > > > question is - does the whole crypto code handle allocation failures > > > gracefully? If not and if it returns -ENOMEM somewhere, it would result in > > > I/O errors and data corruption. > > > > It is safe to use GFP_ATOMIC. First of the allocation is really > > small (less than a page) so it will only fail when the system is > > almost completely out of memory. > > GFP_ATOMIC is used by networking code. If the system is in a situation > when packets arrive faster than the swapper is able to swap, it will > happen. It does happen during netwoking surge and corrupting the > filesystem in tris situation is not acceptable. > > > Even when it does fail the crypto > > operation will still succeed, albeit it will process things at a > > smaller granularity so the performance will degrade. > > A quick search through the crypto code shows that ahash_save_req and > seqiv_aead_encrypt return -ENOMEM. > > Will you fix them? And also ablkcipher_next_slow, ablkcipher_copy_iv, skcipher_next_slow, skcipher_next_copy, skcipher_copy_iv, blkcipher_next_slow, blkcipher_copy_iv. So, I think that dropping CRYPTO_TFM_REQ_MAY_SLEEP is not possible. Mikulas