Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp568156rwd; Thu, 8 Jun 2023 05:03:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6o8BAOS0YqcVuD8w+qjwpDI74HC0PIc/GqgOBm6W2ycVW6p1kgffj/gaHNsIU6u5eMwlhX X-Received: by 2002:a17:902:6b89:b0:1af:9c06:22e5 with SMTP id p9-20020a1709026b8900b001af9c0622e5mr3649507plk.69.1686225805433; Thu, 08 Jun 2023 05:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686225805; cv=none; d=google.com; s=arc-20160816; b=uoTEi9yb86GQ719SVzraSWl9EqcyDIQZpwuZtbguoO8g0gbyGsf0SGPdJMtPFmrkH2 ANiSeS0rh0kNL0awLxMTlnSZQonfkR0wA9ntpciTrMG3FQdownjYsDX1vrjoz1D8y9du 9B60GwqRzvZw9mRQLHE5I5XOq3dD/Arm+GmLnJpqlJ/So/UOn0YVFzlzb8YMQkbFVdgT G9+829axMLKQF6gHku7qMj1bqlP2ItMnD82N+Nx3iHWR9nDyemwSdpZI8omw9ipTNrUf 2m6sLgg5L3OCQPmIH/0oUc47yqaYdx3bZpbdlZ9NlIZUV9QJVgF8MdnvihGlqD5ioyO1 xdlw== 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=CIO4Lv2j5HSnhPkOFmIIob3K2sZldThgxZoK42qMpY8=; b=tGhhMUU1BM5K7n1VZNb8+6rsYsSu3wba99G2JB8SsL98GCD5AfTS1c0WBchSkGy0Hu BKNfxvKsFQicdqkIndfKmLT+hBjX5KOzPZqtlzG0f6iCI/6kZO1F9Sdk6LExwjWCL9KE uMYvPwCEQ+lKlyIc3piYIeTHalcwWxPuyRRdfU/7irRxaqOd1y/gXJNS73ZPPeVyrX5y UDwg3yS9eqH/55qrON+yDr8GN2NZH72HpMXnsDHsR6IA4hZer9FgreUqNWLaWjJIXZSu +5GojoBhOiBZJ0E42RNmA849mf3sHFs4/k0S1FBDBAi5ocFF632Dd4ZBmLxSFxS5Gr/e vy9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h4YmX7gA; 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 m9-20020a170902c44900b0019e88376e3csi953118plm.162.2023.06.08.05.03.07; Thu, 08 Jun 2023 05:03:25 -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=h4YmX7gA; 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 S236268AbjFHLvZ (ORCPT + 99 others); Thu, 8 Jun 2023 07:51:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236045AbjFHLvY (ORCPT ); Thu, 8 Jun 2023 07:51:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04E66E6C; Thu, 8 Jun 2023 04:51:23 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 93C0264CD8; Thu, 8 Jun 2023 11:51:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6374C433D2; Thu, 8 Jun 2023 11:51:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686225082; bh=JZFA/ybxQcOvxs/C01SkmXMMjXuWUvVPOYATnYCc0fE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h4YmX7gA0DQ+0x58Ib+iXoeJcoOIpZxwlrr6dqP8vqI8X/NLrCGhd2lRKyISfnNVN TqWYP4cuAALBXAspxB5qn5DTk5xyft0zzoZzhj4MgDP0eFEyw7QMfH7ckH6eoZdDyP KiptIlSJQ9221GPxJqV0a2OJalgKSyvXrUBNsZy8= Date: Thu, 8 Jun 2023 13:51:19 +0200 From: Greg KH To: Michal Sekletar Cc: jirislaby@kernel.org, arozansk@redhat.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, shuah@kernel.org Subject: Re: [PATCH v2 1/2] tty: tty_io: update timestamps on all device nodes Message-ID: <2023060816-quicken-around-d619@gregkh> References: <20230608101616.44152-1-msekleta@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230608101616.44152-1-msekleta@redhat.com> X-Spam-Status: No, score=-7.1 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 Thu, Jun 08, 2023 at 12:16:15PM +0200, Michal Sekletar wrote: > User space applications watch for timestamp changes on character device > files in order to determine idle time of a given terminal session. For > example, "w" program uses this information to populate the IDLE column > of its output [1]. Similarly, systemd-logind has optional feature where > it uses atime of the tty character device to determine if there was > activity on the terminal associated with the logind's session object. If > there was no activity for a configured period of time then logind will > terminate such session [2]. > > Now, usually (e.g. bash running on the terminal) the use of the terminal > will update timestamps (atime and mtime) on the corresponding terminal > character device. However, if access to the terminal, e.g. /dev/pts/0, > is performed through magic character device /dev/tty then such access > obviously changes the state of the terminal, however timestamps on the > device that correspond to the terminal (/dev/pts/0) are not updated. > > This patch makes sure that we update timestamps on *all* character > devices that correspond to the given tty, because outside observers (w, > systemd-logind) are maybe checking these timestamps. Obviously, they can > not check timestamps on /dev/tty as that has per-process meaning. So how are you protecting this from being an information leak like we have had in the past where you could monitor how many characters were being sent to the tty through a proc file? Seems like now you can just monitor any tty node in the system and get the same information, while today you can only do it for the tty devices you have permissions for, right? thanks, greg k-h