From nobody Mon Oct 16 13:12:27 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S8HZz6cfSz4xLsJ; Mon, 16 Oct 2023 13:12:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S8HZz67djz4Fhq; Mon, 16 Oct 2023 13:12:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697461947; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ywSDb+P1nryLc5v2UGXDIthmG9cJKONuW7ppuviY2/s=; b=xxFEZEND/4kZeiCrNBqeB6Ez0P3LuFZ4kQXM90X8iuFYOLNOw5UF2Tm2/aC8mLWvnjMlhL LKIaJwrmiwaay+1LXFdFKu9SVGPu1W0Ma5L2qIk2m+sNhtWXFfrGmYpyH/92Oe28ThOX1x bAMfWd3edrOfSho3O9TteP7u2PouQfFwIS6d/wbzHf7Mxp2zoCW2p3rEqzemJ2Tfj/SGL4 R7LN77TK4wZvIAOec4xHfmKYMhGsMcHsxJRUcIBV3hSy4qDzdZ8T6IsDUe+172VGsvtq/u FM2COUOyV9XY/uCzX5LEoWGCxmVwFR4mL1zM+AO+0KOCfy3kh0gVsSMv5Ln6AQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697461947; a=rsa-sha256; cv=none; b=NUNf0HGD+eWJUt4xz4xfCo8WIN+YZkScqircSkOZA90OxqRA+oaNEjktvJM04/hZz+XjWH hIxOnqYQGb9YTEyqXOMKxCzH2TVuIoFwDAih7S9Hp1iSVkNTroNMOjJEv/v4hrzuzjAfmL yq6QosmRQeg3FuwjeGzZf8O6/u7pJ6XgUforDP9jury3oVstTVHtvm9P+7KP8groAv9j9i RkOQU7Poi6yZAhRJ64KGgFnjksHUCng1kkQxrX/wO1ddomwf+RrGHEODm9Q3PF8i/tSeiK ngnHXNztG6yHP54JkRwKpaymc44MGQ90q+25RL8SdMWoaWzqd/4y86Qp2Fgg4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697461947; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ywSDb+P1nryLc5v2UGXDIthmG9cJKONuW7ppuviY2/s=; b=uyylfTP0tJK+2Ga2qVyNba5KgKnen2zJL0qVrR6EMqIToEchR7aN7v5Rlg/NHvQ1a/3MDD +wuXJsxIZx70l8sHxKRazunFJ083Ts+guHMIY3aHaW+ZddlrnCmmJu/dfr/C60y4bpIf2e 8ZXFcRvSQv+yiLWV/Qkpa8ThixcxbPdAO6m8pSHDpe8+7B/YzazsOg3LosbN4WCR5omxLT jHjltJxLGgCw7TrmYbjwpY550ZVVL0ay7YYzBTJgkWFe24ZfbWLTT+MmvrI5ArcvR/bxru M+r0l/JSQZ8RQcXNbkqkNFV5nCUsRb1CoA+wBK/L+L/zrfEcAZJi76ukO3xuBg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S8HZz5BCQzhkB; Mon, 16 Oct 2023 13:12:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39GDCRPx052630; Mon, 16 Oct 2023 13:12:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39GDCRna052628; Mon, 16 Oct 2023 13:12:27 GMT (envelope-from git) Date: Mon, 16 Oct 2023 13:12:27 GMT Message-Id: <202310161312.39GDCRna052628@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d556719e15d6 - main - syslogd: Keep console and tty descriptors open List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d556719e15d643ba9619bbbeab550eed87614525 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d556719e15d643ba9619bbbeab550eed87614525 commit d556719e15d643ba9619bbbeab550eed87614525 Author: Jake Freeland AuthorDate: 2023-10-15 20:34:06 +0000 Commit: Mark Johnston CommitDate: 2023-10-16 13:11:58 +0000 syslogd: Keep console and tty descriptors open Console and tty descriptors are initially opened in parse_action() to determine whether they are valid using isatty(). That descriptor is then closed because it is never accessed by syslogd again; ttymsg() will reopen the tty/console under a new descriptor when needed. If the user attempts to log to a tty that is inactive outside of syslogd, then syslogd must keep that descriptor open so the tty remains accessible. For example, logging to `/dev/ttyvb` requires the initial `/dev/ttyvb` descriptor to stay open so the user can view its buffer at any time via CTRL+ALT+F12. As a result, console and tty descriptors must remain open until a potential configuration reload or a system shutdown. The given descriptor will be closed in close_filed() in such circumstances. PR: 274454 Fixes: c3175a6e1c5a ("syslogd: Do not open console descriptor") Reported by: Trond Endrestøl Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D42215 --- usr.sbin/syslogd/syslogd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 7db5bab11008..11d1033651a8 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -3053,9 +3053,6 @@ parse_action(const char *p, struct filed *f) f->f_type = F_TTY; (void)strlcpy(f->fu_fname, p + sizeof(_PATH_DEV) - 1, sizeof(f->fu_fname)); - /* This will be reopened by ttymsg(). */ - close(f->f_file); - f->f_file = -1; } else { (void)strlcpy(f->fu_fname, p, sizeof(f->fu_fname)); f->f_type = F_FILE;