Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2819252imm; Fri, 24 Aug 2018 06:02:14 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYG6TZz4L7iiwlPOC7haFBBqeJxcEFHr0rriT5IJjvZ2S0XhtdvX6pfXPmdBvaQ03bDw3RB X-Received: by 2002:a17:902:2f43:: with SMTP id s61-v6mr1610680plb.176.1535115734091; Fri, 24 Aug 2018 06:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535115734; cv=none; d=google.com; s=arc-20160816; b=WgJFNJBPJ9/uUIVwt7FiH7RCgotJ/Kq+fZHEuRc/Z3XXaiJrX6Btlx1o79RI12uYzU kMyAIquCjJSvaJDtug4cgZX+aUH9DRPW2/Culi1eF5PWZGt5mLGZ+uB6pItHW1JLTfff 6h7IgcTpXdo05CBGH/SKyXTWFE/5/6npLWsDcOb2rGtdl0WAdCaDYcX1SNTicQNfoilR k8t2Q80GjvNL3TjKYzZEfWBb7DU/7Wnokfh3Or4PeAmwlkXg0CJTMwaVowecXAOB5IEm dHqCSGPYBAN631T3KP2ReMOivXAiPVYNMASzYGhKrLuVzW5TZg/CUXXZhYr4KhbSfdZS P+gg== 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=4BbelLVOIlrayWL4RD8TmlnVjZto0GpvhsBKDHc0dm4=; b=wknXlrb2RA7x6HEpyHuPrYJnR8YH/gYv8g/ILAgbzWWO8kh22DzkoTdD5hCzl6T2cS tbupz3gxaiJ1a4DTAmEw+rqDC+nMAEh9j2iQLQAabHjT07uG0wQOC90bl1o+N++SDHAN ujfCpgJ8o31TrFqI516AhZk4IRbzstW+91xl1e8mXC0AkkXhCa1w34dwHEu+2LWeZ+XF uVLDesxzWoYVzjaqLJExjHYgsPV2FAeJo2T516hZCPoeG59PdECFbmCEs+NHyo35nysI 0O7ocIY6WMnOJz2QoEEhYYKeQ3QoyRfj72rw/T79vVz+MNCbvQ7U9sfPa5eheBzWvQ4m 1nyg== 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 o5-v6si6359403plh.18.2018.08.24.06.01.58; Fri, 24 Aug 2018 06:02:14 -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 S1727634AbeHXQei (ORCPT + 99 others); Fri, 24 Aug 2018 12:34:38 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35330 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726762AbeHXQei (ORCPT ); Fri, 24 Aug 2018 12:34:38 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0779840241C6; Fri, 24 Aug 2018 13:00:04 +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 4743F10073AD; Fri, 24 Aug 2018 13:00:01 +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 w7OD01Pk016215; Fri, 24 Aug 2018 09:00:01 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w7OD00nh016211; Fri, 24 Aug 2018 09:00:01 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Fri, 24 Aug 2018 09:00:00 -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> <20180824112435.ggizlqrymuibm6oo@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.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 24 Aug 2018 13:00:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 24 Aug 2018 13:00:04 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.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 Fri, Aug 24, 2018 at 07:06:32AM -0400, Mikulas Patocka wrote: > > > > > > A quick search through the crypto code shows that ahash_save_req and > > > seqiv_aead_encrypt return -ENOMEM. > > > > > > Will you fix them? > > > > These only trigger for unaligned buffers. It would be much better > > if dm-crypt can ensure that the input/output is properly unaligned > > and if otherwise do the allocation in dm-crypt. > > But we are relying here on an implementation detail and not on contract. > > Mikulas BTW. gcmaes_crypt_by_sg also contains GFP_ATOMIC and -ENOMEM, behind a pretty complex condition. Do you mean that this condition is part of the contract that the crypto API provides? Should "req->src->offset + req->src->length < PAGE_SIZE" use "<=" instead? Because if the data ends up at page boundary, it will use the atomic allocation that can fail. Mikulas