Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp399646lqo; Fri, 10 May 2024 03:27:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUyC5u+mi0PUMZI36+SFdETLCZJ9NaybtmG0B1WkHDb+ATAfv5rl7D3XCaIqj/0aZGl7jDEt6qkmL4xYcW7JJUjfyBu3NtlrVw6wEe/Gg== X-Google-Smtp-Source: AGHT+IHAnvDsE6GQpOyyATbzsPGG0L/mBsA27aptaesLmp/1sDuW2EWKPpnFx9gZYoZOLY/pXMEW X-Received: by 2002:a05:6214:5249:b0:6a0:b461:ba6 with SMTP id 6a1803df08f44-6a16814413amr23141686d6.8.1715336878784; Fri, 10 May 2024 03:27:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715336878; cv=pass; d=google.com; s=arc-20160816; b=i1DUlkOix9IHglgMlOevkEK4n18CVfNJTz8cOqkNCd3J3IcxjWLoGcqXA7UuIsZWOV 2rjhqgPvMBj1q0qb/aKmdxkgAJDMzRmzMsYJ9EsFavH1kUfCcwUvm3kyr7mmwJ1onG8e wWNAAmhPKOeVrMKMsH6HCXnNUau2x6pmEq1vxJ5+79kv22mJc7EnzoVhMvFcmNTGQpg/ LSUJzeFpfBKjAdcZDI3HINwiv9q/VEuwCGpfqqmyCLQ1OqWOgmF83mkD0/YjvViGkoAS pDCq+eUUKTETyl2QhEOKpK+ZiHCst73iqeA6usn6unNtsqzRPj6UfiB5AxkFBBZ+Zs3+ np3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=/ic7lJmwOx8VkQje/Hjp9ChbQzsC3PXkCylEiNOO9V0=; fh=25VHQvp0hYZ/clmMFApfV9BeSWJ5citR9I/CJWTj4eI=; b=PNN37LAfq9OAuavwwwYt2q6/0/nro0zC5E+Ohd3kskR3Q9rJIqpjOG2RpBSk2DA7Fd 7hN5cFDyFL84AAJUDnYFupXRiaqpTyx1UACpRVearGUe3ppfv06nO3MJPT+eclf+GkIy JP3xmpJB9co+J8R45I+hrv8sBd4Pq2zUdIshZG5WpCSACiug2sR9zIkGvAPqp7aauzW9 a4Xau5PewxnK/RrwwMv0ATvAB7ywGE5SOsESNbvfaoPIOtV8hjRWq3WV6CYgIiSi2APb NEunQ8paxqCH4KoWT5pMWbKii6tVnJLhZEQhMeAuC3FSREsfj4bhTK8MfXM21WRQcLh0 /dOQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-175592-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175592-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f29a8efsi34128586d6.240.2024.05.10.03.27.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 03:27:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175592-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-175592-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175592-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9EEBC1C2206C for ; Fri, 10 May 2024 10:27:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFAB2168B1D; Fri, 10 May 2024 10:27:03 +0000 (UTC) Received: from mail115-24.sinamail.sina.com.cn (mail115-24.sinamail.sina.com.cn [218.30.115.24]) (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 7D9E716ABC3 for ; Fri, 10 May 2024 10:26:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.24 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715336823; cv=none; b=tJBlAiQS/1mU0W3h+nbtv7YvpasRkdnpsxQ8XcUVX0eJUE+AJTAMM4LavgIAXrM6VE0BALXZ3GaI27EYMrDh1Hw+4P7Lapa/tbXYauHXJpPO+l0ftfjBloN/l5pbThLg9V0rKBpwZ91l1425Fv/BYlRVLjPRLzvtqgdnexfg85A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715336823; c=relaxed/simple; bh=SK1hbF8oGwwr9prxmgVVid73ld0NBEnOT0NNuwRaY54=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Wq3EpPxcK0MI6mUlwz0dvZulny/GM+6oUlP+Ui8hMUCAECyDB6ey+is3lerZA2jeAYcauNrnzzUD203fNQa+ZAq0cyOdyqJLgcDAXt16S5DwDNe/92TF+jYCuKONB8R8CS734fFcM/0Nh/6VVtEozZOguk1HcxlCeNh7sOG5BGI= 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.24 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)([116.24.9.62]) by sina.com (10.75.12.45) with ESMTP id 663DF66D00000F1E; Fri, 10 May 2024 18:26:55 +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: 67980831457973 X-SMAIL-UIID: 53FE2955DF384184B1D9B79BACEF9E5C-20240510-182655-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [kernfs?] possible deadlock in kernfs_seq_start Date: Fri, 10 May 2024 18:26:43 +0800 Message-Id: <20240510102643.2517-1-hdanton@sina.com> In-Reply-To: <00000000000091228c0617eaae32@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 On Tue, 07 May 2024 22:36:18 -0700 > syzbot has found a reproducer for the following issue on: > > HEAD commit: dccb07f2914c Merge tag 'for-6.9-rc7-tag' of git://git.kern.. > git tree: upstream > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1367a504980000 #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dccb07f2914c --- l/fs/overlayfs/dir.c +++ d/fs/overlayfs/dir.c @@ -654,10 +654,44 @@ out: return err; } +static int __ovl_create_object(struct dentry *dentry, int mode, dev_t rdev, const char *link) +{ + int err; + struct inode *inode; + struct ovl_cattr attr = { + .rdev = rdev, + .link = link, + }; + + err = ovl_copy_up(dentry->d_parent); + if (err) + return err; + + /* Preallocate inode to be used by ovl_get_inode() */ + err = -ENOMEM; + inode = ovl_new_inode(dentry->d_sb, mode, rdev); + if (!inode) + return err; + + spin_lock(&inode->i_lock); + inode->i_state |= I_CREATING; + spin_unlock(&inode->i_lock); + + inode_init_owner(&nop_mnt_idmap, inode, dentry->d_parent->d_inode, mode); + attr.mode = inode->i_mode; + + err = ovl_create_or_link(dentry, inode, &attr, false); + /* Did we end up using the preallocated inode? */ + if (inode != d_inode(dentry)) + iput(inode); + + return err; +} + static int ovl_create(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) { - return ovl_create_object(dentry, (mode & 07777) | S_IFREG, 0, NULL); + return __ovl_create_object(dentry, (mode & 07777) | S_IFREG, 0, NULL); } static int ovl_mkdir(struct mnt_idmap *idmap, struct inode *dir, --