Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965099AbeALSaY (ORCPT + 1 other); Fri, 12 Jan 2018 13:30:24 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:34810 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964867AbeALSaW (ORCPT ); Fri, 12 Jan 2018 13:30:22 -0500 Date: Fri, 12 Jan 2018 13:30:46 -0500 From: Sowmini Varadhan To: syzbot Cc: davem@davemloft.net, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, rds-devel@oss.oracle.com, santosh.shilimkar@oracle.com, syzkaller-bugs@googlegroups.com Subject: Re: KASAN: use-after-free Read in rds_tcp_tune Message-ID: <20180112183046.GA26098@oracle.com> References: <001a1141a524c513ca05628d8ad4@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001a1141a524c513ca05628d8ad4@google.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8772 signatures=668652 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=465 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801120250 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On (01/11/18 21:29), syzbot wrote: > ================================================================== > BUG: KASAN: use-after-free in rds_tcp_tune+0x491/0x520 net/rds/tcp.c:397 > Read of size 4 at addr ffff8801cd5f6c58 by task kworker/u4:4/4954 Just had an offline discussion with santosh around this, here's a summary of that discussion for the archives: Looks like an rds_connect_worker workq got scheduled after the netns was deleted. This could happen if an an rds_connection got added between lines 528 and 529 of 506 static void rds_tcp_kill_sock(struct net *net) : /* code to pull out all the rds_connections that should be destroyed */ : 528 spin_unlock_irq(&rds_tcp_conn_lock); 529 list_for_each_entry_safe(tc, _tc, &tmp_list, t_tcp_node) 530 rds_conn_destroy(tc->t_cpath->cp_conn); Such an rds_connection would miss out the rds_conn_destroy() loop (that cancels all pending work) and (if it was scheduled after netns deletion) could trigger the use-after-free. Evaluating various fixes for this (including using _bh instead of _irq as suggested by santosh), I'll get back with a patch soon. --Sowmini