From nobody Fri Aug 23 17:58:42 2024 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 4Wr79H09qTz5TgP3; Fri, 23 Aug 2024 17:58:43 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wr79G6mzcz4HL3; Fri, 23 Aug 2024 17:58:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724435923; 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=7/nkUUTV61pcLhXiLmb8UQnbtoTXNhaQ0xxfmhGoq00=; b=bylFXZ7iA7vc1wdg4UvN6Ns5OumaiGimbkMDJQHztiO42CM6DB8hrhAlaQjrSPlg1Q6eE4 WW8kCJSfgszzbQLxVq6s7b4gEuAajDRedbgEkk50QvKfrqCMwUcEVdsMhBbe3S5q2YIsYJ Y4Pu+Nct3Q20r98SS5L+AohJC3CxzW+p1eoBVOingrMwQrPBSCXhjuNot+SD0HsBSxDhXT EvmJTaiv0EO7roKHgXl4mVsps3FhDEWDr+HvBuyXtwYCiNmZGCMbO3+IqI3RJhNMZw0r8M J3D3Lsmtb01ddMzmqKxnXdNqLJE6lS0NIoG0a2FkR++IMjW3AjlFSJKWRkGCdw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724435922; a=rsa-sha256; cv=none; b=seEILw+eRzAojSMUXAao4Gb1e+5Jdryg+KVxO2pKOWcBagChRFQ+E8YB0YO7queSL99BD7 4lQ2WEJik2Tj9gu10GnDGWUm1pzoxJV+D/iXjEEPc2MQ3+Yqr7esTK5Yjj9v82C469r6i6 yE9xKWKQDyNXKUvnZzUDRC07eWovJQj1HwdklbNZWihCv/owJopkb1AdFXlVuHuDiv5GET PKAaWBEHfT9z0inXj29b6nkoPILhJ4nwpBKR9xK/H0SCuhu4kvITBN39l+3HnYUQ7gFPgQ vlw+uYP5kEiLUoGcVinGbXdp4srxGUpX5j2lnHbTXnCSkt7fVwQ1YVUzGUw9+g== 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=1724435922; 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=7/nkUUTV61pcLhXiLmb8UQnbtoTXNhaQ0xxfmhGoq00=; b=VwVM55B+c6MpjfwKhKcoyQ9v1huiFbiJTQsyAVh6qO84eDyL5Wk1sVNoYq52xV6UxWBgXy zhgYB9tS7RnpJhwmDI4tHudUnV2yiI6CGTRhEP9SPMszCdDrmCyBkx7OY1Jz3/mTHgc30L ODUoNqiShCbtZGPpCeJ8Lw/uA/wTh3KGOJGU0/iWJqfCE7s9sClq1XpK9zz+pfFCZosnP0 B3GnkBrWKFu5BvUXcnR2yi0fV7d3K3sBwqJHv9SX9IZbBkDMFd5g6aAB4FWi9vSjhs/IwA 6SUuupXixu2j4DmVU+oFmgrxHfDsJtiORDhIrAvogfIX+jo3rwL9liS/WTFKMA== 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 4Wr79G6D96zLSM; Fri, 23 Aug 2024 17:58:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47NHwgav002320; Fri, 23 Aug 2024 17:58:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47NHwgLQ002317; Fri, 23 Aug 2024 17:58:42 GMT (envelope-from git) Date: Fri, 23 Aug 2024 17:58:42 GMT Message-Id: <202408231758.47NHwgLQ002317@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 70174ef7d2c8 - main - proccontrol: make -s require a target List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 70174ef7d2c80abdfca0e3ad9d0bb1af61318542 Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=70174ef7d2c80abdfca0e3ad9d0bb1af61318542 commit 70174ef7d2c80abdfca0e3ad9d0bb1af61318542 Author: Brooks Davis AuthorDate: 2024-08-23 17:57:59 +0000 Commit: Brooks Davis CommitDate: 2024-08-23 17:57:59 +0000 proccontrol: make -s require a target Require a command to exec or a pid to target and update usage and the manpage to make this more clear. It makes no sense to invoke a procctl(2) command on the current process only to exit. Users are sometimes confused about how proccontrol works and think it effects their shell environment when invoked without a target. Disallowing this nonsensical behavior and clarifiying usage will hopefully reduce confusion. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D46422 --- usr.bin/proccontrol/proccontrol.1 | 7 +++++-- usr.bin/proccontrol/proccontrol.c | 14 ++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/usr.bin/proccontrol/proccontrol.1 b/usr.bin/proccontrol/proccontrol.1 index 7ab917e4a61f..ee71c3200b1a 100644 --- a/usr.bin/proccontrol/proccontrol.1 +++ b/usr.bin/proccontrol/proccontrol.1 @@ -34,9 +34,12 @@ .Sh SYNOPSIS .Nm .Fl m Ar mode -.Op Fl s Ar control -.Op Fl q +.Fl s Ar control .Fl p Ar pid | command +.Nm +.Fl m Ar mode +.Fl q +.Op Fl p Ar pid | command .Sh DESCRIPTION The .Nm diff --git a/usr.bin/proccontrol/proccontrol.c b/usr.bin/proccontrol/proccontrol.c index 4b7543d63793..be78e14fd75e 100644 --- a/usr.bin/proccontrol/proccontrol.c +++ b/usr.bin/proccontrol/proccontrol.c @@ -81,10 +81,14 @@ str2pid(const char *str) static void __dead2 usage(void) { - - fprintf(stderr, "Usage: proccontrol -m (aslr|protmax|trace|trapcap|" - "stackgap|nonewprivs|wxmap"KPTI_USAGE LA_USAGE") [-q] " - "[-s (enable|disable)] [-p pid | command]\n"); + fprintf(stderr, "Usage:\n"); + fprintf(stderr, " proccontrol -m mode -s (enable|disable) " + "(-p pid | command)\n"); + fprintf(stderr, " proccontrol -m mode -q [-p pid]\n"); + fprintf(stderr, "Modes: " + "aslr|protmax|trace|trapcap|stackgap|nonewprivs|wxmap" + KPTI_USAGE LA_USAGE + "\n"); exit(1); } @@ -157,6 +161,8 @@ main(int argc, char *argv[]) usage(); pid = getpid(); } else if (pid == -1) { + if (!query) + usage(); pid = getpid(); }