From nobody Thu Apr 13 14:37:46 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 4Py2HH3gnSz45CXS; Thu, 13 Apr 2023 14:37:47 +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 4Py2HH0v32z3CPy; Thu, 13 Apr 2023 14:37:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681396667; 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=nPs5OTCXj2sbTLtfrDcT1lHBU0oJNcT2dSnMyNjdWe4=; b=X6DgNC/4ULod42WUytOXoUNnl2FBzuCdDBaDkjVpbtyhwlMjQLuR1N8uXa7YTOj4xrCe/6 H5/dU75RbsxGalpson7Iuarj2s0q4ZEI4Ku2EjjETR83zkaaM4HcOEh9+cklspl6pmunTv 8SdkgkZ/fw8uA3rx6r0QP8FJuZ42GaoDiSH8Sl/K9NUQzIMophyx5m2Pta8QGgShc1ywXz MLyPJQcCgxPgJ7bLDBiPY+hvvOAGzyj2nBw4uUuKErykulmWHEwU9e5n0TjJgIFtzzv8Bu mfjkCiJNboBPTVGYRGtUDubkouZT/ZW5iB6J8rr2aSnmINx1/cjLfv8yy24EZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681396667; 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=nPs5OTCXj2sbTLtfrDcT1lHBU0oJNcT2dSnMyNjdWe4=; b=aMw+bYyeNxOemDonRp7eRvrcFcHW7wMGvve3M+H0UxzldIMXkYhsZOuI/x3yuflVyp1J+u BFgYANbfRCoznpYE7PCx/b7aOgNaaA+1B4xQhSTCKRDHwtbimC6dbZYeQPytatza3wkvGN 0zwu9+MUnIN0C6BNQuWHTB3NUHZbcxGST1XZpkjByHqHq2Lqi79zx6Ok3SoAv2/+NDAGBp xfWinC58XBHLv0DxR0Shegt96ka8Q0TMtmQkoj0mbCvbESOBYYkHM1fcNfhzx/X2VykB4j jebgoeZ7lolaxmwv1DMxDPY654j9omAEfvnVgd4wrO9Fp6GpbRiPpBXUiqmCVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681396667; a=rsa-sha256; cv=none; b=rDCdLanW+8H9hEcp1vxyV/AHe//VA49V5Q94zXbhmMm+j3V7dC0yLw2dM8ewkyjoDfhhYo 8xPGC6Z8FEMelvrOH2kbDn63BKSbY3FuGdKXx0x0kU+I86ImoNngyxQ/7WdclZPdgMzQK3 52P9QlM+QJDnOIPQtqE96XWyPbNWhgc+vobRuR95FoNgPlQzOoWR/oXjaWFX0DCK8P91eF qHIkBjzukByBIaHojs9pG1IuaEemWJ1CnnyekxEbiCvBdxdS1LSvuglVakh7u4vrME6jeU JQv96u7afXBIyDbF2ftCWmDsNzhv4qi0bjQVAJEj5qZxQnWe8qxP5kVvFuOy9g== 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 4Py2HH00l5zm3y; Thu, 13 Apr 2023 14:37:47 +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 33DEbkqf070946; Thu, 13 Apr 2023 14:37:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33DEbk14070945; Thu, 13 Apr 2023 14:37:46 GMT (envelope-from git) Date: Thu, 13 Apr 2023 14:37:46 GMT Message-Id: <202304131437.33DEbk14070945@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 7cdfe51f3096 - main - rtld: fixes for handling of the grouped options 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7cdfe51f30965a365e3e7c829396a56e2a7e5141 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7cdfe51f30965a365e3e7c829396a56e2a7e5141 commit 7cdfe51f30965a365e3e7c829396a56e2a7e5141 Author: Konstantin Belousov AuthorDate: 2023-04-13 04:47:23 +0000 Commit: Konstantin Belousov CommitDate: 2023-04-13 14:37:33 +0000 rtld: fixes for handling of the grouped options Do not terminate scanning group when 'd' is encountered. The 'b' option must be last in the group, same as 'f'. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D39544 --- libexec/rtld-elf/rtld.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 0d2a2b6b4c24..ea56ade960d9 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -6029,13 +6029,16 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, _rtld_error("Both -b and -f specified"); rtld_die(); } + if (j != arglen - 1) { + _rtld_error("Invalid options: %s", arg); + rtld_die(); + } i++; *argv0 = argv[i]; seen_b = true; break; } else if (opt == 'd') { *dir_ignore = true; - break; } else if (opt == 'f') { if (seen_b) { _rtld_error("Both -b and -f specified"); @@ -6050,7 +6053,8 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, * name but the descriptor is what * will actually be executed). * - * -f must be the last option in, e.g., -abcf. + * -f must be the last option in the + * group, e.g., -abcf . */ if (j != arglen - 1) { _rtld_error("Invalid options: %s", arg);