From nobody Sun Apr 16 18:38:19 2023 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 4PzzTS1yKvz45ncy; Sun, 16 Apr 2023 18:38:20 +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 4PzzTS17Pdz4LNS; Sun, 16 Apr 2023 18:38:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681670300; 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=iyJVCB2+fah7emHXiCvYUXU7N1gi+rZJ4wBFke4EikM=; b=B/VwdVnhloIG2ouEJfYcnJNvGkQjtzZZkw41IxKAvkyXV25E+Sz/sllibWHunoZBsvAYtt Tji9nbSdj7KFtPfOzi4SW+OphMgeP9mViJEjfAQFtmCZ4kmMnAvNBzFq+supx8/B9xAkFX mlF1VtH3IVGSfH8NBvr0jPrva21apaTlZpbPFcqK3TTDxWYU4K8F955sV8//EgIcfupeDS WeNIaOkEz5NQC3JihOg0WpZq37agBJ9OsdAsuhN/Rtb7fUNCLJ+qlMax3//QnXXdwf4E74 8nnhaS68tyXaHvY3FoDxK3XzU7M83dk4qicfAFaP/rvCpZGPpkVg6TEliY9PkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681670300; 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=iyJVCB2+fah7emHXiCvYUXU7N1gi+rZJ4wBFke4EikM=; b=kVeb9xCeuHbPikvjkt+OgfgRZEtEV//je+h9+m1QwFbRdzvXYuSYAACcyRQ1JXT4T1WXQa GYLEft/uMpzMlQwbFWCYZajx9wJCti36AqI5hhUzR/eIJ99N7yrDBJL6srglyIbDuMtG3f Wh3tHpie4ritpK9JgleQMIMyBEdZ/HaJYtTxkm8nVxEZ+FsWiTJaDDhAvG4/kz9cq0rFbS YEJKL+jaV5wm9ZK8qrVEmNrICw1UrE5f2COgvu/Oh9nNef5ODdsLDoYXNXJyR4SEwnJB/A NpSe3TvmAFXaoLTdHH5syItTP2scLl/zvFO/0L4pGHBpN3RHSc5hcc02Pmpn3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681670300; a=rsa-sha256; cv=none; b=qEB5cl8iGmqgiQGoRAFQUa4PvFZT/gxihI0/CzwGTCbtGMzb2tiv39w9dNHiIEdS5vzE/V t0G9pnTn2oTECE2F9HY7SpilgJ80lCSMXA1L/rCLzupWTwPuD/Ss6wRGV/OpeH10jCx+MK ctf/7fF+shf/kaGAgNU/gNCI4EM2tipk+NXZdubQ1hb5xyS/+QNTEyx3uSA1p8nnpRgIU8 IPOvDsW6+1Kh8us3uIK2OhuEXSyNQ88bjMcgOXi7nZUG/fSh4broBlpr0BYZR/pf65FYlA 7jSoUtw1lOmJE8A+14w5Z1ROvRxsaPL5XYL3aeAxeWLM7vKE2wYSeZYu/hTImg== 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 4PzzTS08gKzxsT; Sun, 16 Apr 2023 18:38:20 +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 33GIcJfG079191; Sun, 16 Apr 2023 18:38:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33GIcJiX079190; Sun, 16 Apr 2023 18:38:19 GMT (envelope-from git) Date: Sun, 16 Apr 2023 18:38:19 GMT Message-Id: <202304161838.33GIcJiX079190@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Stephen J. Kiernan" Subject: git: 4819e5aeda4e - main - Add new privilege PRIV_KDB_SET_BACKEND 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: stevek X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4819e5aeda4ef1a193a08e29b4099c3c30369a81 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by stevek: URL: https://cgit.FreeBSD.org/src/commit/?id=4819e5aeda4ef1a193a08e29b4099c3c30369a81 commit 4819e5aeda4ef1a193a08e29b4099c3c30369a81 Author: Stephen J. Kiernan AuthorDate: 2023-04-16 03:59:52 +0000 Commit: Stephen J. Kiernan CommitDate: 2023-04-16 18:37:58 +0000 Add new privilege PRIV_KDB_SET_BACKEND Summary: Check for PRIV_KDB_SET_BACKEND before allowing a thread to change the KDB backend. Obtained from: Juniper Networks, Inc. Reviewers: sjg, emaste Subscribers: imp Differential Revision: https://reviews.freebsd.org/D39538 --- sys/kern/subr_kdb.c | 6 ++++++ sys/sys/priv.h | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c index ff981cdfe47c..8aae19b728c8 100644 --- a/sys/kern/subr_kdb.c +++ b/sys/kern/subr_kdb.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -484,6 +485,11 @@ int kdb_dbbe_select(const char *name) { struct kdb_dbbe *be, **iter; + int error; + + error = priv_check(curthread, PRIV_KDB_SET_BACKEND); + if (error) + return (error); SET_FOREACH(iter, kdb_dbbe_set) { be = *iter; diff --git a/sys/sys/priv.h b/sys/sys/priv.h index 20bfc7312ce3..cb4dcecea4aa 100644 --- a/sys/sys/priv.h +++ b/sys/sys/priv.h @@ -515,10 +515,15 @@ #define PRIV_KMEM_READ 680 /* Open mem/kmem for reading. */ #define PRIV_KMEM_WRITE 681 /* Open mem/kmem for writing. */ +/* + * Kernel debugger privileges. + */ +#define PRIV_KDB_SET_BACKEND 690 /* Allow setting KDB backend. */ + /* * Track end of privilege list. */ -#define _PRIV_HIGHEST 682 +#define _PRIV_HIGHEST 691 /* * Validate that a named privilege is known by the privilege system. Invalid