From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail115-100.sinamail.sina.com.cn (mail115-100.sinamail.sina.com.cn [218.30.115.100]) (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 29F3D5A0FE for ; Wed, 3 Jul 2024 10:36:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720002970; cv=none; b=GwN16W85YhzPTW6Sc1wnIlQaSmJMsXsZiEY9aPYFD4mpbtvzCF85QBsDwWcXywhvFlAWrofQiHWjpQfc4QIZ6lAuzENWrB8ZNZeM8H2jjDXJ9yDaa2VNyxpykNEzkAAbhAC+aZ8ToLqoRehgrv4bxyiESc/UZqomBHUAbb5950I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720002970; c=relaxed/simple; bh=Oj2XBv/HMF5uB8m1GDKSCwlLjhQ8YPZdw9ShmXnxVMg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uZXJCEdqZ9n/6sdK5rT1XixzffDT4HNZ9UA0qCzUvYD2c44V2FYuyF8YGk0b0B1MfvsnpGS1phJWJuVEla7lvd9kT/p3znJ5s4cCAsKNFz4MC+r0pYPdqMWokvROt7nw8ABE+2FfQKj75Pl/v8Y8QDzE1xqVO0TUYmlfOlkXWF8= 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.100 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.67]) by sina.com (10.185.250.23) with ESMTP id 6685298A00004CBD; Wed, 3 Jul 2024 18:35:56 +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: 9998688913377 X-SMAIL-UIID: 64AC182C870D4FF98CF825E46BB7D733-20240703-183556-1 From: Hillf Danton To: Florian Westphal Cc: 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: Wed, 3 Jul 2024 18:35:44 +0800 Message-Id: <20240703103544.2872-1-hdanton@sina.com> In-Reply-To: <20240702140841.3337-1-fw@strlen.de> 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 Tue, 2 Jul 2024 16:08:14 +0200 Florian Westphal > syzbot reports: > > KASAN: slab-uaf in nft_ctx_update include/net/netfilter/nf_tables.h:1831 > KASAN: slab-uaf in nft_commit_release net/netfilter/nf_tables_api.c:9530 > KASAN: slab-uaf int nf_tables_trans_destroy_work+0x152b/0x1750 net/netfilter/nf_tables_api.c:9597 > Read of size 2 at addr ffff88802b0051c4 by task kworker/1:1/45 > [..] > Workqueue: events nf_tables_trans_destroy_work > Call Trace: > nft_ctx_update include/net/netfilter/nf_tables.h:1831 [inline] > nft_commit_release net/netfilter/nf_tables_api.c:9530 [inline] > nf_tables_trans_destroy_work+0x152b/0x1750 net/netfilter/nf_tables_api.c:9597 > > Problem is that the notifier does a conditional flush, but its possible > that the table-to-be-removed is still referenced by transactions being > processed by the worker, so we need to flush unconditionally. > Given trans->table goes thru the lifespan of trans, your proposal is a bandaid if trans outlives table.