From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from r3-20.sinamail.sina.com.cn (r3-20.sinamail.sina.com.cn [202.108.3.20]) (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 0ACD63F4132 for ; Thu, 14 May 2026 02:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.108.3.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778726605; cv=none; b=XIUptn0jRELK5VoCtHZyXOzom938hYsITKooq9U58y4QpVUBzsZjbI94Aau/nOMQSa5mQh/nFl66Nx/p7eE1pLTbqpBRwmvJoxqKvTOtsfgk4sAgv64YI7oaVg4g6Y1RL3PFVHXa2vnNi2h1dKylXlwUNiNpi/oNx8soyoB7BJo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778726605; c=relaxed/simple; bh=y+aAs+gYEaR9Jb25GDkR4GobujYSuYNOI/l3USZJVG4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nyi/l0F1Xn9sc48VB2wWVJ7APSnI/bBtC6mGs7wuPaR53upjsZ0ClogarpbxmdksV4nsWaCS57gD4bhBSIz3pKELWZkX9G1Fi8bXSP6RUeO57Gr8iNOZufvhg1Oc2FmzOoRoNSvjc9yNZtEZekg1JE2L2tn+3VPKrhdScdGxz3c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b=SYgo0h/Q; arc=none smtp.client-ip=202.108.3.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b="SYgo0h/Q" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sina.com; s=201208; t=1778726601; bh=obws9dDHdh1Ev4pToV+dow1CQlh2IwjhnDC8RgrXid0=; h=From:Subject:Date:Message-ID; b=SYgo0h/QqVw57gL4mxwMneZnjf7D8+t3ddKxS1JjwTbTrvkB4WxKzplgB7T1iwrav iMPy059kHjUc2CuSjy8p8TmKGqQvnrUa60hytsDc7kWR9ud3fYHWEpzi6+F8y5hu7Q XW80fXBtvuTQllEwYI6vAu7+yslE3YXRLqlspTXg= X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([114.249.62.144]) by sina.com (10.54.253.32) with ESMTP id 6A05369E000014A6; Thu, 14 May 2026 10:42:39 +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: 8128234456870 X-SMAIL-UIID: F00896C0358C4ED1A95DA11357443C92-20260514-104239-1 From: Hillf Danton To: Kartik Nair Cc: mhocko@suse.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, syzbot+bd6aaf99e8443d8a9034@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH] mm/hugetlb: fix deadlock in __hugetlb_zap_begin() by using trylock Date: Thu, 14 May 2026 10:42:41 +0800 Message-ID: <20260514024242.658-1-hdanton@sina.com> In-Reply-To: <20260513211927.4206-1-contact.kartikn@gmail.com> 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 Thu, 14 May 2026 02:49:27 +0530 Kartik Nair wrote: > syzbot reported a circular locking dependency involving > resv_map->rw_sema and mmap_lock: > > CPU0 CPU1 > lock(&mm->mmap_lock) > lock(sk_lock-AF_INET6) > lock(&mm->mmap_lock) > lock(&resv_map->rw_sema) > > __hugetlb_zap_begin() calls hugetlb_vma_lock_write() which does a > blocking down_write() on either vma_lock->rw_sema or > resv_map->rw_sema while mmap_lock is already held for write by the > caller chain (vm_mmap_pgoff -> mmap_region -> __mmap_region -> > unmap_region -> unmap_vmas -> hugetlb_zap_begin). > > Fix this by converting __hugetlb_zap_begin() to use > hugetlb_vma_trylock_write() instead of hugetlb_vma_lock_write(). > If the trylock fails, return false to the callers so they can skip > the zap operation safely. Update hugetlb_zap_begin() and its callers > in unmap_vmas() and zap_vma_range_batched() accordingly. > Given q->q_usage_counter in the syzbot report [1] and the correct locking order in ffa1e7ada456 ("block: Make request_queue lockdep splats show up earlier"), I suspect change to hugetlb is needed. [1] https://lore.kernel.org/lkml/6a02edcf.170a0220.7f9b3.000c.GAE@google.com/