From nobody Thu May 21 17:34:34 2026 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 4gLwWt4vbcz6fWFt for ; Thu, 21 May 2026 17:34:34 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gLwWt3V4yz3QWV for ; Thu, 21 May 2026 17:34:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779384874; 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=aeO4ZMspi4vV0m59o5wcBimHDSbsPuEMaX9ro3uTBOI=; b=Qt3bg76IN2CI8oIhirmzRsa+iFUdhdJdYsclH6qkwFqG2RHcB/LhvHNpwmw5ECHWynd6VF 23Xv/sHRbyTJyaKgTUQFVNye5iWCc7PHlqTdSxIycycppTpqnl2MZNyY+YXsJLuRlYinw4 SidO9SX1fotXF3DZ7BUtcxxub1DbKL+kYh2W/7MqRtEIk31qeV515zhogTu5JWcmg3NSyh f1KIv+2OEVm7RlnjaTLQX2lW2rORcNKqhgg3kjoswN3szKO2rBaWrJPrVXTotZ25PDLmoG TfzbNKu+wGWETg1EGXZ1MO8VFr6pr+Ked69NgeS2qp+n0Gp3cVcqvYwW8z3DAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779384874; a=rsa-sha256; cv=none; b=DWx0ZNwlLW0hC9ggfup1nkGliLNKwTxWIJn3fJGxnlygVUm7qBs8kHjr5dtCYV1+ni2gWx FtU9AWhggBl7zWI+Me41V9jBTXj2NYx6zeUcMSGF4f9SQZj79LbvHTwvRRUMECifXGiY8r nftfhI6wCjQSmsLNwuiGxw+beoBSR/HcfF1A5C9vkOUTUnBqrS8mrEVtrQyCLFgl64ZOHm hfiQsGRoF8l7Z477pwJIsiCIyoBCs0cK6dPE1hv27pj1hDSk3sYNhrR5xP4i2+Js3oyMPC RU7n+D3OnBa97C/ePq1euRch0WboHBaTyWZPvQchLD/u2oy+0rCK5kFtU63xIQ== 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=1779384874; 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=aeO4ZMspi4vV0m59o5wcBimHDSbsPuEMaX9ro3uTBOI=; b=to2tCyJTJRM/La167FWyh9WqucHrefTWx/TFxPrsTN3ShGzT20pCqAaMa2p+sqipphjl1c NXQGfWe1/0HsIsetpMZ8Q9tOlqntUwZ6Smy1FBl8ssJPnuUlsT+iPGqK5caLiDJIR/63b9 ruqc356zmN94II759BtpzVvzTfrFk8++zMIw+BpR38oI6ZzPZFw3i7xfAy2BsyYjkz0MEy BklIe3d0wh9DR/Imic3unpHtyvyadTJNrLEfIf9yat656IwG4mlOY1wLkDRz0GHdW/DAkO nv6RvrFF54rcM8k4r2kJpnMVELEKbv+AF7EzQBatcV3CqVwKMylMlqfzlRzX/Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gLwWt2zYRzhtF for ; Thu, 21 May 2026 17:34:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2502c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 21 May 2026 17:34:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 5f904cb1b05c - main - virtual_oss(8): Create loopback devices with GID_AUDIO 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f904cb1b05c94453727abb606d6109fe504b10b Auto-Submitted: auto-generated Date: Thu, 21 May 2026 17:34:34 +0000 Message-Id: <6a0f422a.2502c.6b5ae719@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=5f904cb1b05c94453727abb606d6109fe504b10b commit 5f904cb1b05c94453727abb606d6109fe504b10b Author: Christos Margiolis AuthorDate: 2026-05-06 16:19:27 +0000 Commit: Christos Margiolis CommitDate: 2026-05-21 17:32:43 +0000 virtual_oss(8): Create loopback devices with GID_AUDIO Make sure the user is part of the audio group to avoid unintended snooping of loopback audio by unprivileged users. While here, retire voss_dsp_perm, since we don't use the same value everywhere now. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: emaste Pull-Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/26 --- usr.sbin/virtual_oss/virtual_oss/main.c | 27 +++++++++++++++++++++----- usr.sbin/virtual_oss/virtual_oss/virtual_oss.8 | 4 +++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/usr.sbin/virtual_oss/virtual_oss/main.c b/usr.sbin/virtual_oss/virtual_oss/main.c index 6a56adbc6075..1d24be89f3da 100644 --- a/usr.sbin/virtual_oss/virtual_oss/main.c +++ b/usr.sbin/virtual_oss/virtual_oss/main.c @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -1620,7 +1621,6 @@ int voss_is_recording = 1; int voss_has_synchronization; volatile sig_atomic_t voss_exit = 0; -static int voss_dsp_perm = 0666; static int voss_do_background; static int voss_baseclone = 0; static const char *voss_pid_path; @@ -1864,7 +1864,24 @@ dup_profile(vprofile_t *pvp, int *pamp, int pol, int rx_mute, { vprofile_t *ptr; struct cuse_dev *pdev; - int x; + struct group *gr; + gid_t gid; + int x, perm; + + if (!is_client) { + /* + * Loopback devices can be used only by users who part of the + * audio group, to avoid unintended snooping by unprivileged + * users. + */ + if ((gr = getgrnam("audio")) == NULL) + return ("getgrnam() failed"); + gid = gr->gr_gid; + perm = 0660; + } else { + gid = 0; + perm = 0666; + } rx_mute = rx_mute ? 1 : 0; tx_mute = tx_mute ? 1 : 0; @@ -1918,7 +1935,7 @@ dup_profile(vprofile_t *pvp, int *pamp, int pol, int rx_mute, /* create DSP character device */ pdev = cuse_dev_create(&vclient_oss_methods, ptr, NULL, - 0, 0, voss_dsp_perm, ptr->oss_name); + 0, gid, perm, ptr->oss_name); if (pdev == NULL) { free(ptr); return ("Could not create CUSE DSP device"); @@ -1935,7 +1952,7 @@ dup_profile(vprofile_t *pvp, int *pamp, int pol, int rx_mute, /* create WAV device */ if (ptr->wav_name[0] != 0) { pdev = cuse_dev_create(&vclient_wav_methods, ptr, NULL, - 0, 0, voss_dsp_perm, ptr->wav_name); + 0, gid, perm, ptr->wav_name); if (pdev == NULL) { free(ptr); return ("Could not create CUSE WAV device"); @@ -2612,7 +2629,7 @@ main(int argc, char **argv) if (voss_ctl_device[0] != 0) { pdev = cuse_dev_create(&vctl_methods, NULL, NULL, - 0, 0, voss_dsp_perm, voss_ctl_device); + 0, 0, 0666, voss_ctl_device); if (pdev == NULL) errx(EX_USAGE, "Could not create '/dev/%s'", voss_ctl_device); diff --git a/usr.sbin/virtual_oss/virtual_oss/virtual_oss.8 b/usr.sbin/virtual_oss/virtual_oss/virtual_oss.8 index b607f45cd369..b9dc8fd86a3c 100644 --- a/usr.sbin/virtual_oss/virtual_oss/virtual_oss.8 +++ b/usr.sbin/virtual_oss/virtual_oss/virtual_oss.8 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" -.Dd April 17, 2026 +.Dd May 7, 2026 .Dt VIRTUAL_OSS 8 .Os .Sh NAME @@ -162,6 +162,8 @@ This option should be specified before the -d and -l options. Create an OSS device by given name. .It Fl l Ar name Create a loopback OSS device by given name. +Users have to be part of the audio group to access this device. +This is a security measure to avoid unintended snooping by unprivileged users. .It Fl L Ar name Create a loopback OSS device which acts as a master device. This option is used in conjunction with -f /dev/null .