From nobody Fri Sep 18 18:05:00 2026 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 4hmgWc276wz6snZN for ; Fri, 18 Sep 2026 18:05:00 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hmgWc1TNhz4LM9 for ; Fri, 18 Sep 2026 18:05:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789754700; 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=IuhlDGjzRFEumAgMGwy59JzGlkx85/N5S9y01iNvSnI=; b=g/iVs8ycY30+rUpJ02rWCpNZyRL8UKwKGUHudd7cCuP1fP0+hJss4KYtd2YxTmUBilHKlX KOF6NdioZqqGZT54V83L3H4DYwK554pKJhoJcsWIuRiD+NmwmZnLwzo1bEuV57cxn84Fqn W7OHe4okiUz3IQ7qOYNDaiNgpt/9WSDb3KwlTlYcIuXzOpm0e+7d0RT8UtpEpSaJjtR6RC N6GnQnC4KAqgSmJcWlw8SsMXdBV9OUV2nUsLhP5vMjXj3xaVks/NLTXSaCEZOCbnfz87Dx BHg3VhNUv///a1dBL3rgAp1xlYsQBFQEchjhdaYPiYgAF+FOfjQwzx5HYTtpsQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789754700; b=TTuSGNM28cyGFK6n9r9x0gQyc3Zsl52XwcejzUTeye2wYr36BJRPU3rseFAU++5IJeyW5R u5JQN7zbiWDLk7CzoLvUht9wfQsa99ZYGBB2oMgLUpNnDjyRb+IJt7SN7i9ugYmKIJ3SbD 2Gv4MzjreD/MjFvvnHC3YqIf2xR3U97TO8IalF7TmAvYmZl+cit1H3OieMCAPFdkJsb9Qx w6Do53S90NopZ+LivtcXNL7n/WsFX1oEx0rR7Qt2e8kX2nbajVqfgghvf9oG9qTuB4bEE8 qsgUvZlHHm21IlDMn8y9zEkx0Gixt/DQpYJ0Fsut7pTBdFiozJ6YnKKP8dARlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789754700; 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=IuhlDGjzRFEumAgMGwy59JzGlkx85/N5S9y01iNvSnI=; b=neWLezeEL/2H3od69lm9/Zn3sJwNpVGzU1iFoUUKxZMwmp9omBJVj5EG4DC7itDx0VcE7y 3Wa+RXhcSqa95WwXUyAi7TAFyhdiTV4UErPAagVia5jcnu0tK2r7zw6N8WDDj74/HX9/Xl 7MwZ5QllRwOdXz201RDpAfbmvlDp+Xs8GpI0/yEepN9wpppB11B1ev2rmAFRMuQxOjyGCz 8ke/E8Va3jl7qwMSeU2pT5GrUC9dtUChHoH3EgXUEpNi/MY7Ww5XnaXG/OiyTKLHNZEP7w lkjDRbaCd27mdgnUK2Ng+SmAN6bQEfLyyXfJDM0NSZb2SbOgbSULWZro64LUsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hmgWc0XfHzV9M for ; Fri, 18 Sep 2026 18:05:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31afd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 18 Sep 2026 18:05:00 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando Apeste=?utf-8?Q?gu=C3=ADa?= Subject: git: f014795ec3bd - main - virtual_oss(8): Fix cuse.ko check 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f014795ec3bd5efb88dfc249599e9665dc10a59e Auto-Submitted: auto-generated Date: Fri, 18 Sep 2026 18:05:00 +0000 Message-Id: <6aad7d4c.31afd.55695664@gitrepo.freebsd.org> The branch main has been updated by fernape: URL: https://cgit.FreeBSD.org/src/commit/?id=f014795ec3bd5efb88dfc249599e9665dc10a59e commit f014795ec3bd5efb88dfc249599e9665dc10a59e Author: Fernando ApesteguĂ­a AuthorDate: 2026-09-16 15:22:54 +0000 Commit: Fernando ApesteguĂ­a CommitDate: 2026-09-18 18:00:37 +0000 virtual_oss(8): Fix cuse.ko check virtual_oss(8) checks if cuse(3) is loaded. However, kldload(2) ends up calling kern_kldload that checks permissions first. It is only later on in linker_load_module that -EEXIST is returned if the module is already loaded. That means that users that can't load modules, always get a -EPERM error first even if cuse.ko is already loaded and ready to use. Change it to check if the kernel module is already loaded and try load it if it isn't. In addition move the program's arguments parsing early on because otherwise, a user can't even access the program's help if cuse.ko is not loaded and the user doesn't have permissions to do it. Approved by: obiwac@ Differential Revision: https://reviews.freebsd.org/D59621 --- usr.sbin/virtual_oss/virtual_oss/main.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/usr.sbin/virtual_oss/virtual_oss/main.c b/usr.sbin/virtual_oss/virtual_oss/main.c index 1b03e2c8cf37..41658d0af325 100644 --- a/usr.sbin/virtual_oss/virtual_oss/main.c +++ b/usr.sbin/virtual_oss/virtual_oss/main.c @@ -2564,6 +2564,7 @@ int main(int argc, char **argv) { const char *ptrerr; + const char *cuse_mod = "cuse.ko"; struct sigaction sa; struct cuse_dev *pdev = NULL; struct virtual_profile *pvp; @@ -2583,9 +2584,17 @@ main(int argc, char **argv) atomic_init(); - if (kldload("cuse.ko") < 0 && errno != EEXIST) - err(1, "Failed to load cuse kernel module"); + ptrerr = parse_options(argc, argv, 1); + if (ptrerr != NULL) + errx(EX_USAGE, "%s", ptrerr); + + if (kldfind(cuse_mod) < 0 && errno == ENOENT) { + /* module is not loaded */ + if (kldload(cuse_mod) < 0 && errno != EEXIST) + err(1, "Failed to load cuse kernel module"); + } + /* cuse is loaded, initialize it */ if (cuse_init() != 0) errx(EX_USAGE, "Could not connect to cuse module"); @@ -2599,9 +2608,6 @@ main(int argc, char **argv) if (sigaction(SIGTERM, &sa, NULL) < 0) err(1, "sigaction(SIGTERM)"); - ptrerr = parse_options(argc, argv, 1); - if (ptrerr != NULL) - errx(EX_USAGE, "%s", ptrerr); if (voss_dsp_rx_device[0] == 0 || voss_dsp_tx_device[0] == 0) errx(EX_USAGE, "Missing -f argument");