Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp21268imw; Mon, 4 Jul 2022 04:37:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uV++jlSbvjgEZJHHfLXPIc58QLtpw/4vIy9ejWP7xbKvZWBhF/BzwqYeM3BHxiNXfUT2I0 X-Received: by 2002:a63:c15:0:b0:411:f92a:8ec7 with SMTP id b21-20020a630c15000000b00411f92a8ec7mr12506896pgl.86.1656934629613; Mon, 04 Jul 2022 04:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656934629; cv=none; d=google.com; s=arc-20160816; b=URGmfGvlRWimkxtZGqgYCEf0vy7r1TR1YWENSErbAjP1Jn5bSer03dGgS/qkh/1qxK SbvU3t547r0XXZUGn1Sf3xfGFJwkembSSTTcLcOyxuJlb4Uu1L/Dtar2P962SQ4QtGJG 3uZexT84obqeUGlfSI9Do4jAsEeumyBnG/DleETUyPa2bTosaGpAXj8epS9qvPfprlrr 8+Qe/9TRNi7tCSu1pG3DxggFxyn50CNvjLHsXtPOpO2o46rmI9vbRKBRB19rhbkvBHgO jMwWY4N/n8D9gf8PGCogXxdxkwHbu5L2oOgS5DmZnUlxCADZ7QBqc2oiT8uwbo8lrIqM dKfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4MTu1ItGX6+I2a8wjTuc7hvEzW/neVaYWflO1xuGaZg=; b=eXwAfXoq3Cq47HSo4tYdXwSqmKcsqw8Z0GLMoJFuzVnW8hJEryPHFh90sKMDaG9Ngg vENyOM8sbg5IX2UaCjoCjtFwU3VPUSOiECd7JCIo/UuhgpkOrxA3hOZUjfQbBBv+0p38 9DLhn+sTPT804rDR1RL7N0leAb6ICLypB86/B+M2E+q1/vCwnFj5sja6FV8ast9LqUbd nKikuJYwtIRWH7VZGBiJ7IDfYZZni3IjUW5+dYfDPozhzAWCJoOkV+gEvNnhMAAV1+CH gWckht+QVIZcjy/lBEAJwTCt8zTmI4fxIflCB9u0PZO9g7p74ULWDRS/AXgvN4XFvze+ 3Z8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cLl0yM2I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a1709026a8a00b0016be3d0c123si3400108plk.108.2022.07.04.04.36.57; Mon, 04 Jul 2022 04:37:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cLl0yM2I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233716AbiGDLBV (ORCPT + 99 others); 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> X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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