From nobody Thu May 18 07:55:52 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 4QMMjN394Zz3bLmD; Thu, 18 May 2023 07:55:52 +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 4QMMjN2NwQz3HMS; Thu, 18 May 2023 07:55:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684396552; 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=vdYiIvcC5cFOWYixe7h5GezX0rW/rqT4PWe3bU2fyB8=; b=x6XkAF50U6NG8mzAh7pwUwEu8AbF0E1Na110xl7RMlMSiLrFSCJKPkWL5aiXP12ixLPjzI AJ/+MGuigvM+BYFH1sLa7IRrH3jKPRiERUvlihlcVPQAMHuDmqeHwB8YeURpNPysQT3Z9p 526/faLGtjUafp/1jElGeay5evnSAup2zmy5QEnrYotSOy5a14iZU2aRLyVkX7U61vzw7F MFJ6ewDLqBeJQUHRfLnyCZFf7hEY7mVKrKRHVjDbH1orv6Ytk04J9nJM+mp4RuifhD68N8 GfB5I7Ut8Tmu4+ctblH2CQ09F/c1yE9N4I1FdpX15ZYHGqFuJT/y64vEqqFk4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684396552; 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=vdYiIvcC5cFOWYixe7h5GezX0rW/rqT4PWe3bU2fyB8=; b=p6cqsrUI0RGGb8+b2WCy+pGBYguYjaZQXcJiytleaN2UPYzSIREJlve+GGilABbGnNu2B2 TbK67jJhs/M6h/zCp5WmguKLLNMj9pL/SvYXlayxD+5+IJTyD/vyToCLq3NVCX+W1tm30V G+mGIrqU0mkD/UmIu5ihqlLU/Le3X7DtlDpi7szDRvgbYGKxLytixFtkZXoXFFjNHkBIdW HTY0enljrGapFECzrKGp4UqU7chXbA4z6pQYWoLDgqn6wrM4ZCMWnWrJfnbtEBk0udMe+N rkO4MSzmqF89uLON295ESR2vKB58/SqnvRJPFnqjb1eaLWJyKWC9RFHLshNkAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684396552; a=rsa-sha256; cv=none; b=wQF3YTQq4Pokm13kj5Ra/ohqD7Gfo963xWfCSFSUh14ch0/CHK0PjjtMpyRW1YN3cEU18N hClGRFksokutMvTUu263PWLNNe7g2VI1Q7p0pr5pE0B++pgS29DH8733xiIiUNmIDtGsi/ Iw9DMOT/7kEUwMoPiyeaxZWRisq/WXkyuTMidq9TA2B7q6bmEz6lfMlDA61zp73tLYBATW yZgULUlDSGFLMiD7JqwBNMbtUB600ERoBdOtFl647Qs+HwTwTAUf5qNKmY/hWYUFhJT6Ki 54JNxBKwoz33WBOyOlkxhra7HTyYHsgo7F+AfZy1pzG/qUOu4pp7ksIUUXPcFg== 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 4QMMjN1L59zddS; Thu, 18 May 2023 07:55:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 34I7tqAF012789; Thu, 18 May 2023 07:55:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34I7tqvt012788; Thu, 18 May 2023 07:55:52 GMT (envelope-from git) Date: Thu, 18 May 2023 07:55:52 GMT Message-Id: <202305180755.34I7tqvt012788@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 0f62290e7f74 - main - linux(4): Check fd passed to unlockpt() 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: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f62290e7f749b7a453d413dd72c406129a9aba5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=0f62290e7f749b7a453d413dd72c406129a9aba5 commit 0f62290e7f749b7a453d413dd72c406129a9aba5 Author: Dmitry Chagin AuthorDate: 2023-05-18 07:55:39 +0000 Commit: Dmitry Chagin CommitDate: 2023-05-18 07:55:39 +0000 linux(4): Check fd passed to unlockpt() In our implementation, grantpt() and unlockpt() don't actually have any use, because PTY's are created on the fly and already have proper permissions upon creation. Atleast check that a proper fd passed to unlockpt(). For grantpt() Glibc calls TIOCGPTN ioctl which would fail if fd is not a master. Differential Revision: https://reviews.freebsd.org/D40100 MFC after: 1 week --- sys/compat/linux/linux_ioctl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index 4583d4bd6784..5e7446f0dfaa 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -1009,8 +1009,12 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args) error = ENOIOCTL; break; case LINUX_TIOCSPTLCK: - /* Our unlockpt() does nothing. */ - error = 0; + /* + * Our unlockpt() does nothing. Check that fd refers + * to a pseudo-terminal master device. + */ + args->cmd = TIOCPTMASTER; + error = (sys_ioctl(td, (struct ioctl_args *)args)); break; default: error = ENOIOCTL;