From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751781AbdK1Hn6 (ORCPT ); Tue, 28 Nov 2017 02:43:58 -0500 Received: from mail.eperm.de ([89.247.134.16]:42522 "EHLO mail.eperm.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751318AbdK1Hn5 (ORCPT ); Tue, 28 Nov 2017 02:43:57 -0500 From: Stephan Mueller To: Eric Biggers Cc: syzbot , davem@davemloft.net, herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: KASAN: use-after-free Read in aead_recvmsg Date: Tue, 28 Nov 2017 08:43:54 +0100 Message-ID: <1713831.MCFILKZksC@tauon.chronox.de> In-Reply-To: <20171128072944.GA23565@zzz.localdomain> References: <001a113ebb5ece8a7a055efb7676@google.com> <5111191.QYDWLsXdp1@tauon.chronox.de> <20171128072944.GA23565@zzz.localdomain> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Dienstag, 28. November 2017, 08:29:44 CET schrieb Eric Biggers: Hi Eric, > > Sometimes you have to reboot to get the reproducer to work, because the bug > has to do with referencing counting of the "null skcipher" which is a > global resource. Here's a patch that fixes it, it seems: > > ---8<--- > > From 453b54793e843c0d5b8fd2d5e33fcc5427ec038e Mon Sep 17 00:00:00 2001 > From: Eric Biggers > Date: Mon, 27 Nov 2017 23:23:05 -0800 > Subject: [PATCH] crypto: algif_aead - fix reference counting of null > skcipher > > In the AEAD interface for AF_ALG, the reference to the "null skcipher" > held by each tfm was being dropped in the wrong place -- when each > af_alg_ctx was freed instead of when the aead_tfm was freed. As > discovered by syzkaller, a specially crafted program could use this to > cause the null skcipher to be freed while it is still in use. > > Fix it by dropping the reference in the right place. > > Fixes: 72548b093ee3 ("crypto: algif_aead - copy AAD from src to dst") > Reported-by: syzbot > Cc: # v4.14+ > Signed-off-by: Eric Biggers Yes, absolutely -- the null cipher is allocated together with the AEAD cipher and should be freed together with the AEAD cipher. Thanks a lot. Reviewed-by: Stephan Mueller Ciao Stephan