From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp134-32.sina.com.cn (smtp134-32.sina.com.cn [180.149.134.32]) (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 8B02017721 for ; Mon, 8 Jul 2024 10:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=180.149.134.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720436218; cv=none; b=bAKztpTx2wXE2SHOp7DeFfJOCyYqp/i/ooqnCtY6+2eICc2lOULumVdW0TyM9qAcrZI+BQz8ns7mNEv/kBb/dUs7s26QBgr7Aa9wOR7ZFFn3k2DdjWKILLda31qmIg8LJIRkTL8hfAUozlJ+RWwly9eScUpR7o/Oyr07duS2ZOU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720436218; c=relaxed/simple; bh=vnzHPyqhh9uqjyMMGYHiAx4MW+nRasQ0HWpUhG1eEsc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dnAIu9K4+WuX8TDwJ3iN0QlUlZprly3uxoDhXIQjZogmgK/M+z6SfakbiRWiS/8U0S5mvn5Z+dc6nm3w/ZPvKzXg8kbtHm/hThlGi7Alb/s7O0EiMexGEA4kGLKkxcBU/bXrKK9NmOGsonyo6C33BzMiE/kBVb3iC/Nv5ickANY= 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=180.149.134.32 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.64.123]) by sina.com (10.185.250.21) with ESMTP id 668BC5E70000702C; Mon, 8 Jul 2024 18:56:41 +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: 6985133408355 X-SMAIL-UIID: 2A7656D9FD7C49829FA8CEF8239B8943-20240708-185641-1 From: Hillf Danton To: Florian Westphal Cc: Tejun Heo , netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com, syzbot+4fd66a69358fc15ae2ad@syzkaller.appspotmail.com Subject: Re: [PATCH nf] netfilter: nf_tables: unconditionally flush pending work before notifier Date: Mon, 8 Jul 2024 18:56:31 +0800 Message-Id: <20240708105631.841-1-hdanton@sina.com> In-Reply-To: <20240707080824.GA29318@breakpoint.cc> References: 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 Sun, 7 Jul 2024 10:08:24 +0200 Florian Westphal > Hillf Danton wrote: > > > I think this change might be useful as it also documents > > > this requirement. > > > > Yes it is boy and the current reproducer triggered another warning [1,2]. > > > > [1] https://lore.kernel.org/lkml/20240706231332.3261-1-hdanton@sina.com/ > > The WARN is incorrect. The destroy list can be non-empty; i already > tried to explain why. > That warning as-is could be false positive but it could be triggered with a single netns. cpu1 cpu2 cpu3 --- --- --- nf_tables_trans_destroy_work() spin_lock(&nf_tables_destroy_list_lock); // 1) clear the destroy list list_splice_init(&nf_tables_destroy_list, &head); spin_unlock(&nf_tables_destroy_list_lock); nf_tables_commit_release() spin_lock(&nf_tables_destroy_list_lock); // 2) refill the destroy list list_splice_tail_init(&nft_net->commit_list, &nf_tables_destroy_list); spin_unlock(&nf_tables_destroy_list_lock); schedule_work(&trans_destroy_work); mutex_unlock(&nft_net->commit_mutex); nft_rcv_nl_event() mutex_lock(&nft_net->commit_mutex); flush_work(&trans_destroy_work); start_flush_work() insert_wq_barrier() /* * If @target is currently being executed, schedule the * barrier to the worker; otherwise, put it after @target. */ // 3) flush work ends with the refilled destroy list left intact tear tables down