From nobody Tue Jun 17 19:42:00 2025 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 4bMHLx15gfz5pgWn; Tue, 17 Jun 2025 19:42:01 +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 4bMHLw6BZDz3Gl1; Tue, 17 Jun 2025 19:42:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750189320; 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=IhJzzmNlXQItOk7bSI0e1LiFhsfhcxeyPc6n3Kmj8e8=; b=Djx78JzciLGw7Vd1k1ualeR77cFR46CHHoa/n7XaWkWsxnx+Z/JBf2OtGF/wiKWjZOGALp tM7KqCXPxdWoHvVOE4DeHfw4kGkpmtMeVAVY6e/OVvyHHFNJMVcp56tQ11jV9SoHs6Laix tTArHMm3uIA8eESo3By/SN9l1Zxia/A99KHVIOh6aS9cetp+yg3xjNfy0QggL0Zhtz3sx1 D2+ggqOjQDhJRl8otJOq/qxoLF8yOcbWGF+Pd7PVVcYYsqkOALgXyo7MaxYBUCE47D+H/r NXpAkUaxMYwOJaVYzkPu80MDVpJ92Wj/9NRVs3yWKJF7SazlwU9i9TpBrODq5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750189320; 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=IhJzzmNlXQItOk7bSI0e1LiFhsfhcxeyPc6n3Kmj8e8=; b=m+Ii+6Hkm3e+7MRaTEt8YiBCfiCFznIMKOoNDhS1YAu0FfJToS9BPQc2YNyi00VIbeTkf2 h2BE+cGBRN8xyZGUDr9u7jSryW2zp82YH5Cv9TT2ovQCNPTJAaSV2wPK5ZzK/TmAXqGTJo UXU+NLixn6SPyyzlWv9VLKEK5/OjhFTvUShHHQAIkfhw8rVRV50wAhErKl7SWMghLDSNxc B6u6fmAkPFDPmJpmogXDUlW18uEJTWznM+KAvwRg0xobwh0X/wQ4IJxTkslEsy4m88HrAI EmFK+0GSi+D2mRj2WrSsz1SvAINeWi74tAyNr/sncdRUhqFqhv8MMcfVBoRp4Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750189320; a=rsa-sha256; cv=none; b=jmoeZ/9cr9U+HHmOWjBCLap0VVKf8TsJW6bBXhWt74/McPkz3poSrPWLzbErdwCliHJ7Jm Cnq6p368nzksAr2CTmwtWgke668RwXOpYwtZjWqqRbe9SZUzwIKkcHbUm2UsEgtCojRdMc tEvl2BGUDaI21Wq+OFG3l+J+sRhg3SXfsl6P1N+NJF58PFKUeus4ZocZjZwUaGJDGKu4+W bEjiVnQs3rUQ7qAI8bG/2lnPSz+mcDeeQLBdelN21NweDJi64IsVf3gMfSKDr7YH4gx2H2 BUKhri+bYayE0D1h/EYgFu038fkyXoPrTypn2z/NG9bOWcrGumJYsVupYRRA7g== 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 4bMHLw5kYNzxTZ; Tue, 17 Jun 2025 19:42:00 +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 55HJg0Aw094395; Tue, 17 Jun 2025 19:42:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55HJg0tH094392; Tue, 17 Jun 2025 19:42:00 GMT (envelope-from git) Date: Tue, 17 Jun 2025 19:42:00 GMT Message-Id: <202506171942.55HJg0tH094392@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 54eda43cc1e6 - main - beep: Capsicumize 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 54eda43cc1e6b1d73804b6c397a15002e3519555 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=54eda43cc1e6b1d73804b6c397a15002e3519555 commit 54eda43cc1e6b1d73804b6c397a15002e3519555 Author: Ed Maste AuthorDate: 2025-06-05 23:44:05 +0000 Commit: Ed Maste CommitDate: 2025-06-17 19:41:05 +0000 beep: Capsicumize While it's unlikely that beep(1) will be used in a context where a sandbox is particularly valuable, it does offer a simple demonstration of entering a capability sandbox after opening required fds, and is trivial to do. Reviewed by: christos Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50709 --- usr.bin/beep/beep.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.bin/beep/beep.c b/usr.bin/beep/beep.c index 0bdfe2cf97a7..9d274770ad75 100644 --- a/usr.bin/beep/beep.c +++ b/usr.bin/beep/beep.c @@ -25,6 +25,7 @@ #include +#include #include #include #include @@ -204,6 +205,9 @@ main(int argc, char **argv) if (f < 0) err(1, "Failed to open '%s'", oss_dev); + if (caph_enter() == -1) + err(1, "Failed to enter capability mode"); + c = 1; /* mono */ if (ioctl(f, SOUND_PCM_WRITE_CHANNELS, &c) != 0) errx(1, "ioctl SOUND_PCM_WRITE_CHANNELS(1) failed");