From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-163.sinamail.sina.com.cn (mail3-163.sinamail.sina.com.cn [202.108.3.163]) (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 75E992C029F for ; Sat, 11 Apr 2026 03:13:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.108.3.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775877207; cv=none; b=J53fLMRToQ9fseAM4siYM0DK3Us8ipkFUiMYdghAwgq9XVRIUAMbQbkBxdPIACs6KIG1u3ZcQA54dCtUIpsemA0QFgQ4k+UKbN/4sZdSEHjhI6MjiE58NykBBx1ZWw/fChK5tZ4j5lAHHAYvqeCL2QNpt7BF9jnM4JesKdW4cWI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775877207; c=relaxed/simple; bh=6dYoLXnjr9R6725eFoj08p5DBnkiSDOE/HzsYBRhEtY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eRtFqLDx2GTqKHRyezzQ1tkdL9yxdqgl6ovh1AXZc11LEilIBI721YLHfbiJ5ytBd3hTXpcMsbXhoi5OlGYxwg3jO/RyQgU560kpHQapHQIEwdP2e7YRnlHvY+5Uesq8il595T2wKodQuECIKUtrBCMNqQFExVq2Jae6+h9mXfE= 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=IcAnhldJ; arc=none smtp.client-ip=202.108.3.163 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="IcAnhldJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sina.com; s=201208; t=1775877203; bh=Jl7RKU2B0II8KL40MJwxpHQqJWUYeU10TaXS1YY2lJI=; h=From:Subject:Date:Message-ID; b=IcAnhldJthaTAXKDqzzQQpyjmdEz+UYs4SUvh1A6yDiWvxdF9FHmRqPantkMWJgCW 13hzOToV9yaORclEB6pY/rK/CEJJKzlHeZzaaODRWfoZUoUqNsVZ673VqZyyUjZa/9 opLOTr+PjFkF0dnb0aXzG9eZMU+c1s5OplsgQJLg= X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([114.249.62.144]) by sina.com (10.54.253.34) with ESMTP id 69D9BBBE0000346B; Sat, 11 Apr 2026 11:10: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: 3226996291922 X-SMAIL-UIID: D4C11D1899F64CEBBD68E39143181B5B-20260411-111056-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [cgroups?] KASAN: slab-use-after-free Read in pressure_write Date: Sat, 11 Apr 2026 11:10:43 +0800 Message-ID: <20260411031045.1713-1-hdanton@sina.com> In-Reply-To: <69d779b0.a00a0220.468cb.0018.GAE@google.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 > Date: Thu, 09 Apr 2026 03:04:32 -0700 [thread overview] > Hello, > > syzbot found the following issue on: > > HEAD commit: 591cd656a1bf Linux 7.0-rc7 > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=114a36ba580000 > kernel config: https://syzkaller.appspot.com/x/.config?x=45cb3c58fd963c27 > dashboard link: https://syzkaller.appspot.com/bug?extid=33e571025d88efd1312c > compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8 > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16cb33da580000 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12648bd6580000 #syz test --- x/fs/kernfs/file.c +++ y/fs/kernfs/file.c @@ -298,6 +298,7 @@ static ssize_t kernfs_fop_read_iter(stru return kernfs_file_read_iter(iocb, iter); } +static DEFINE_MUTEX(drain_mutex); /* * Copy data in from userland and pass it to the matching kernfs write * operation. @@ -322,13 +323,17 @@ static ssize_t kernfs_fop_write_iter(str len = min_t(size_t, len, PAGE_SIZE); } + if (!mutex_trylock(&drain_mutex)) + return -EINVAL; buf = of->prealloc_buf; if (buf) mutex_lock(&of->prealloc_mutex); else buf = kmalloc(len + 1, GFP_KERNEL); - if (!buf) + if (!buf) { + mutex_unlock(&drain_mutex); return -ENOMEM; + } if (copy_from_iter(buf, len, iter) != len) { len = -EFAULT; @@ -364,6 +369,7 @@ out_free: mutex_unlock(&of->prealloc_mutex); else kfree(buf); + mutex_unlock(&drain_mutex); return len; } @@ -814,10 +820,12 @@ void kernfs_drain_open_files(struct kern struct kernfs_open_file *of; struct mutex *mutex; + mutex_lock(&drain_mutex); mutex = kernfs_open_file_mutex_lock(kn); on = kernfs_deref_open_node_locked(kn); if (!on) { mutex_unlock(mutex); + mutex_unlock(&drain_mutex); return; } @@ -836,6 +844,7 @@ void kernfs_drain_open_files(struct kern WARN_ON_ONCE(on->nr_mmapped || on->nr_to_release); mutex_unlock(mutex); + mutex_unlock(&drain_mutex); } /* --