Received: by 2002:a05:7412:a9a8:b0:f9:92ae:e617 with SMTP id o40csp120164rdh; Wed, 20 Dec 2023 18:43:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNllifhwCi8SK/BjIBZP7ZNXEmQzeZdfq/e47oiL1JAZupzM+8OekaNxwqbPozzsKqKJtD X-Received: by 2002:ac2:4108:0:b0:50e:401d:b20c with SMTP id b8-20020ac24108000000b0050e401db20cmr2136752lfi.95.1703126588861; Wed, 20 Dec 2023 18:43:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703126588; cv=none; d=google.com; s=arc-20160816; b=kbsoou2kGyy02d4acvEs+CP2uOwtYoELQw6KssUxhp45yszNHLCQoY4E8ch2UV3pzV F+6zpy0uvz3RltmBwOWLIrjH3ihfmThkpiQ85cLGrZVMr1deKWua8ecor85x2qE3p0be fGDBZy6R0Lc9wC0I3A2zRSik+RYwHjHs4B5Vk0cTXzUtVfu92qlEw8xhuCT5w7P1JRIy yHiLFQD0FtDrhnYBXC35c6wBhFpI3sFkD4B5cC+eyfdmzkGlbTKKnhGGevDR79smUJuk IPNf/uRuP4hax+Vso2sS5iywyVePxuTqUvByHtCNbcAMBf3FfBxcFYxGSCMmr8f49mdk bM4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=RvOybpHR8VWa05FA0wwhEBCtD8Trjj5n1vYsA8WsJQ4=; fh=tkD33rSmOU/3NKpuG4rWPParPN1QCe1fD07XGoiu0tY=; b=el1erOrEUuaTJUlx/3sFJVvIXYKBXMaLwt8Au1WH/lE86dSs903LycfxpjplXuiEB3 lVE+/rlJ6zASDbTxQgZG53z80xnYGUiYr3aYovc159bhOz7WTfzVvZz9hcJqNf2eAvDL 37wi9rPdOc7z0+Z+W+Gu3ZnWW7I5NgKPOi6oC63LMs3IJ6GTTfeJn03F0GfKwaJWwfWp t9J2S+DykR2xU2S+0Q38j45CEceRHZ1tVbcYNDIL2QevtnIYC7QlFvgvSoJbUz11whwt siMqB1+er/Z04mzG5ukFY57KgQEhPYagDIIbF8dMBpmeRAjLgTE6su/rfyHKgSP1HSLM F6HQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto+bounces-947-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-crypto+bounces-947-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cf10-20020a0564020b8a00b00553add301f5si394485edb.145.2023.12.20.18.43.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 18:43:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-947-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto+bounces-947-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-crypto+bounces-947-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 771E91F23580 for ; Thu, 21 Dec 2023 02:43:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B02B9441C; Thu, 21 Dec 2023 02:43:02 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7D044416; Thu, 21 Dec 2023 02:42:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gondor.apana.org.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gondor.apana.org.au Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1rG91K-00DGnB-B3; Thu, 21 Dec 2023 10:42:47 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Thu, 21 Dec 2023 10:42:57 +0800 Date: Thu, 21 Dec 2023 10:42:57 +0800 From: Herbert Xu To: syzbot Cc: davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Edward Adam Davis Subject: [PATCH] crypto: skcipher - Pass statesize for simple lskcipher instances Message-ID: References: <000000000000d52e14060cc9c551@google.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000000000000d52e14060cc9c551@google.com> On Mon, Dec 18, 2023 at 06:43:27AM -0800, syzbot wrote: > > syzbot found the following issue on: > > HEAD commit: 17cb8a20bde6 Add linux-next specific files for 20231215 > git tree: linux-next > console+strace: https://syzkaller.appspot.com/x/log.txt?x=1129f3b6e80000 > kernel config: https://syzkaller.appspot.com/x/.config?x=ec104439b5dbc583 > dashboard link: https://syzkaller.appspot.com/bug?extid=8ffb0839a24e9c6bfa76 > compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40 > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17d23c01e80000 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14cfe021e80000 ---8<--- When ecb is used to wrap an lskcipher, the statesize isn't set correctly. Fix this by making the simple instance creator set the statesize. Reported-by: syzbot+8ffb0839a24e9c6bfa76@syzkaller.appspotmail.com Reported-by: Edward Adam Davis Fixes: 662ea18d089b ("crypto: skcipher - Make use of internal state") Signed-off-by: Herbert Xu diff --git a/crypto/lskcipher.c b/crypto/lskcipher.c index a06008e112f3..0b6dd8aa21f2 100644 --- a/crypto/lskcipher.c +++ b/crypto/lskcipher.c @@ -642,6 +642,7 @@ struct lskcipher_instance *lskcipher_alloc_instance_simple( inst->alg.co.min_keysize = cipher_alg->co.min_keysize; inst->alg.co.max_keysize = cipher_alg->co.max_keysize; inst->alg.co.ivsize = cipher_alg->co.base.cra_blocksize; + inst->alg.co.statesize = cipher_alg->co.statesize; /* Use struct crypto_lskcipher * by default, can be overridden */ inst->alg.co.base.cra_ctxsize = sizeof(struct crypto_lskcipher *); -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt