From patchwork Wed Jan 31 13:28:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Adam Davis X-Patchwork-Id: 194744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1889996dyb; Wed, 31 Jan 2024 05:34:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzG6rwls7OU31UF6+4I4lumyL5T7xotn5IXK/v3ckA3axn6rVdKl/DjTBQRS/T8wwss6op X-Received: by 2002:a05:6214:2468:b0:68c:668b:c610 with SMTP id im8-20020a056214246800b0068c668bc610mr1914921qvb.2.1706708093674; Wed, 31 Jan 2024 05:34:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706708093; cv=pass; d=google.com; s=arc-20160816; b=1Hv8xW6rczEDlCYwbjaLF+mJ7EC/Cz9FlLeikx0owEJbwAJ6Rzl5Xg0KCYp5gQH/8n ggpuHA8aGmyiI/26FAga5LYtZD0UiXBlLJ1iTqlZ+O2d/n8rv/C3qTuGknPnGagKCvF/ 29lKgswwmsgKPGDAMaW0xdgM7Px/FYEBR7bDOWtRBdf3pDltuHsUBEWwWxvIJNU3kxi9 hdX8aX1tut7kG4zpBs8au9Vzcjxa+M69zJ7TNiZUTDC8RT6uR+3Hf/2FI3u5TGZ1LUgh lQUbFX31c5+DrB4JjlWc81cdC2F+kJWQ7acSt1sIcCqbB6LtvziN0lKhtPxVPNk3Wu/T bhtQ== 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:date :subject:cc:to:from:message-id:dkim-signature; bh=3LvlDGqVp2dR5tHsbeJj41RdmcLcttRB0AeyEWvvGzI=; fh=D0yAQuivrL8dQf2MyQyTWvgZ98uG9HI57zNpHDghVWQ=; b=vA9wRPSSoMIMRXO/CImNEcmEPMRlWrImKFZMJEjh+F3zAt6fU6OzTjvejFgLO0zBNU Bcfv9OlH/hWTB1HgBfm/t3YMtB98MWRDN7N9whSWtqBt+LbG1Wp161lf4bNYdmfkzFD4 T0Wfxn5gS4KY9pdRtqa/XqNck9xoW54KY7QFL5dM80nCqAM23CzfNB7w+QP6tp+IrDMw V210fjxjCAv3RIBkPbwbllUMJTPVhrvDCCZT1iLBQGxqLE1caGDJJD5n9jL69ItMe4IX lhQTaTlvxn94bl4tVX4C1HSlwLLG52dMfPjcCrJ+A/0mdr79CKn2B2zt2idL5DAHSwPk iCAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=i2aCGLJz; arc=pass (i=1 spf=pass spfdomain=qq.com dkim=pass dkdomain=qq.com dmarc=pass fromdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-46504-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46504-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qq.com X-Forwarded-Encrypted: i=1; AJvYcCV4zltKrG6+EmX19481L4S07ZUhth5qJHzPjJUT6oKPhmCA65tOzCUm4iyCXhWDZz0nCpI2IOHeQ3XVFTtge27DpNuKGQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a6-20020ad45c46000000b0068c450c90a8si9110889qva.306.2024.01.31.05.34.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 05:34:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46504-ouuuleilei=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; dkim=pass header.i=@qq.com header.s=s201512 header.b=i2aCGLJz; arc=pass (i=1 spf=pass spfdomain=qq.com dkim=pass dkdomain=qq.com dmarc=pass fromdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-46504-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46504-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qq.com 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 71CE61C23538 for ; Wed, 31 Jan 2024 13:34:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 459337E56C; Wed, 31 Jan 2024 13:34:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="i2aCGLJz" Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com [162.62.57.210]) (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 C61C77BB10; Wed, 31 Jan 2024 13:34:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.62.57.210 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706708075; cv=none; b=TMSTKXnJCR9Myxf9VuP6EPzT+b+Xi3TDz8LfPEnL56D8oV+LrvdPrWyxEHgk5g97HsnoN8tdHfD4M+r1PJqcfzKkGLZ2xY5RetctGKJ2iv6FoCcbbh0KTtdtrfbgRsp39Zkrsz9+3WGTBpX4B421WS8a2VK8M9h4AiL5uXsJg9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706708075; c=relaxed/simple; bh=ipB51S4ayXjPdAjDFJrXZRnPCOCc58tiHGNoK3XtmJo=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=QM5aDUBUji2q/WsGOzqON4pEt/knbxk/e0txPJx83/MZHTBmdLBoLVcL1jltbwXU9NkRrvPYYLNlIk720gpqYP4XZO6ylx4WSiN85m3UAvTRJ0KRRnwNYRfhWgYfLQ45Yv9UP+4iLmYtjBKx4QPSZV0F2TKjlNbifGFjAGgLtso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com; spf=pass smtp.mailfrom=qq.com; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=i2aCGLJz; arc=none smtp.client-ip=162.62.57.210 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qq.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1706707765; bh=3LvlDGqVp2dR5tHsbeJj41RdmcLcttRB0AeyEWvvGzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=i2aCGLJzWyXKRhu4uyL11CKjUakJspzaoyW0rKL4NkUI3m+lwIXdqNTAw2IQeXbGV 6CXEmfuk3SwD0zVJ3cHMfw3lXaCOFIDjH2aHxIEG1oNxjqNXrTKPVIz7M9ijMscHc3 i2RoBStwbjpB8z/B5G2RB8r37bVSGphEFbVWhxJU= Received: from pek-lxu-l1.wrs.com ([111.198.225.215]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id 7039203E; Wed, 31 Jan 2024 21:28:03 +0800 X-QQ-mid: xmsmtpt1706707683t170w99ch Message-ID: X-QQ-XMAILINFO: OW4JKxETGMY27nXxRGBgayPGLZPP931PdTQSzQ1zill1Akyt95iEkXs+ChWv2F n/HpM4S8NTgrbmkEw81HUfzwMbV3QyRN88d61pS4hhgxXYxwlki1m+FCzR/7uohYdAL3e+rcAwpu XjWW0mLSZNmhdhZJlcWWRrYPEbmwGncPjqt3ccGAQ4VOUtCrlq+J/v7Wka+kTtFwQyzDHPFOmrpn 86/yyJ0tMqEeIzoOzCfks+VOzYC+amIaujQAY/SsL6N1lb/uso+i4LenVzJGACPj68Q0e04IbUKG pMx2ZQnCPv9QulEQnstzSmUBouq+B/gj7u/lA9XbV+ThgFkVC5HdfcRFjgY/hFPpHINMY1pDKeVv FyqT9TTPYe0knHqoWuIjp63PtOfKcgfKUiEZJty311vKqCW+GiYihART3eEU3bUTpeV+FfK5T1yi SlSICnN+aWkrVyXDmzY/tlHLwn9X2oLt9uOTjGEpHz1s4vqwfYoL+/9ymeNPkgOzOQ21nFQgf3ia ZpsbGGvWpSAIIFXsoAMZgU6ft5LcAcJ5iX9xxnLrIA2HtppDlvi5bvzliJT/Ne1tjJj3aPwmDB/+ DQtHj45SSkTMbatqpOCv0xgEkOLdv5CR6z7KTdb+kmSk7TpYzeRhXXUscJpUdqVab7dH7eQ2QGJ/ PPez3v1z80UgHA5G1uDZ3PMbC2x9D4TDj/SoZpvL+6M+PD7Q/a1mSGUhwHq8cosBN3p1VH8iTc19 25O3CKulz7AqwjvIcE016grLq0/rkcqYrfqVXmsNx6ayaViMr2mQmCYKka14DiyMUh1pjtKHG3PA EdN6VQD4UZG3iAps4umrYFljISA9iW+UprIl84wat4JXoWLxCQYb9y2TLEwyVN4CE13n2U/XcQ38 2QoeA4gBLg2jmII106Xi58Eo3WKzS7jVbq1NXfWwYULy/KZ+b+HkpUyy/fUf3HRn0oitvlfbF3YH ReEJKvVRI= X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: Edward Adam Davis To: syzbot+2373f6be3e6de4f92562@syzkaller.appspotmail.com Cc: akpm@linux-foundation.org, axboe@kernel.dk, dvyukov@google.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, mhiramat@kernel.org, pengfei.xu@intel.com, rostedt@goodmis.org, syzkaller-bugs@googlegroups.com Subject: [PATCH] trace/blktrace: fix task hung in blk_trace_remove Date: Wed, 31 Jan 2024 21:28:04 +0800 X-OQ-MSGID: <20240131132803.1350049-2-eadavis@qq.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <0000000000002b1fc7060fca3adf@google.com> References: <0000000000002b1fc7060fca3adf@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789613145801902803 X-GMAIL-MSGID: 1789613145801902803 Delete critical sections that are time-consuming and protected by other mutexes to avoid this issue. Reported-and-tested-by: syzbot+2373f6be3e6de4f92562@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis --- kernel/trace/blktrace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index d5d94510afd3..4543be718362 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -313,6 +313,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, static void blk_trace_free(struct request_queue *q, struct blk_trace *bt) { + mutex_unlock(&q->debugfs_mutex); relay_close(bt->rchan); /* @@ -325,6 +326,7 @@ static void blk_trace_free(struct request_queue *q, struct blk_trace *bt) } else { debugfs_remove(bt->dir); } + mutex_lock(&q->debugfs_mutex); free_percpu(bt->sequence); free_percpu(bt->msg_data); kfree(bt);