From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40498EB64DA for ; Wed, 14 Jun 2023 11:26:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240897AbjFNL0K (ORCPT ); Wed, 14 Jun 2023 07:26:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233227AbjFNL0F (ORCPT ); Wed, 14 Jun 2023 07:26:05 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24378199B for ; Wed, 14 Jun 2023 04:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686741922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XQW9t8cuqrwkY9pUeYFF63NpZzJyoEH492TVoQI3+po=; b=AfB9Wt4IRErf3mj0L0L/3jaXymdds4koUaOLq5a40bORy9gu4wgu8kjKmlbzy2RkqoU1rM Wm+H9FQhC9T88UkQXi/VCvtaIoUQE8Xw6w7/pg0TVw9ySLbBYT2cJpqrpKAlrg14TWodi2 blgWKT50ekoUf1dseLtKaDQ8f6d5Sm8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-18-DM96FWN-P7SlKHJzKITofw-1; Wed, 14 Jun 2023 07:25:19 -0400 X-MC-Unique: DM96FWN-P7SlKHJzKITofw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A24FB85A58A; Wed, 14 Jun 2023 11:25:18 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0F64492CA6; Wed, 14 Jun 2023 11:25:15 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <000000000000b928f705fdeb873a@google.com> References: <000000000000b928f705fdeb873a@google.com> To: syzbot Cc: dhowells@redhat.com, davem@davemloft.net, herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [crypto?] general protection fault in shash_async_final MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1433014.1686741914.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Wed, 14 Jun 2023 12:25:14 +0100 Message-ID: <1433015.1686741914@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Here's a reduced testcase for this. The key seems to be passing MSG_MORE = to sendmsg() and then not following up with more data before calling recvmsg(= ). Apart from not oopsing, I wonder what the behaviour should be here? Shoul= d recvmsg() return an error (EAGAIN or ENODATA maybe) or should it close the existing operation? David --- // https://syzkaller.appspot.com/bug?id=3Df5d9d503fe959e3b605abdaeedb39b07= 2556281a // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #define OSERROR(R, S) do { if ((long)(R) =3D=3D -1L) { perror((S)); exit(1= ); } } while(0) int main(void) { struct sockaddr_alg salg; struct msghdr msg; int algfd, hashfd, res; algfd =3D socket(AF_ALG, SOCK_SEQPACKET, 0); OSERROR(algfd, "socket"); memset(&salg, 0, sizeof(salg)); salg.salg_family =3D AF_ALG; strcpy(salg.salg_type, "hash"); strcpy(salg.salg_name, "digest_null-generic"); res =3D bind(algfd, (struct sockaddr *)&salg, sizeof(salg)); OSERROR(res, "bind/alg"); hashfd =3D accept4(algfd, NULL, 0, 0); OSERROR(hashfd, "accept/alg"); res =3D setsockopt(3, SOL_ALG, ALG_SET_KEY, NULL, 0); OSERROR(res, "setsockopt/ALG_SET_KEY"); memset(&msg, 0, sizeof(msg)); res =3D sendmsg(hashfd, &msg, MSG_MORE); OSERROR(res, "sendmsg"); res =3D recvmsg(hashfd, &msg, 0); OSERROR(res, "recvmsg"); return 0; }