From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6357BC43334 for ; Mon, 4 Jul 2022 11:01:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233838AbiGDLBV (ORCPT ); Mon, 4 Jul 2022 07:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233132AbiGDLBU (ORCPT ); Mon, 4 Jul 2022 07:01:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65EBEDD0 for ; Mon, 4 Jul 2022 04:01:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2CDE6B80E42 for ; Mon, 4 Jul 2022 11:01:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A0F0C3411E; Mon, 4 Jul 2022 11:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656932477; bh=IHt85bKJbsXTs0dIvZOMIwOWJA58+2HcncvJ3PCfzTM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cLl0yM2IPlS6RosBDJtApiuapm+3NoxAad4R1eZZ5IKNt4COrJtyOnMjBHJo3dBUD GfFadG7Cq2MtR8qUqyOtxk78e7fFE52S6CsCGWNcMu3Z7qdHfD4BNgHyrAM8eA4eQK n22j3XT/ZTBSoBDbGhIM0ZszADLy8/YJ7YSNH84s= Date: Mon, 4 Jul 2022 13:01:14 +0200 From: Greg KH To: Tetsuo Handa Cc: arnd@arndb.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH] char: misc: make misc_open() and misc_register() killable Message-ID: References: <000000000000d9ff3a05bb37069e@google.com> <72e74af9-f1b6-e383-a2c3-6ee8a0aea5e0@I-love.SAKURA.ne.jp> <100f445e-9fa8-4f37-76aa-8359f0008c59@I-love.SAKURA.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <100f445e-9fa8-4f37-76aa-8359f0008c59@I-love.SAKURA.ne.jp> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 04, 2022 at 07:25:44PM +0900, Tetsuo Handa wrote: > On 2022/07/04 16:29, Greg KH wrote: > > On Mon, Jul 04, 2022 at 03:44:07PM +0900, Tetsuo Handa wrote: > >> syzbot is reporting hung task at misc_open() [1], for snapshot_open() from > >> misc_open() might sleep for long with misc_mtx held whereas userspace can > >> flood with concurrent misc_open() requests. Mitigate this problem by making > >> misc_open() and misc_register() killable. > > > > I do not understand, why not just fix snapshot_open()? Why add this > > complexity to the misc core for a foolish individual misc device? Why > > not add the fix there where it is spinning instead? > > Quoting an example from [1]. Multiple processes are calling misc_open() and > all but one processes are blocked at mutex_lock(&misc_mtx). The one which is > not blocked at mutex_lock(&misc_mtx) is also holding system_transition_mutex. And that is because of that one misc device, right? Why not fix that instead of papering over the issue in the misc core? thanks, greg k-h