From nobody Thu Jun 29 08:20:33 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 4QsBGT6Fz3z4knrq; Thu, 29 Jun 2023 08:20:33 +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 4QsBGT4rdKz3vQ4; Thu, 29 Jun 2023 08:20:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688026833; 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=y5cBMYC8aOrjC7pnb70/Oc/V8N0GMFMZGwwTbdNWtuk=; b=GoGViS1CrHQqH2qZZ/6iMQI88rGb+mzUp2Dssl2NBThmUjB9lOx67CmwCaKGica0A5OYul 1BL5z9i3Yw4oWzrPgtMYfAuEqI/bIh4J3r4tSjUkXLQYZTU4k6mbs6On40S2VstNtv80kK WohkSoOqU5S9xW0lpqfCX6Qa2kTrHLBmeSAMrj9mY7/RMtpHKAGFW4AmXP6ckxn9bwD+Be HO8Hbpl1o/S+G5PWRwqYEhaljIhs4hUNYON9FRvhiAQuhHVeE682Zuy0nrhbs1j8sNc1F+ EJR45bRS1dqkstfmpmFPT3UaKZLZFHSkvikW46Qpqdg86+OW8VbgeZLPbydJ2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688026833; 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=y5cBMYC8aOrjC7pnb70/Oc/V8N0GMFMZGwwTbdNWtuk=; b=lUwQlwqCTkFjezmaqkvHLVzQmndMi1C2s8ZSHkIZ7jA9ES3FSJmkA6UsRi9iscsHrbn9wA x9hiLSMHY8xryCFzY7+z1fiBpUB9LIJsd4nWJfFBHbx4Bp5Im3bM18d9d2XALc3syXe0uz 0/OP5BK6OmnKk+VbSeocv4RXHKnVojBSqGASkhF/gx7TLQXI3aiuU5B0neiFO0ZvnQVXyM AK+fOljRmuFTn8ajUQOf+S7CKEq576hu51Dp6HUG1RnLMA0dpK0BIXAB/QJORZ7NbW2O3d PyWxweghHE3s8y7j88JIeDHta4qLtLsDWGdjevftS1sF/MW/Khe3E7aKkiGOBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688026833; a=rsa-sha256; cv=none; b=brkCOv+Qm4Ppp2bnXx1vR9ruY4Y4JPWNQqupbhNN0H9T60ztb+zomyg0KLL8uxBoJdgs8Y 3fgUif01ouw5V6VLcX5DuPE+4FslKSKhxHPm/ygkOVrpGQj5fUaQCwRxXvRxhusIxYRNKp 4qH2JeIA9yq9xqYILo9N2Odg71w7MPi38BIDSCHIHnuxi/iR7HqDiSKgdaCpFY9oFv0qcX nBhYMLaNEJ437Hn3+g+JGzN3NiBtcEYAYRWKML8X5oJc5peQuseTCVl9bvgTMMtGhyo4iG EHllSG8P9szdQF/f11EbpMTYoVeT0Sw0ZxcjXqSQ3SW9SBDqarzkgz6l9uVJBA== 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 4QsBGT3f8Lz17gm; Thu, 29 Jun 2023 08:20:33 +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 35T8KXYB083579; Thu, 29 Jun 2023 08:20:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 35T8KXCn083578; Thu, 29 Jun 2023 08:20:33 GMT (envelope-from git) Date: Thu, 29 Jun 2023 08:20:33 GMT Message-Id: <202306290820.35T8KXCn083578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: addf706f6ff0 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: addf706f6ff0214cc19fb6ad17b9994e91292065 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=addf706f6ff0214cc19fb6ad17b9994e91292065 commit addf706f6ff0214cc19fb6ad17b9994e91292065 Author: Dmitry Chagin AuthorDate: 2023-05-18 07:55:39 +0000 Commit: Dmitry Chagin CommitDate: 2023-06-29 08:15:58 +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 (cherry picked from commit 0f62290e7f749b7a453d413dd72c406129a9aba5) --- 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 fd4afd3004be..25f5e6d8df0b 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -1010,8 +1010,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;