Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5801760rwr; Mon, 24 Apr 2023 09:08:38 -0700 (PDT) X-Google-Smtp-Source: AKy350ZU8Lzd6mUOUNW7fiLtqrOyygpNjoScO1jiuTEpj6V2E4lnSXH6Snc9GTb6uWGQ/fmCKvta X-Received: by 2002:a17:902:eb8f:b0:1a6:494b:5b0 with SMTP id q15-20020a170902eb8f00b001a6494b05b0mr13264329plg.40.1682352517920; Mon, 24 Apr 2023 09:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682352517; cv=none; d=google.com; s=arc-20160816; b=w55KqhFEHHBZH4vaDjwNNZK+3O7F/4+CGLAnunMo/1uroH8Uu+U1O5xwESaJJ8wIWn RL8eJHL16WotRfhZWJZfCtlO04Qw6vAi+KAeTdMCAO1DZTdkFEjouJOEAq/qsPtYgkCr G+kW1TVfwe2V7j2svh93nQX1bskzKeG1kz5te/ViCa4ZhbBUphyDXYHT7sor81ypJACn wOn/+DzvPI9VNQrj790icTFDuLgYNTmO9E/dTn92e5smz9ZuWoWtY64gzkg5/h2BakVX DHPdZjH4lfjSjxA4OOi2bYaYdDwbC1gDi+O5D3uYgbyvONhuISTYQNq6Z89kFFUsUQI3 E/TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=UvD4N29l/ZIppjDRrnUsGmGtNacE+xibdoS17eqPvOQ=; b=fb9PEwZFp/EY/DaMyXXl7Ap0g55PUYsNZyTCWwQhgQpyj/yuH1RbZCkO8mr4arI3jA SEBiUa/mJMRYa+nImGlVtaqGrsEvPips2dyKM1JV+iDZGjZpW6LkoXMa3qFGLzCW+EmT SdAd/UH/Mcn+2HvnxKFf71YSyLrbdUuTczM3nJBYCrAYb56Fi7M+V/LX6hd0UZa/DjXR gMFhRCi3RqhTDINXnAeoJPLIRILaLUFuedS3NWbPZPbT1SfLhXw1nV4Uo08b8xwhlF5v v85+TTnehY1Dvu7tWKa4Z1nnx8kA+TCo5Y/Ca3fY/9876zTYZ87yBLdO23vko6MNG7Qt 8bfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DD4jc1GU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d12-20020a170902654c00b001a6db2bef24si10784991pln.145.2023.04.24.09.08.19; Mon, 24 Apr 2023 09:08:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DD4jc1GU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231975AbjDXQGr (ORCPT + 99 others); Mon, 24 Apr 2023 12:06:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231715AbjDXQGq (ORCPT ); Mon, 24 Apr 2023 12:06:46 -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 4A1377688 for ; Mon, 24 Apr 2023 09:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682352366; 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=UvD4N29l/ZIppjDRrnUsGmGtNacE+xibdoS17eqPvOQ=; b=DD4jc1GUdNzaOX9qbO+m7uYTqE+fgdXweKs8XwABFKCBE/tFj6M2MbV3sDVQxxizfuHk/U v/Y4x5G8Y4Tu0Zr2dzP0pYoH8Yn/qHRph1F7DxLkotoeLlkRHGYlV6QTDl1UwdVed0vSob LXwr5kkAfv90ODwHhzDJkzVahLkNwHA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-373-fw-hO7gKOXiCYc7jHZzciQ-1; Mon, 24 Apr 2023 12:06:02 -0400 X-MC-Unique: fw-hO7gKOXiCYc7jHZzciQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DEEBA29AB3E1; Mon, 24 Apr 2023 16:06:01 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 075232027043; Mon, 24 Apr 2023 16:05:59 +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: References: <000000000000e7c6d205fa10a3cd@google.com> To: Dmitry Vyukov Cc: dhowells@redhat.com, syzbot , davem@davemloft.net, edumazet@google.com, kuba@kernel.org, linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, marc.dionne@auristor.com, netdev@vger.kernel.org, pabeni@redhat.com, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [afs?] [net?] KCSAN: data-race in rxrpc_send_data / rxrpc_set_call_completion MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <457893.1682352358.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Mon, 24 Apr 2023 17:05:58 +0100 Message-ID: <457894.1682352358@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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-kernel@vger.kernel.org Dmitry Vyukov wrote: > If I am reading this correctly, rxrpc_send_data() can read wrong > call->completion and state and incorrectly exit with an error if > rxrpc_wait_to_be_connected() exists early right after observing error > set here: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/= net/rxrpc/sendmsg.c?id=3D148341f0a2f53b5e8808d093333d85170586a15d#n58 > The code seems to assume that at that point all writes done by > rxrpc_set_call_completion() are already finished, but it's not > necessarily the case. I'm not sure it matters. call->error can only be set by the I/O thread an= d only if a call fails - in which case the call state will be set shortly thereafter - plus a couple of places where we fail to set the call up, in which case we're under the call's user_mutex or didn't even manage to full= y allocate it. That said, I probably should check the call state first. I might also wan= t to ignore any signal if the call did manage to get connected, lest I leave it dangling - a problem might come if userspace issues a single sendmsg() to = set up the call and supply data to be transmitted. I need to have a ponder on that one. David