Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp153307rdb; Wed, 21 Feb 2024 22:08:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVVgHtJDHRc9F0anbRzds21V/ZGjH30SoVniSLdMqh5pEWi6BE1QSJOoWBPqVNhSOIkt5aIopuq4nIr4sF7mdp2f+OI43w0E4bUHJB+1A== X-Google-Smtp-Source: AGHT+IFQyoL9Ju6zmyliKBXu3SZCu2liz3GC6h5K4wHwhMePNVSFjNzr16Zga0VpXugMgbm7ZbVH X-Received: by 2002:a92:c612:0:b0:365:6767:a43f with SMTP id p18-20020a92c612000000b003656767a43fmr433148ilm.20.1708582099201; Wed, 21 Feb 2024 22:08:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708582099; cv=pass; d=google.com; s=arc-20160816; b=hyJ7TQsPTdAIp9+0aReiZjjF0qAUCqHk9AtyQZwP8a0JHH4r9hHM7M/J+CQC1USWMb 7ykG0958Bw3vn9Jw8+hJIB/0P704tlisz3oQrvcE7rGZ73uP7m0KLdSr71y8z4qM7FhW 4Z296h8oAaZfmP97ivTnc5eGTisRucOh17q7yp1Mc0nZxeCfHskYk5H77lEHVipGL6aw mUI8dReLovpWXPIlu7zm8AUUWthcjcARDfGkaDt3RjAMFmohJckaawIVN3lUSF33vHrI strQfiO389HF14yT/C6BLk7RXVH2pc2DTrUwHBidLMto8t9KZD8JMBO1LyEEsCxe+Ikb lS3w== ARC-Message-Signature: i=2; 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=btuFC0zpAPZ/Fqu7WnksKoth4LaKHILCTfD6eTwzai8=; fh=zuUBRxb1/ePVhLalpQBEmxps2sXB/GBHXCxCBwh2A9Q=; b=yK7K5O/azdNiaweh6tKVQ1faaZZSVpPIHOscNmMmr5wfmdfueAqvajHssW0XzkE/kG pw4N1u2+aT2kE0HzTV4FQG2GhalqLzhx0rULDRf1OMqyu1WtM6WOE1f6GGfUlZGxItAM gmbfy7TO6/KnyMPKXWwTGNQaHit/Ku+xm+1Y9AeWXofWGqqprQ7Zzxd1eV7ECUsl2VfF X9IHTmNVxMOR3pSjGIeyhpnbhEnCZ2mrNAau9/rcBsGF2g6w00aryyhP1nRrwautnDw1 vxXHptowA7nTVAsxlpF6/TgJH4H/qVUvpepzS0MnpQ88xtLEueE2njHWuYiJAWkFhy6Z KC2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gondor.apana.org.au dmarc=pass fromdomain=gondor.apana.org.au); spf=pass (google.com: domain of linux-crypto+bounces-2241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=REJECT sp=QUARANTINE dis=NONE) header.from=apana.org.au Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bv70-20020a632e49000000b005e430f8622asi2709159pgb.714.2024.02.21.22.08.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 22:08:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gondor.apana.org.au dmarc=pass fromdomain=gondor.apana.org.au); spf=pass (google.com: domain of linux-crypto+bounces-2241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=REJECT sp=QUARANTINE dis=NONE) header.from=apana.org.au 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D8AC3283575 for ; Thu, 22 Feb 2024 06:08:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1494912E4F; Thu, 22 Feb 2024 06:08:14 +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 995D112B7E; Thu, 22 Feb 2024 06:08:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=144.6.53.87 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708582093; cv=none; b=XnMcusc5Dk1SH4+Ew2gYuLZ0FsI1GhRG+yf18YNFN5N2hsApNwzEuSmuzghql8ZPTr4JpBt/vS8Vakq7iX/Grghp9lOTDaR/3+mQTGk1b657BiVUrGYx+JQIWW/Uxuz1XTUWzvC5lZ+BMYswqg8/ZnF76Nl5Den6N/RqyFieq2w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708582093; c=relaxed/simple; bh=nHOLKgb6+VtGFQ81POiVMuBjnYJAOQNZZi1g7nE1IdU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BUDi2URoVHVC+UPuJcWGHT+dARw2w1w75wQ77V7rO954Zlo3CkpnhKtcSGtNzTjmZGPvOl8fngKftQ+y6B21NkkEijbhmfEjGA4AQpSsGpzPcZYcQ3Qw6oxl+5dR8lI7v2hB1tsIJbOB/6kg32d3yH26dBuK1jlmCeJ+LSJ+RQA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gondor.apana.org.au; spf=pass smtp.mailfrom=gondor.apana.org.au; arc=none smtp.client-ip=144.6.53.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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 1rd2FQ-00GOPA-IT; Thu, 22 Feb 2024 14:07:57 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Thu, 22 Feb 2024 14:08:11 +0800 Date: Thu, 22 Feb 2024 14:08:11 +0800 From: Herbert Xu To: Ard Biesheuvel Cc: Ard Biesheuvel , linux-crypto@vger.kernel.org, stable@vger.kernel.org, syzbot+f1ceaa1a09ab891e1934@syzkaller.appspotmail.com Subject: Re: [PATCH] crypto: arm64/neonbs - fix out-of-bounds access on short input Message-ID: References: <20240217161151.3987164-2-ardb+git@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: On Thu, Feb 22, 2024 at 12:37:45AM +0100, Ard Biesheuvel wrote: > On Sat, 17 Feb 2024 at 17:12, Ard Biesheuvel wrote: > > > > From: Ard Biesheuvel > > > > The bit-sliced implementation of AES-CTR operates on blocks of 128 > > bytes, and will fall back to the plain NEON version for tail blocks or > > inputs that are shorter than 128 bytes to begin with. > > > > It will call straight into the plain NEON asm helper, which performs all > > memory accesses in granules of 16 bytes (the size of a NEON register). > > For this reason, the associated plain NEON glue code will copy inputs > > shorter than 16 bytes into a temporary buffer, given that this is a rare > > occurrence and it is not worth the effort to work around this in the asm > > code. > > > > The fallback from the bit-sliced NEON version fails to take this into > > account, potentially resulting in out-of-bounds accesses. So clone the > > same workaround, and use a temp buffer for short in/outputs. > > > > Cc: > > Reported-by: syzbot+f1ceaa1a09ab891e1934@syzkaller.appspotmail.com > > Tested-by: syzbot+f1ceaa1a09ab891e1934@syzkaller.appspotmail.com > > Signed-off-by: Ard Biesheuvel > > Ping? It's in my queue. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt