Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp7769621ybc; Fri, 29 Nov 2019 00:41:11 -0800 (PST) X-Google-Smtp-Source: APXvYqyMzmuG7RT409l5YBAmxYXjlq1S7+BVUIiKl2Sx8h1g0vBkcW9VCj0zrE7rkt88X/w+EoYf X-Received: by 2002:a17:906:3f8a:: with SMTP id b10mr59000922ejj.315.1575016871477; Fri, 29 Nov 2019 00:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575016871; cv=none; d=google.com; s=arc-20160816; b=Ncy6BSAxKI25ZWUvwE+oVvb84jDS5ZfNAdn+nRn6X4ir8MXc7XcAVngxbzijZiJp0v vqzLKxj/mq7ZlJdJL6ldQETGC5cW3J6InYN5JX1l+xvEw9YQwrlMRr5wxLd3hxnLlSS8 qyFwUa2OEdLKo+6sj4oqhy2pgNlMsWVofV5jK2FrgDxEy5Eb1yqSLwfI/md75FXp9vgd 2S9ksPQeZhw2qHHOjOOY8LQfECyRBq1tsVr6fTqRzhRAdTU2l5roksWWMYQb8s2yI8KF Iv0pyA18y0i3RQDphj03rbUF0Dqv8hT1L3TQ4L8J7/CxXLZFglltdglvMKue9jvcqng4 2xCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Nf2ngoHLL7HflbKhzzeH6VVtouWqDeHAyhcGYlfymek=; b=tE3DhM4azgmvyxOLUewiz6NKyxT9SI0TTBsw3vCjRl9ZjO5vSSuJEytWvOqfqNu39X gtQDVWOVIRobQAc3XbUi5kXNJccRrBWxZSeAPIQ05INaZw6hRhzLCjr0tiKSIlqS6LZi bK1u6AoFWWZd09ui9FGQUM3ylQchwGPT5D+HSPWyk4TW6+FRUZ0oqn7noG/z/9peO9oC mwJXA95Fh/mnq+YdXplilY9WwrX/z8QHIGg9/uppe7TeuXpPEZRpUUZRjuW+pib7DQf9 C8hULH0GQUF8hwfRavnDflMlO++LZdYonFMg8L/Aw5UIfMmqqCBMhGgAmEhYPpU6H1Oo FPEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id by4si15045777edb.87.2019.11.29.00.40.38; Fri, 29 Nov 2019 00:41:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726360AbfK2Ikd (ORCPT + 99 others); Fri, 29 Nov 2019 03:40:33 -0500 Received: from helcar.hmeau.com ([216.24.177.18]:59734 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725886AbfK2Ikd (ORCPT ); Fri, 29 Nov 2019 03:40:33 -0500 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1iabpE-00011i-Sn; Fri, 29 Nov 2019 16:40:28 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1iabpA-00060T-N4; Fri, 29 Nov 2019 16:40:24 +0800 Date: Fri, 29 Nov 2019 16:40:24 +0800 From: Herbert Xu To: Eric Biggers Cc: Daniel Jordan , Linux Crypto Mailing List , Steffen Klassert Subject: [PATCH] crypto: pcrypt - Do not clear MAY_SLEEP flag in original request Message-ID: <20191129084024.arwefx7bpvvxpyjk@gondor.apana.org.au> References: <20191119130556.dso2ni6qlks3lr23@gondor.apana.org.au> <20191119173732.GB819@sol.localdomain> <20191119185827.nerskpvddkcsih25@gondor.apana.org.au> <20191126053238.yxhtfbt5okcjycuy@ca-dmjordan1.us.oracle.com> <20191126075845.2v3woc3xqx2fxzqh@gondor.apana.org.au> <20191127191452.GC49214@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191127191452.GC49214@sol.localdomain> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Nov 27, 2019 at 11:14:52AM -0800, Eric Biggers wrote: > > I tried applying the following patches and running syzkaller again: > > padata: Remove unused padata_remove_cpu > padata: Remove broken queue flushing > crypto: pcrypt - Fix user-after-free on module unload > [v3] crypto: pcrypt - Avoid deadlock by using per-instance padata queues > > This time I got a crypto self-test failure when > "pcrypt(pcrypt(rfc4106-gcm-aesni))" was instantiated: > > [ 2220.165113] alg: aead: pcrypt(pcrypt(rfc4106-gcm-aesni)) encryption corrupted request struct on test vector 0, cfg="uneven misaligned splits, may sleep" > [ 2220.170295] alg: aead: changed 'req->base.flags' > [ 2220.171799] Kernel panic - not syncing: alg: self-tests for pcrypt(pcrypt(rfc4106-gcm-aesni)) (rfc4106(gcm(aes))) failed in panic_on_fail mode! > > So the algorithm is not preserving aead_request::base.flags. Thanks for the report. This is a preexisting bug in pcrypt. Here is a patch for it. ---8<--- We should not be modifying the original request's MAY_SLEEP flag upon completion. It makes no sense to do so anyway. Reported-by: Eric Biggers Fixes: 5068c7a883d1 ("crypto: pcrypt - Add pcrypt crypto...") Signed-off-by: Herbert Xu diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c index 543792e0ebf0..2f6f81183e45 100644 --- a/crypto/pcrypt.c +++ b/crypto/pcrypt.c @@ -63,7 +63,6 @@ static void pcrypt_aead_done(struct crypto_async_request *areq, int err) struct padata_priv *padata = pcrypt_request_padata(preq); padata->info = err; - req->base.flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; padata_do_serial(padata); } -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt