Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7627476rdb; Thu, 4 Jan 2024 02:35:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFd0iUn2+s7ZrwmkRLUfjJ2DMzdlsxy/UtVXbfmU3NteGZFOU2Eno5RmdYWw0AGOZiPgwha X-Received: by 2002:a05:6402:1212:b0:554:7034:e0f8 with SMTP id c18-20020a056402121200b005547034e0f8mr226925edw.81.1704364517840; Thu, 04 Jan 2024 02:35:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704364517; cv=none; d=google.com; s=arc-20160816; b=nt4oON4N6rJH3jZCDVxeqcPqldhMJbmEySBL4ZXhErC0CtBh9FUnKF0V9NfQDxbtl9 RUaBn6UaAWHjJJIp6Rh3nPfHEbzkWEJbDrnbb+yY4bqboieMNtU+phSKVQBghwaEyY/a kfnH/KjTAprqFhnzRkjtRtnESpRl8OLco/V8MGYakvRLUVJmtwnIJwYJQ94H9V4gAiAj +bKtJfLsgy9Ou7EPFuXkhoXqlAgJOBn67SdcN0LHlUBKP9Yffua+MIFvvN5nYA4iLDPR evzN8m/GacwRM1Zav3NN0PalvqGlWHx+nAV5pYFDT6WvnLDkg3DBQx6qE4LjAdd6gIFf bZuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=4v4yc3lq5BE4I4Msxd5v3lAJTWlmQogQhDDqOIK+fr0=; fh=1IqgggDvQ+SYloNXnPJklJdsUv3sqpNeG601gcASrA0=; b=Zdmpu47GEveaNx45dmmZo4doN4fgMI6zNXSoXrOQZLVQPsZBEEvxxloxPgzFbpquNk SauMOzDpyfXrlzOYeSMQvtv8SLrzw+NJwbdGiVr+xJwk2L4ADTNUlCimi1vbQcx89d57 s1joyOcZ4WOR7Jd8bui7fPDL4W5vqPSM5mtV38CcylOz8al0mJBRheU+wCLyKZKoNYx6 /9d4snVf3aH8IVmCcB7hAat0+BcxozWt1D3nasVUFMxUZzu9V5goc5EMQXNv8sZ0SWRl dXrIVaWLJ5GDwfTdasRQa7JYuM6JdS0vW0QAtiDzMaaMZ5npe0bp3SuMrlWVib1zSspC H29w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16510-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16510-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v17-20020a056402175100b00553dfe023d6si12972586edx.475.2024.01.04.02.35.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 02:35:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16510-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16510-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16510-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 941741F2518E for ; Thu, 4 Jan 2024 10:35:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56E5520DDC; Thu, 4 Jan 2024 10:35:10 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) (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 4583320DCE for ; Thu, 4 Jan 2024 10:35:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=I-love.SAKURA.ne.jp Received: from fsav313.sakura.ne.jp (fsav313.sakura.ne.jp [153.120.85.144]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 404AYx8J050578; Thu, 4 Jan 2024 19:34:59 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav313.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav313.sakura.ne.jp); Thu, 04 Jan 2024 19:34:59 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav313.sakura.ne.jp) Received: from [192.168.1.6] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 404AYxCk050573 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Thu, 4 Jan 2024 19:34:59 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: Date: Thu, 4 Jan 2024 19:34:59 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [syzbot] [net?] [nfc?] INFO: task hung in nfc_targets_found Content-Language: en-US To: Hillf Danton , syzbot , Alan Stern , Greg KH Cc: krzysztof.kozlowski@linaro.org, Linus Torvalds , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com References: <00000000000026100c060e143e5a@google.com> <20240104050501.2766-1-hdanton@sina.com> From: Tetsuo Handa In-Reply-To: <20240104050501.2766-1-hdanton@sina.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2024/01/04 14:05, Hillf Danton wrote: > On Wed, 03 Jan 2024 16:59:25 -0800 >> HEAD commit: 453f5db0619e Merge tag 'trace-v6.7-rc7' of git://git.kerne.. >> git tree: upstream >> console output: https://syzkaller.appspot.com/x/log.txt?x=141bc48de80000 >> kernel config: https://syzkaller.appspot.com/x/.config?x=f8e72bae38c079e4 >> dashboard link: https://syzkaller.appspot.com/bug?extid=2b131f51bb4af224ab40 >> compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 >> > > syz-executor.1:27827 kworker/u4:93/7607 kworker/0:1/11541 > === === === > nci_close_device() nci_rx_work() nfc_urelease_event_work() > mutex_lock(&ndev->req_lock) device_lock() > flush_workqueue(ndev->rx_wq) mutex_lock(&ndev->req_lock) > device_lock() > > Looks like lockdep failed to detect deadlock once more because of device_lock(). Yes, this is yet another circular locking dependency hidden by device_lock(). Calling flush_workqueue(ndev->rx_wq) with ndev->req_lock has to be avoided, for nci_close_device() has ndev->req_lock => dev->dev dependency and nfc_urelease_event_work() has dev->dev => ndev->req_lock dependency. nci_close_device() { mutex_lock(&ndev->req_lock); // ffff88802bed4350 flush_workqueue(ndev->rx_wq); // wait for nci_rx_work() to complete mutex_unlock(&ndev->req_lock); // ffff88802bed4350 } nci_rx_work() { // ndev->rx_work is on ndev->rx_wq nci_ntf_packet() { device_lock(&dev->dev); // ffff88802bed5100 device_unlock(&dev->dev); // ffff88802bed5100 } } nfc_urelease_event_work() { mutex_lock(&nfc_devlist_mutex); // ffffffff8ee4d808 mutex_lock(&dev->genl_data.genl_data_mutex); // ffff88802bed5508 nfc_stop_poll() { device_lock(&dev->dev); // ffff88802bed5100 nci_stop_poll() { nci_request() { mutex_lock(&ndev->req_lock); // ffff88802bed4350 mutex_unlock(&ndev->req_lock); // ffff88802bed4350 } } device_unlock(&dev->dev); // ffff88802bed5100 } mutex_unlock(&dev->genl_data.genl_data_mutex); // ffff88802bed5508 mutex_unlock(&nfc_devlist_mutex); // ffffffff8ee4d808 } I consider that we need to enable lockdep validation on dev->dev mutex ( https://lkml.kernel.org/r/c7fb01a9-3e12-77ed-5c4c-db7deb64dc73@I-love.SAKURA.ne.jp ) but was some alternative to my proposal at https://lkml.kernel.org/r/1ad499bb-0c53-7529-ff00-e4328823f6fa@I-love.SAKURA.ne.jp proposed? Is it time to retry my proposal?