Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp626772imu; Fri, 11 Jan 2019 06:25:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN599M5/g/crMPTPLntkLfJnTSU5QAYFRtC5p462PmyDve0FpAesVXHWThGUEBZs1qYMN3UU X-Received: by 2002:a63:200e:: with SMTP id g14mr13618930pgg.235.1547216735847; Fri, 11 Jan 2019 06:25:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547216735; cv=none; d=google.com; s=arc-20160816; b=Iiryb7EDGN2gVgSzjmdRAiWB+iOJ+2KSTdmtlZKKRfWDoVdGtnYDzrBIZaWxEpJQbb 6Omx76cqqPpHJn4p2rQp9+UhBcQL8t2fFz/IPsZ7FSaQMUn5LljrI91RKQ5Ggbi9bWy/ tXS5WVG5drr68nfXfq3krzCXogE0ZP6eVElJxkmwO8PMDGPj0YXBQ0Mjq0A5gsRWw9uJ oqgCUVAIttuzP3JbK8/UJZfiwrGnFzZz8muXk8zRX1/DY9ecXmuMAI5mKbyErmIjRSj9 ilT1oFERoMmU9MXEJCu+xyfWGH2j+ClM3LoPyNzBb16s3n/mrvAqHiH4MUrbZBvYARc2 8TYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=o+ex0xkbE8NlYz7USA4U4FADEMV0BOwgo+nIkyWGIpI=; b=f+ywKJNgFWpA6FI11xfKMD8jqEfFxe8vv8pDFyP7xmNW9He5yfsMLxxtmaAiJhXruj M8SuNnDSoKMQGo1oYys3owtQFqpSPlI4EVLm29g2/sF/X5vDD74hUfcBraou35J37pJ6 xFLdHrYF1JpZqJ0wWtsp7M16N+Yf11P14JOV6J0qUPhh5pm1OSU7yLobugH/G/QTlqpF sa4sBCU2sBY+Hhu3UgPjZjeU6Vwk+7m0z0OgFkYAkLvvd5kfepTlW6MiQgHnirLLQgCa /AST/hwels/JouprlQIb0x0YZwdjcNDQUf+nq/SzsqoNxpxdx97IYd/hJlsl8yJ8ndv4 9ZQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dmyl2b8x; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si5049402pll.116.2019.01.11.06.25.20; Fri, 11 Jan 2019 06:25:35 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=dmyl2b8x; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731726AbfAKOTW (ORCPT + 99 others); Fri, 11 Jan 2019 09:19:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:36118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731635AbfAKOTQ (ORCPT ); Fri, 11 Jan 2019 09:19:16 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 612272184A; Fri, 11 Jan 2019 14:19:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547216355; bh=eBNcwRIAHZaa+loVhCV6eb6jHJNGvuVtSAhVbvasb3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dmyl2b8xukEPjGAfthkTsMrAOMcgTC5PTc74+bwukylf1+mUE+G/XgXrazj82mP1g lXPJrp8BNQkUOd46Axf/HxzYVilHMl27YorDVcXOiMVrwtGU2EQX9TepnMnzzHVSnC Ty2Yc4MPWpcUcQyLDp+C89W3Mw0UXFSJsI2sJLAA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-crypto@vger.kernel.org, Martin Willi , Eric Biggers , Ard Biesheuvel Subject: [PATCH 4.4 70/88] crypto: x86/chacha20 - avoid sleeping with preemption disabled Date: Fri, 11 Jan 2019 15:08:39 +0100 Message-Id: <20190111131057.758071155@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131045.137499039@linuxfoundation.org> References: <20190111131045.137499039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Biggers In chacha20-simd, clear the MAY_SLEEP flag in the blkcipher_desc to prevent sleeping with preemption disabled, under kernel_fpu_begin(). This was fixed upstream incidentally by a large refactoring, commit 9ae433bc79f9 ("crypto: chacha20 - convert generic and x86 versions to skcipher"). But syzkaller easily trips over this when running on older kernels, as it's easily reachable via AF_ALG. Therefore, this patch makes the minimal fix for older kernels. Fixes: c9320b6dcb89 ("crypto: chacha20 - Add a SSSE3 SIMD variant for x86_64") Cc: linux-crypto@vger.kernel.org Cc: Martin Willi Signed-off-by: Eric Biggers Acked-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- arch/x86/crypto/chacha20_glue.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/crypto/chacha20_glue.c +++ b/arch/x86/crypto/chacha20_glue.c @@ -77,6 +77,7 @@ static int chacha20_simd(struct blkciphe blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt_block(desc, &walk, CHACHA20_BLOCK_SIZE); + desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; crypto_chacha20_init(state, crypto_blkcipher_ctx(desc->tfm), walk.iv);