Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp31590180rwd; Fri, 7 Jul 2023 01:19:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlHaZKAnXIaQzS2CR+WY/ewqW+1AMVa4DsKIWLV1fOuQZbMm1/6HMTKEm9A+VywTEaYHaxXD X-Received: by 2002:a05:6871:296:b0:1b3:8cfd:fecf with SMTP id i22-20020a056871029600b001b38cfdfecfmr4257469oae.0.1688717984716; Fri, 07 Jul 2023 01:19:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688717984; cv=none; d=google.com; s=arc-20160816; b=e3XNf58Vo5P/VzAEeVqcBA6Be/T8SgZ8JrK53JEgNVypdjOxZlxW2pAYj2DImQeLkn koZbI8h19Mp9nuBLiyMP27WUid+Kq70OoC+qqkqG3Xr2N+jZ9ogmYt1WiIynjZp/wXQY dRRH0+LGwqiykJKXsaLAubPDkTmG27BNGQJOGxezDBOzh1GCZE7DVaExos8fLi24h9JE D0l3dzOg1dPk4K9L73cBpGpmIam5oUl4d4HunaVljS2XstcNqVI/vKkZ7CjSRblIEtVU 6DcnBhnxV1Qi7cmAgWeg7Csyzo8QOM0xpYPkT8/ezi8Og92yDe+1/pkBvv4eh/qXttEY hjyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:in-reply-to:date :mime-version; bh=Bo4MAJ4BG1isgQnCAcKhexSWW5SZFcBYqjHiQhX1gxE=; fh=4MZmIwMOKNRGjx5LzD3qnrfL1jpfsHG8bLHoKpmfUiM=; b=jczMgKhLc5P/rQ6bgctXuFEu/ULe5/9FLA/b5NNUmB4vO7iO/KcEx30FrQyH1VlFOc aWQQZVHPhvG1kkwfwItZ3ZIT90fXK+3w++6XDnenSh2bQoto7SGjRRg4qZLcqpBSCyyz waEnT29Kf4Dw5+B55Ugmn4m527OljcSQ+nm8wuTaaCXsMXsTP260C0lDTLWoa5zvgdKY rL83rVHIOa9Vn1CPWBTLM+YqOXtkq0nJ20nAN037cURZHLQH/XURYFefQdkSv9qZHrHe NiaPSC5cbEdSlt8bpeY2PkjPZyn//QgDTkVNQKsHPVXHzZROrlp8yJzLgvFNS6zalovo PrJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g1-20020a17090adac100b0025bcf85bda2si1545107pjx.7.2023.07.07.01.19.25; Fri, 07 Jul 2023 01:19:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232795AbjGGINP (ORCPT + 99 others); Fri, 7 Jul 2023 04:13:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232779AbjGGINO (ORCPT ); Fri, 7 Jul 2023 04:13:14 -0400 Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB6C61FD8 for ; Fri, 7 Jul 2023 01:13:13 -0700 (PDT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-5428d1915acso2231620a12.0 for ; Fri, 07 Jul 2023 01:13:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688717593; x=1691309593; h=cc:to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Bo4MAJ4BG1isgQnCAcKhexSWW5SZFcBYqjHiQhX1gxE=; b=aUTIejy1HXRArNem+0iRxEVHdAMOT8TV66ktY/IO8cWUczq9MhgTdUavLCVmejRdxc ihrGFRdXVVc2IZCakulrkQT5sVsQ51L81sRL9iqE48UOy1h5t/ZeM0YhC0UfI9k4GYut JfN6dGp4WABNnwJl1UcElKbbk5p7PNVDR+pwz1HEy3iigcfo3gswuwunwiawu8LYtLDE Ow/tlOd/czIucSFX7VUfNgNxVeU1WoNNVlsm9dWFBtDpqC7H3tWQaeqa+mMb0w8mvtjN hVPsIjJKCZe3hWJx/sZ/6pWnm4fcnKaOvxdw2Gi6YE4WCeCyjs5GhTxE1hRLq2LAXQPE LzzQ== X-Gm-Message-State: ABy/qLakyH/mG5atXq+rt0VFMB93fCejQGjNU59qfuZjdJucI7c6dxO4 CHuYofAQHVwxNvx75LQ9G93elXVSvU9qQKOZNT0TVGHq8suB MIME-Version: 1.0 X-Received: by 2002:a63:b253:0:b0:553:9efa:1159 with SMTP id t19-20020a63b253000000b005539efa1159mr3380049pgo.0.1688717593343; Fri, 07 Jul 2023 01:13:13 -0700 (PDT) Date: Fri, 07 Jul 2023 01:13:13 -0700 In-Reply-To: <2225020.1688717586@warthog.procyon.org.uk> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <0000000000004700d505ffe1348d@google.com> Subject: Re: [syzbot] [crypto?] KASAN: slab-out-of-bounds Write in crypto_sha3_final (2) From: syzbot To: dhowells@redhat.com Cc: davem@davemloft.net, dhowells@redhat.com, herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,FROM_LOCAL_HEX, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org > I'm pretty certain this is the same as: > > https://syzkaller.appspot.com/bug?extid=689ec3afb1ef07b766b2 > > as I sometimes see the same trace when running the reproducer from there. > --- > > #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master This crash does not have a reproducer. I cannot test it. > > crypto: algif/hash: Fix race between MORE and non-MORE sends > > The 'MSG_MORE' state of the previous sendmsg() is fetched without the > socket lock held, so two sendmsg calls can race. This can be seen with a > large sendfile() as that now does a series of sendmsg() calls, and if a > write() comes in on the same socket at an inopportune time, it can flip the > state. > > Fix this by moving the fetch of ctx->more inside the socket lock. > > Fixes: c662b043cdca ("crypto: af_alg/hash: Support MSG_SPLICE_PAGES") > Reported-by: syzbot+689ec3afb1ef07b766b2@syzkaller.appspotmail.com > Link: https://lore.kernel.org/r/000000000000554b8205ffdea64e@google.com/ > Signed-off-by: David Howells > cc: Herbert Xu > cc: Paolo Abeni > cc: "David S. Miller" > cc: Eric Dumazet > cc: Jakub Kicinski > cc: linux-crypto@vger.kernel.org > cc: netdev@vger.kernel.org > > diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c > index 0ab43e149f0e..82c44d4899b9 100644 > --- a/crypto/algif_hash.c > +++ b/crypto/algif_hash.c > @@ -68,13 +68,15 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg, > struct hash_ctx *ctx = ask->private; > ssize_t copied = 0; > size_t len, max_pages, npages; > - bool continuing = ctx->more, need_init = false; > + bool continuing, need_init = false; > int err; > > max_pages = min_t(size_t, ALG_MAX_PAGES, > DIV_ROUND_UP(sk->sk_sndbuf, PAGE_SIZE)); > > lock_sock(sk); > + continuing = ctx->more; > + > if (!continuing) { > /* Discard a previous request that wasn't marked MSG_MORE. */ > hash_free_result(sk, ctx); >