From nobody Fri Oct 16 13:35:07 2026 X-Original-To: dev-commits-src-main@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 4j5mCP0c5Lz6wyPQ for ; Fri, 16 Oct 2026 13:35:13 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4j5mCN5bZJz4tvs for ; Fri, 16 Oct 2026 13:35:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792157712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IT8Q10CpwiQgaacx80Q/MBoumqOBovK4M9XjK88zJgU=; b=ldZEKn+7vw5ni4E3gea2HGjhHOY05iRWv3n+ZqWF9QO4n+LPiAoHrYI4OMlzO8vZEzCaIM UCwJMOkPQy68Z9k9za8TamJTpNgIE+pKIEshCHxdgORJ+S3s+zvy/pl0V3kXFgRreSBz7O KtXMIirDcAgG8Hwaz9H2JEMU2Mxv7mb91aYYYRcANf489sMeTMJCKDyutHAiglFgG3GgEs INt+mmJRW51yPCnWk44vpaus0Z7ZAlICtuvlhttQrqAiWRaFh0o/K7ZN5Ju1VuubWmMpP7 +UdlKvfCpNDvz8A7sUVVt1z2bMSAobdLS+Oewfl//sM3SAZ+A1Iiz3raMJamQA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792157712; b=iwozmFfxS/luptfnzDLJqoA/M6gMLnlBY9PHxaIq/YTIhfjUbgOZb59WOQVBfLY7jOguZh tW3dXTyfHZrIBZ8L1lMXHfNlzEXUNnB+f2oQjy/pjHDY310/MuYFRHrpUqEpSUJOhs8xF0 GN+eI6iQki5GbcsW5PbRWFgw3VBVWjpwMy/CU0edhwAeYlf8fPB7cEu9yICwvZetvIsO9r 1/JEsj6OhiWcSbMmEYuC6VV/e/YVu2aIjlumF4eiiJWRZDf11gq2OyoYu0Ovf7rHzfieZx sPN6NcEccw/LzjrCwUoy9n0gXm4PX5lO5h/9PNVpahuiziO3t8aXMixmHM8Q6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792157712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IT8Q10CpwiQgaacx80Q/MBoumqOBovK4M9XjK88zJgU=; b=g9hIhNHedo4CWSh5XbBrTb0phKUkt3tmFyGxdpAckW4MTWvQuTN0XNUwocYgcVO85TmlQj SGSInVcqCgsyry4GmpQ5Uq/NRzr4SqGaTs8JhrYBscqrU/hN9KZKRkoRRD6CUxna0agcgQ pRGNRmTAn59R7fenPICQ5c4SMi6HawPhXFSBuUrfS9evZXX6xUO3KaxT5Lb28v5nAvMYrC kIwMHw20ZiI1yRT2kTJgC6IaWYj1s+mzs8EhqAmjepe4m2QGJ1B1Ls30VBITLIGOcn6SRh Q8W59SX4HxjNOhP6PhNym+WDqmYy6YsEazSEGPULPk9MBrOAuRnfOltdBaMkTQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j5mCN50h6zLhK for ; Fri, 16 Oct 2026 13:35:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27407 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 16 Oct 2026 13:35:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Vladimir Grebenshchikov From: Konstantin Belousov Subject: git: 495bc1924edf - main - pty: preserve O_NONBLOCK when opening /dev/ptmx List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: Commit messages for the main branch of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 495bc1924edfd474c479df61ec35bdf6a83a8d17 Auto-Submitted: auto-generated Date: Fri, 16 Oct 2026 13:35:07 +0000 Message-Id: <6ad2280b.27407.12ecc5ee@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=495bc1924edfd474c479df61ec35bdf6a83a8d17 commit 495bc1924edfd474c479df61ec35bdf6a83a8d17 Author: Vladimir Grebenshchikov AuthorDate: 2026-10-12 18:31:30 +0000 Commit: Konstantin Belousov CommitDate: 2026-10-16 13:34:20 +0000 pty: preserve O_NONBLOCK when opening /dev/ptmx ptmx_fdopen() masks the supplied file flags to FREAD | FWRITE before passing them to pts_alloc(). This discards FNONBLOCK even when the caller explicitly requests O_NONBLOCK. As a result, open("/dev/ptmx", O_RDWR | O_NOCTTY | O_NONBLOCK) succeeds, but the returned file is blocking. F_GETFL reports O_NONBLOCK cleared, and a subsequent read can block instead of returning EAGAIN when no data is available. This causes Linux xfce4-terminal/VTE running under Linuxulator to freeze. VTE opens the PTY master with O_NONBLOCK and relies on nonblocking reads while draining terminal output. Once the available data has been consumed, the main UI thread blocks in ptsdev_read(), leaving the window unresponsive even though the child shell has started successfully. Include FNONBLOCK in the flags passed to pts_alloc(). Blocking opens retain their existing behavior. No change to posix_openpt(2) flag validation is required. The flag loss also reproduces with a native FreeBSD program, so the problem is in the shared /dev/ptmx implementation rather than Linux syscall flag translation. Validation: - Before the fix, a native FreeBSD reproducer observes O_NONBLOCK cleared after opening /dev/ptmx with that flag. - Explicitly setting O_NONBLOCK with F_SETFL works, confirming that nonblocking PTY operation itself is supported. - After the fix, F_GETFL preserves O_NONBLOCK when requested and leaves it cleared for a blocking open. - xfce4-terminal in the Linux jail displays the shell prompt and accepts input. Reviewed by: kib MFC after: 1 week Differential revision: https://reviews.freebsd.org/D60700 --- sys/dev/pty/pty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/pty/pty.c b/sys/dev/pty/pty.c index 3fb5e6b24184..abbf8201f1cb 100644 --- a/sys/dev/pty/pty.c +++ b/sys/dev/pty/pty.c @@ -129,7 +129,7 @@ ptmx_fdopen(struct cdev *dev __unused, int fflags, struct thread *td, struct file *fp) { - return (pts_alloc(fflags & (FREAD|FWRITE), td, fp)); + return (pts_alloc(fflags & (FREAD | FWRITE | FNONBLOCK), td, fp)); } static struct cdevsw ptmx_cdevsw = {