Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp8493654ybc; Fri, 29 Nov 2019 11:30:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxzMkH4YMB+VLoRnES32qL4+JgFaKXr5jOi5qtE+gnl7VBO7k1Un8TUW3KZmRgOllNsSZgD X-Received: by 2002:a05:6402:149a:: with SMTP id e26mr4504454edv.198.1575055826075; Fri, 29 Nov 2019 11:30:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575055826; cv=none; d=google.com; s=arc-20160816; b=TlR6UMzArzBvg7hb4HcBo+3/BwknJmlhffWCVavq2f9ik2Dbu6ROLFP6gjSJfLvahU 1VubAbsN2x1A1qLs3ON1FNqhAI6GEBAzxiw9RQmG7bdK4VXkfkdHp52dmxEdcxGU7oFt PMzolCvZcFV+mGMmoLPefVVQ0fRIC4nhsWu94e8DcLUZbs28DjPuNyVwxCJghBnz8LYK c+x024nRdHrU080YM5q+fpV5297RV0r1JKtawi0avmJtaTIweaQ46wq2kUe0GNSajhot dJ5jRVjC1I2Xd9U0aOmCa9PKQzB7TAjmUPdopjFse33YSS1eJH8JJd3uECnlA8M6OMxa VBdw== 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:dkim-signature; bh=kQ8D2045f254FYUJHBWTCF17CphWc+fodNghehI8WGM=; b=gxUuKwWoBoLQU5FLGqB6xj7fJmvE548C7+lejxDvYGy94he/egjCRTPSgkT296mOxv m091qcj7kdMl9efBGwvrtnFyHoUwAYIzCk1QWYP9eAlbVsXLuDv4Gqduqqs3fgCc1ieC +yHevOlJsjFLtxy+YhzJvXT8usQdHBEaqUrcD/giM2xywye8ma6/37si8p6Og0A4vYs5 P8knNVH2+DkKKi1pSerZzZCrLcEEfXYLS7dWzoMpxJiQkgKk3nzsR2GPLQ8EF46YzzE+ twgwsCOUDR9ounwR9M69LIQjTyCfDStoquc6UwY5N8cr3py+SF2A1qlnPd5Y61Kh2lzo CGcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qc8UVPEh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24si3848492edp.230.2019.11.29.11.30.01; Fri, 29 Nov 2019 11:30:26 -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; dkim=pass header.i=@kernel.org header.s=default header.b=qc8UVPEh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbfK2TYv (ORCPT + 99 others); Fri, 29 Nov 2019 14:24:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:40422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726926AbfK2TYv (ORCPT ); Fri, 29 Nov 2019 14:24:51 -0500 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AD2B1207FA; Fri, 29 Nov 2019 19:24:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575055490; bh=PiWQMksBfOFU77+Sa7gt5Uz57Cj0o+N3a0RruMCZB2Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qc8UVPEhmnD1KkQiIwI3CH6sy7mCfvqdS+AJ5N27KYN8bFXbIcE3OpCwXm5SK2PEo xKKVELtZ31P8tPBGAt4IXMhbC5X359gRSxbtnAAj60vQwtXmLyPmqsmhMx8wEtTNI9 UU+XhpGrPfHvCUJj4xXz3vzcHzKlaj4mEG9nyQfg= Date: Fri, 29 Nov 2019 11:24:49 -0800 From: Eric Biggers To: Herbert Xu Cc: Daniel Jordan , Linux Crypto Mailing List , Steffen Klassert Subject: Re: [PATCH] crypto: pcrypt - Do not clear MAY_SLEEP flag in original request Message-ID: <20191129192449.GA706@sol.localdomain> 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> <20191129084024.arwefx7bpvvxpyjk@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191129084024.arwefx7bpvvxpyjk@gondor.apana.org.au> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, Nov 29, 2019 at 04:40:24PM +0800, Herbert Xu wrote: > 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); > } Tested-by: Eric Biggers