Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1353227lqt; Sat, 20 Apr 2024 11:03:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU+Px8xbxw5Ap6mzmVsoA0LyPDMWQif/9E8/n1qf5dmV77IMkJjRJPYV3ezpsW/Rni4K/yT4qLItBRzdY/7yZknzWxITEJb5Ssu+v4xRQ== X-Google-Smtp-Source: AGHT+IFXwMRMrFalPS1e5f/Je7texXGfpK24y7ANVAVDKIzddFn+RTExD8uFOd7uxedE3D/9M7P2 X-Received: by 2002:a50:8dcb:0:b0:571:fc02:2a4 with SMTP id s11-20020a508dcb000000b00571fc0202a4mr488609edh.5.1713636200310; Sat, 20 Apr 2024 11:03:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713636200; cv=pass; d=google.com; s=arc-20160816; b=MwQJW7cuLoI0F9IE9PJGVQhb991T7X8G+LPgIRtDOjpMrIKtSXxGLhIVSHb/UxGr8l 4N6N5oWX+M74ogwXqNM+aBimRCi3+m1vc4c7bJj4ZRpBss6kUSN+ednsfCKFiXJzXxqN wpWGIVd64OmgsS9AkqK8Nz1w+cTtnzl20rYzGG640OeE1N7m3ffB+eQDhogIW4VTakzO sXcbykzg4zCGRm/x3bajyZDbTCNsZmjjyixzk7Y7XTfWkuA/9MQ/iqGmDNibDUiKUDar zpM3fjxGL+mAUiAHZa2ohLhgYkM+PIp/8obwd3A9di/x8fWEwXqQp2rJ/XfvyL47NrqI zLzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=sqXoO3+h8rGnOZ9lr24FquhSup/PaoI+NzZzYVQGgdM=; fh=VdS8RHviECdr5qz7wXOHM+Y4O4swOo5xOtl5gZWyXcE=; b=v/LwlCwKql39fnZwSZbFDe8bCH6435x9qmrSaBMElG0c31cfRfkc749qTRKIK7G/aM gjBDhlPPNap1pdyDcdsdvwSJu4XUVLRiOwaa8Q79pKg23YKvfx1rI78+86a5/KFYesKt bE6ePyVmHd6jxXLgkA8yaO6LgMc3lWocrTCRYo2LbmXEaI67GStqvqTdAjUTSl3YynvD 8635f02CMfWAKG+pJIL5IL445CJ4q10gpVgXl6AxPaDLd4ezyV8EQ0yucu1bm3JgQH+T jJHhrrmZ5AuQhVMX47AyIFfdBvgn0bDDqVFJvI6cwTKP+hJCz1DDp/dJFSGCtbZo7Gzq L2/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=P2ezNuv1; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-152340-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152340-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 r15-20020a056402234f00b00571b93e08a7si3821933eda.407.2024.04.20.11.03.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Apr 2024 11:03:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152340-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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=P2ezNuv1; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-152340-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152340-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 0E1681F21477 for ; Sat, 20 Apr 2024 18:03:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 16EDF3BB21; Sat, 20 Apr 2024 18:03:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="P2ezNuv1" Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 631AC2032C for ; Sat, 20 Apr 2024 18:03:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713636190; cv=none; b=e4O14PackoXEtFBpMjNnbtC55cK1KbjhOathaaa4N9YOINnwI7X+p7/yXo9xeiwz8WARpBywpT6ht/S6g1FoEeyTlR2/YCal+GM4/x2sz6ObFpMYL/xw+ooRntys6mAEE2vu4lXUAfdnDJBDTNOXFx0n+xr+X/SsxzhiIxc1g7E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713636190; c=relaxed/simple; bh=XD8kIuycNDgPcM0zNdB13KVRClY5a3l1yHaX8uhAPqo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Y1iR4YcV6F5u0LuIZba0QCXL6Gd7jg90FNTKBD98RiebiL4BawazSXjgs0GKs79C7imnPnenbMjsMJgQrDQRGC/RbsSTBgpFELnFwuN+Np8kqxuFXY96n93DXcCyFFammahVcAEvJ0iXT1w46hoq/jUb7sKhZp/nPVtXirRe85g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=P2ezNuv1; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a55996acbb0so94937766b.1 for ; Sat, 20 Apr 2024 11:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1713636186; x=1714240986; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=sqXoO3+h8rGnOZ9lr24FquhSup/PaoI+NzZzYVQGgdM=; b=P2ezNuv1z2gsBck//Cj3gPi+oyxMQHRKkHNoqx2wiIeuOflkn+k5qlVEXkAUQn7QeV UDst2+TFQBIQnpwDDKu51+3ogGs5/CWOOc8VkrYpBuGnVlgnVtGJNgcsaajc8A38hvoi A0mWkQqpG7/eJ4U779PDMQhKxpAuIY0aJIKA0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713636186; x=1714240986; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sqXoO3+h8rGnOZ9lr24FquhSup/PaoI+NzZzYVQGgdM=; b=RbjLHdh9kkDG0EHfAs1Q9TxNPNL1E72fpZIh3b03EHnZpjlI9yXsVvRQC+3e6T05Pj 8wUsystMZYyJ71MIDUZ5vNm+EyG7BdYT1I34lu+ZLKjPOsyKUudY/2CqFVgs/G2ZvlbD 0VBowKDSyT0TbIblpOI4k5mn6DsJVPNJ+UMn9esJc8opZz6nX3pQ/StlE3RAnqiuea0I pBYwwrMbgFYyQ1mBZqwXuo8hGFNWjns/PShh1CwUVxoxBAwHmgKrMG1PpQEnpVbeQRDe Mg4eoUJ6qaN1lmzxAVo2H7yy5j+/UekGJt6hf6hZO18og5WX+5TyvJkm/BIM31ontfNq LYyQ== X-Forwarded-Encrypted: i=1; AJvYcCXx9gnUUSrkSj9atj5XG2wqYUkLGdhKhGyXH4GT7rRTUAdrnVq9ZdRvjQlKE2MhNaEqyiNDJhU80finjMY0DA/v77/3JUDEvAZ/SGQt X-Gm-Message-State: AOJu0Yz2HIrKXxdGZByfzjwkcf9NA0oyR6ZEyjx8iCwKGynxT6hSvUph eEenrBxUnWk6NZBoEM1GsQRxMX0zt3dj13TtAkd620iGe1YF1ftLPi6THfk1piEauK6kGXakocR Q7Qo= X-Received: by 2002:a17:906:c214:b0:a52:4edf:cc3 with SMTP id d20-20020a170906c21400b00a524edf0cc3mr7895954ejz.11.1713636186521; Sat, 20 Apr 2024 11:03:06 -0700 (PDT) Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com. [209.85.208.54]) by smtp.gmail.com with ESMTPSA id 13-20020a170906058d00b00a522d34fee8sm3632233ejn.114.2024.04.20.11.03.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 20 Apr 2024 11:03:05 -0700 (PDT) Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-565c6cf4819so7223693a12.1 for ; Sat, 20 Apr 2024 11:03:05 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUVer4Z5TQPrwsv8/yCqlUQw0putTdKJ6IBHFHapFmvsqDthuqYLt6TrhAuKKqiOYBlRVt+CBmGfYlPZXKjGmccqDycWJ6GU1jpn579 X-Received: by 2002:a17:906:5d5:b0:a52:4bde:4999 with SMTP id t21-20020a17090605d500b00a524bde4999mr4978012ejt.31.1713636184639; Sat, 20 Apr 2024 11:03:04 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Sat, 20 Apr 2024 11:02:48 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] tty: n_gsm: restrict tty devices to attach To: Tetsuo Handa Cc: Greg Kroah-Hartman , Jiri Slaby , Andrew Morton , "Starke, Daniel" , LKML , linux-security-module Content-Type: text/plain; charset="UTF-8" On Sat, 20 Apr 2024 at 10:34, Linus Torvalds wrote: > > Alternatively, we could go the opposite way, and have some flag in the > line discipline that says "I can be a console", and just check that in > tty_set_ldisc() for the console. Actually, I take that back. It's not /dev/console that is the problem, that just happened to be the one oops I looked at. 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. So it would end up being just another form of that + if (tty->ops->set_serial == NULL) + return -EINVAL; check - but maybe more explicit and prettier. Because a real serial driver might not be ok with it either, if it uses a semaphore or something. Whatever. I think the 'set_serial' test would at least be an improvement. Linus