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 93C42EB64DB for ; Wed, 14 Jun 2023 08:58:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235577AbjFNI6b (ORCPT ); Wed, 14 Jun 2023 04:58:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbjFNI62 (ORCPT ); Wed, 14 Jun 2023 04:58:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8635E1BD4 for ; Wed, 14 Jun 2023 01:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686733060; 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=XLKEe5F6xXngYE09X9rD2VCOd+wftGw7A/Tkdmq7wYw=; b=aXMWwXw8bSoJXuhhw/sgmE6MmPCGp8kp1a4mf7QwhTat9ag9lh04H11asfmpp/0glFusf6 +NrZ5CHBSfefX94t0Fi979tDuWBBsSo2AWdLDlzyP/yNJ7W4LFbVunqF3ATLYaEAvXj2TR g+z2h+1P8h4mKRC5XhwIElxoWaQpNkY= 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-643-8qWeZPviMAS61fOjx3qWcA-1; Wed, 14 Jun 2023 04:57:37 -0400 X-MC-Unique: 8qWeZPviMAS61fOjx3qWcA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4086A80067D; Wed, 14 Jun 2023 08:57:36 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4784140C20F4; Wed, 14 Jun 2023 08:57:32 +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: <0000000000000900e905fdeb8e39@google.com> References: <0000000000000900e905fdeb8e39@google.com> To: syzbot Cc: dhowells@redhat.com, brauner@kernel.org, kuba@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk Subject: Re: [syzbot] [fs?] general protection fault in splice_to_socket MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1423374.1686733050.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Wed, 14 Jun 2023 09:57:30 +0100 Message-ID: <1423375.1686733050@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Here's a much reduced test program. The key is to splice more than a page from the pipe into the second socket (AF_ALG in this case) and more than t= hat into the pipe. David --- // https://syzkaller.appspot.com/bug?id=3D613f5060400df25674e1b213295ef45a= 8422b077 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #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) static const unsigned char data[1024 * 1024] =3D { "\x44\xf9\xb1\x08\xb1\xcd\xc8\x85\xc9\xc5\x33\xd2\x1f\x47\x4b\xec\x8b" "\xfe\xf1\xdf\x1e\x2d\xa7\x1e\x57\x8d\xc6\xb9\x1d\x09\xf7\xab\x15\x37" "\x85\x71\xd8\xe2\x75\x46\x09\x00\x00\x00\x6e\x75\x43\x69\x14\xab\x71" "\x75\x28\xee\x4b\x7a\x9b\xea\xf9\x08\xd1\x11\x37\xc1\x19\x03\x06\x4e" "\x83\xb4\x95\x1f\x4d\x43\x3a\x54\x04\x97\x0c\x85\xd9\x2d\x70\x83\xfd" "\x38\x84\x4c\xbb\x0c\x6c\x5e\xb5\x08\xdd\xc2\xdc\x7a\x59\x0a\xa7\x94" "\x1b\x1e\x9e\xeb\x5a\x68\x81\x38\xde\xa0\x9b\x77\x6c\xbf\xa7\x84\xcb" "\xf5\x50\xbf\x30\x74\xfb\x0d\x77\x5d\xa4\xdf\x5a\x3f\x48\xbb\xdf\x45" "\x2e\xeb\x6b\x92\x3d\xa9\xd0\xe2\x5b\x80\xf7\x6a\x87\x36\x64\xb5\x75" "\x34\x44\xfe\x05\xf3\x3e\x5f\x91\x04\x55\x40\x83\x6c\x3c\xd6\xaf\x10" "\xf0\xcd\x01\x8f\x0c\x6f\x57\xf9\x26\xac\x95\x9a\x56\x28\xc4\x50\x88" "\xfb\xe0\xc8\x7f\xbe\x6c\xbc\xda\x46\x62\xd2\xa1\x2f\x6d\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", }; int main(int argc, char *argv[]) { struct sockaddr_in6 sin6; struct sockaddr_alg salg; int pipefd[2], ipv6fd, algfd, hashfd, res, wt; res =3D pipe(pipefd); OSERROR(res, "pipe"); ipv6fd =3D socket(AF_INET6, SOCK_STREAM, IPPROTO_IP); OSERROR(ipv6fd, "socket/inet6"); memset(&sin6, 0, sizeof(sin6)); sin6.sin6_family =3D AF_INET6; sin6.sin6_port =3D htons(2); res =3D bind(ipv6fd, (struct sockaddr *)&sin6, sizeof(sin6)); OSERROR(res, "bind/inet6"); memset(&sin6, 0, sizeof(sin6)); sin6.sin6_family =3D AF_INET6; sin6.sin6_port =3D htons(2); sin6.sin6_addr.s6_addr[15] =3D 1; res =3D sendto(ipv6fd, NULL, 0, MSG_OOB|MSG_NOSIGNAL|MSG_FASTOPEN|0x20000= 00, (struct sockaddr *)&sin6, sizeof(sin6)); OSERROR(res, "sendto_1"); res =3D send(ipv6fd, data, 0xd0d0c2ac /* massive overrun */, MSG_OOB); OSERROR(res, "sendto_2"); algfd =3D socket(AF_ALG, SOCK_SEQPACKET, 0); OSERROR(algfd, "socket/alg"); memset(&salg, 0, sizeof(salg)); salg.salg_family =3D AF_ALG; strcpy(salg.salg_type, "hash"); strcpy(salg.salg_name, "sha3-512"); res =3D bind(algfd, (struct sockaddr *)&salg, sizeof(salg)); OSERROR(res, "bind/alg"); hashfd =3D accept4(algfd, NULL, 0, 0); OSERROR(hashfd, "accept/alg"); switch (fork()) { case -1: OSERROR(-1, "fork"); case 0: res =3D splice(pipefd[0], 0, hashfd, 0, 65536, 0); OSERROR(res, "splice/p->h"); return 0; default: sleep(1); break; } res =3D splice(ipv6fd, 0, pipefd[1], 0, 32767, 0); OSERROR(res, "splice/i->p"); wait(&wt); return 0; }