Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1711680lqt; Sun, 21 Apr 2024 06:37:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8ZoBVNauckF4Hb5uU5X5PmNSRn2HfmzP4bytpR/WIwOqrNwFN0wAs9nVttwAD2ktP2AIF2iOPleNdJnpiEiz3GlPHhapaEvICmw7O9A== X-Google-Smtp-Source: AGHT+IH5VMHChf0vLLAXWCb7idTXSil4V4k5QtfpUi2Fg2CsCb0VWCg4/X7KIGoyVnjxKVEVesCV X-Received: by 2002:a05:6870:158c:b0:22e:a2fc:afaf with SMTP id j12-20020a056870158c00b0022ea2fcafafmr7884972oab.49.1713706662252; Sun, 21 Apr 2024 06:37:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713706662; cv=pass; d=google.com; s=arc-20160816; b=UhcU1gTH/9X5x9Nr7ZAgvHXm9AjcDUFIAZrMijKjaa19bVn6U8ebwvy364iPUwjiKH jkTKiqDt/YZ7hMQMWWdpiEL2cJcxFeczPrRL+FGLpU5DmydxxhvTtOosPh+GSj1xdddj 7T0mIqiQwQp4sWg8i9DA2CnWb0kpfSPSaHxP9b3cmREVhF9HQzaQ0p08R50D/MdCy12p rJ8HCL0tAhTeIg58gF3YhW7f4XffIO9OWKKn/LYCqCJueIfihD2Mt03iGlREC+XvNHVM QgiRL3067ndfjxFQTn8BJzpOOF7OGnpRimoYo8yJAPIU7V07dOgptFaqUyxVsVWGVoTa 7XRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=6JQS1dB1v46ctwcbq6WgfWc7izTcsaqDSN0TjyJYhuI=; fh=Q8IpciebQjREJnZYcGhemq+F6kR5tysxVlry/vYUObU=; b=TnRjYaFff2XIBeFMf03dMVTfSgnpX5xxYud0ft4AVCs1udYaZRYLzON9XOHgfZMZhR qW7L8Bu8qX3e2a50nEPgIo5eiCr4mVsLpHxfcdoUoWerjj6Y2J1InRGo1RGnnBjnWgAb XjUdTgOpPDQzOb1OJ0Ml7BrPOzLHS+i3r0AScecxp/CqSz3c9DIOTo8M8Z0UqkHHSxh0 jKgrQt4zsWm14yioAulu77F8EpcWxZ6HCxrKZ6Ax3tUTV2wDnIGirW90zAAQInzHyT74 vZq3U2a5cae+UW+AJ5K8xmOV+hzLfva9tje8Ud4W3qgwarjWNIbOqV/NRQg7HmXk2uR6 6vYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=i-love.sakura.ne.jp); spf=pass (google.com: domain of linux-kernel+bounces-152496-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152496-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g27-20020a63565b000000b005f8074174fdsi3235647pgm.6.2024.04.21.06.37.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 06:37:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152496-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=i-love.sakura.ne.jp); spf=pass (google.com: domain of linux-kernel+bounces-152496-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152496-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6A7C8281BE3 for ; Sun, 21 Apr 2024 13:28:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C72B3168B1; Sun, 21 Apr 2024 13:28:52 +0000 (UTC) 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 1D60C125BA; Sun, 21 Apr 2024 13:28:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.181.97.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713706132; cv=none; b=KFiqTxi3zKNiQflQK7noceG2RE1OFeEyS7AnWtVjq/JgqTaRrJzT/hdAfGvpuwJOwg3xyjEJ+HU0YAriEj/A4hi+HonTljX/V9rgK4Z7BbfnP3OoPsyjSwCokFmwQE5s2rgSxj+8PCcdkevOgM1sVGsdP07mKAKDUM4HGjWU3xA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713706132; c=relaxed/simple; bh=VbnjO6uMvxGBr8zdSDJuHosNBKdVUrNJcXbHEr2TrU0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YwAA7dfxmxMXpR3fKX+W3ceLVKaJqbfz8IXurvMONlKuslnk3fcuIN3nzOjVDA1K2iG9WJV/o939Z9U+mvXC7xbjLJqPmeteMInJiRBZqqwHTu+XLwFWkWgDrbfQIvtfBTpx3l15PWBsG76Iaj8NvR9o8XNgSJbMzXy8D38KYwU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp; arc=none smtp.client-ip=202.181.97.72 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=pass smtp.mailfrom=I-love.SAKURA.ne.jp Received: from fsav311.sakura.ne.jp (fsav311.sakura.ne.jp [153.120.85.142]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 43LDSMOm097707; Sun, 21 Apr 2024 22:28:22 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav311.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav311.sakura.ne.jp); Sun, 21 Apr 2024 22:28:22 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav311.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 43LDSMrA097702 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Sun, 21 Apr 2024 22:28:22 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <6103a212-f84f-4dad-9d33-a18235bd970a@I-love.SAKURA.ne.jp> Date: Sun, 21 Apr 2024 22:28:19 +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: [PATCH v2] tty: n_gsm: restrict tty devices to attach To: Linus Torvalds Cc: Greg Kroah-Hartman , Jiri Slaby , Andrew Morton , "Starke, Daniel" , LKML , linux-security-module References: Content-Language: en-US From: Tetsuo Handa In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2024/04/21 3:05, Linus Torvalds wrote: > On Sat, 20 Apr 2024 at 11:02, Linus Torvalds > wrote: >> >> Most other normal tty devices just expect ->write() to be called in >> normal process context, so if we do a line discipline flag, it would > ^^^^^^^^^^^^^^^^^^^^ >> have to be something like "I'm ok with being called with interrupts >> disabled", and then the n_gsm ->open function would just check that. > > Not line discipline - it would be a 'struct tty_operations' flag > saying 'my ->write() function is ok with atomic context". "struct tty_ldisc_ops" says that ->write() function (e.g. gsmld_write()) is allowed to sleep and "struct tty_operations" says that ->write() function (e.g. con_write()) is not allowed to sleep. Thus, I initially proposed https://lkml.kernel.org/r/9cd9d3eb-418f-44cc-afcf-7283d51252d6@I-love.SAKURA.ne.jp which makes con_write() no-op when called with IRQs disabled. My major/minor approach is based on a suggestion from Jiri that we just somehow disallow attaching this line discipline to a console, with a concern from Starke that introducing cross references is hard to maintain taken into account. https://lkml.kernel.org/r/DB9PR10MB5881526A2B8F27FE36C49134E0CBA@DB9PR10MB5881.EURPRD10.PROD.OUTLOOK.COM Now, your 'struct tty_operations' flag saying 'my ->write() function is OK with atomic context' is expected to be set to all drivers. Do we instead want to add 'struct tty_operations' flag saying 'my ->write() function is NOT OK with atomic context' and turn on the flag for the console driver?