Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1170072rdb; Fri, 2 Feb 2024 16:54:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvMJrZqsM4zBUItC4guY6Wpz/sJTtyv/sKQfP5lps29CaANCU9NamwdkxoAFIfk/Fgtm8N X-Received: by 2002:a9d:769a:0:b0:6e1:1492:3653 with SMTP id j26-20020a9d769a000000b006e114923653mr3734063otl.5.1706921649193; Fri, 02 Feb 2024 16:54:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706921649; cv=pass; d=google.com; s=arc-20160816; b=jtvY9KkNyVPtnAIDtZhLvcqbZ74Y1sFS4JxuFJfQ7SIR3F3mFQRwhthL++mF5QPiv1 PJqaGxUQLBbbeCmRMU7+oklx5W7IAPH0ilItffPsVtturzQL7JVBRZDffiKv4c556Fog u6o//iH5l46lfSdrU26zOT2IYXZBdA5DsMiGtDhjx9V9XFJ8u14f0CakiEb7LNqyuoZY 1jvkuMPRh8P32fC7UuF8H2UPuwDvVTg7P662zidX0HPbsz0UOopZvhih62m5ur2/a/LH oaLj8qO1iuL46jY1RkLyROCZZX5arPL1VNneXAjCnItu+cQZY9VoLtTHDmHKZwYJ9S4y 1d2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=GgFf7oVMFrQgYbyPq9FUQJUdK1QH/g/LpSi+QNkViLY=; fh=zOFW3yvTJBAtv6JbwFMBAencRSlTxJ+VURO4Ck53GBk=; b=w5n63tdaQDDGkd2IgBj8oxe2lE1pXJtwBPWYbMyMfBjq5lgRBbuxxpNEb7H2MmjD8d TwSDW5ujS+Azw1/KaDRCbpFZw4FWe+PkZMtjnXGaDAygRfv+7fK0L7FO3Vt4Fq3jCIKh 63Nhu2zywhj5VztQaw/AMDa1PeAHVupWgSypYUQD1uqPkxLyonY0Kz2uyWqwa1oeSEQT wdEAMdkvFkGM3+pKN2qmpqAKqKtE5E2qmxtRTTvcKXpwDplfYMWKShMHke505b9KUXqE qQFQZnJSkTPA1fHv1cU5Hxh9Vo2aRtD6Fao77mjYiZil8S3Qx4HTFmSUaQovJsEzGh2C hJVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-50795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50795-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWTV3WrfNcwYLsaNldh2aK/1fh0fLEAH+3ME9mkEQRXxD+q6TwmupXNU4ecONniQC2F5QwpIpu+ysY2mwRQZa6F0t2Xwxj1GaZgCqPxsA== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id l17-20020a63f311000000b005b95ee3edc6si2388214pgh.628.2024.02.02.16.54.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 16:54:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-50795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50795-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 662F5B29DD0 for ; Sat, 3 Feb 2024 00:44:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69A2D23B7; Sat, 3 Feb 2024 00:44:06 +0000 (UTC) Received: from mail115-24.sinamail.sina.com.cn (mail115-24.sinamail.sina.com.cn [218.30.115.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D391C1FB2 for ; Sat, 3 Feb 2024 00:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.24 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706921045; cv=none; b=GJhVs6wo3XLhHr4vJ6PxQzWStNZLZP4CdJcSoZ0q41wtrc/bgo6OFRzH3cszLlUK9kvAjpT2Aeh2kJenGIdh+n/PMw0kw5iQr20o0GpTqXwCA4PfrZSUHssW829brTm+tQ6ftlPF7XqvqEphKqo6dq94CV94xpoGUJ/oasZGgio= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706921045; c=relaxed/simple; bh=Iex1O2tO1cn1lvKcNF5xwKw1S3qkF5JiJoARhRTEN3Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DniBrOki5R8dtKVmLgL6G6HoiCca7Kxh4B0TPkMlCLSMPsxISq/Yjpd2EKnKJdvF5iRqnUx9JCWP6OLwteT3v80Yc6NhdbpdABAqvsI8GK5sXLz6evNO5yCjwW3TK0DYi712tWYe9YsgjM3q5gzINA37zJWOJJrDj/4BRjiAhXE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.115.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.118.70.27]) by sina.com (10.75.12.45) with ESMTP id 65BD8BBA00007161; Sat, 3 Feb 2024 08:41:32 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 87338931458171 X-SMAIL-UIID: 60426E2BFD414186A3F139DCDC2497A6-20240203-084132-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [net?] WARNING in __unix_gc Date: Sat, 3 Feb 2024 08:41:22 +0800 Message-Id: <20240203004122.1625-1-hdanton@sina.com> In-Reply-To: <0000000000003555920610660fbc@google.com> References: <0000000000003555920610660fbc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Fri, 02 Feb 2024 05:26:28 -0800 > HEAD commit: 1701940b1a02 Merge branch 'tools-net-ynl-add-features-for-.. > git tree: net-next > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12d6927be80000 #syz test --- x/net/unix/garbage.c +++ y/net/unix/garbage.c @@ -237,6 +237,8 @@ static void inc_inflight(struct unix_soc usk->inflight++; } +static int recycle; + static void inc_inflight_move_tail(struct unix_sock *u) { u->inflight++; @@ -245,8 +247,10 @@ static void inc_inflight_move_tail(struc * of the list, so that it's checked even if it was already * passed over */ - if (test_bit(UNIX_GC_MAYBE_CYCLE, &u->gc_flags)) + if (test_bit(UNIX_GC_MAYBE_CYCLE, &u->gc_flags)) { list_move_tail(&u->link, &gc_candidates); + recycle++; + } } static bool gc_in_progress; @@ -259,6 +263,7 @@ static void __unix_gc(struct work_struct struct list_head cursor; spin_lock(&unix_gc_lock); + recycle = 0; /* First, select candidates for garbage collection. Only * in-flight sockets are considered, and from those only ones @@ -342,7 +347,7 @@ static void __unix_gc(struct work_struct spin_lock(&unix_gc_lock); /* All candidates should have been detached by now. */ - WARN_ON_ONCE(!list_empty(&gc_candidates)); + WARN_ON_ONCE(!list_empty(&gc_candidates) && !recycle); /* Paired with READ_ONCE() in wait_for_unix_gc(). */ WRITE_ONCE(gc_in_progress, false); --