From nobody Thu Nov 25 13:05:06 2021 X-Original-To: bugs@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 97B0D18B63D8 for ; Thu, 25 Nov 2021 13:05:06 +0000 (UTC) (envelope-from bugzilla-noreply@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 4J0J4y1m8nz4crS for ; Thu, 25 Nov 2021 13:05:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 18B441DF7F for ; Thu, 25 Nov 2021 13:05:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 1APD56r2046943 for ; Thu, 25 Nov 2021 13:05:06 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1APD56F0046942 for bugs@FreeBSD.org; Thu, 25 Nov 2021 13:05:06 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 259778] Capsicum failures can raise only SIGTRAP Date: Thu, 25 Nov 2021 13:05:06 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: theraven@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637845506; 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: in-reply-to:in-reply-to:references:references; bh=akhZ917OWEGc4XwylCJ6Pxq/OC29FHTDXWnqBBw1Ktc=; b=wUF4lw97Cqh9gPdXdGAtkXJsIEdX9b03BxT7XtgXwC2xBjP4jzY1slLg87pnmhGF22fJfV BNZ0aSoeYc2fHIih+48AO8lOf5MlPK0kaDKGvU8bdxR735cnP19o+o4l7AHzuWg4SMYCZ1 Wl4VRXoy6j3W1I4bx/6ye6TrJfqqIWkDhRTq+rzLVFM3qBDll0yIgvMaA8Cm914K1+htwy Os1/MJabbrG66W3t9wUdEnWLNxTzbi+mw388mo8A6+LIZbTy7n5E25A6YjXxq/1sjdaNG6 Bg53yWG9JIoBPmSt3xitvp6PBinUv16WhWIy/xY5kdyMfEGVEPIEljCuMQGUPQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637845506; a=rsa-sha256; cv=none; b=OUTA0pUcRvrld9Wb/H9blGaKJBgJwrmYHUsLJdD2UfnjJhSJm6XmQhU/tNcD8iQMcKytiO qa2q4IDYAqEGmCFRjpR3XyH5owfU8/FRLdCV7itEmc4J82aMkBsp3eOlwd257ykT2jwK8X 2qEVYzeQuivXfzb/uCgbqie8otO6+TTEZUohlLE3kNFpccWM1HaF++TQTkShvHzkFveirI 2wCyaIyWYRTpDOwMdL5cU7QdRK1POYCE93RaDNt/XmfC1VXAKqQXlQvkBVpPvx1PCfIWhF 5LJoa9zhknWw2bcQtu1rATch2xnAsmgO3LGIerI3bmKCyYg07y/m5AeMCZNG7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259778 --- Comment #3 from David Chisnall --- I have: 1. Added a new `procctl` verb `PROC_SIGCAP_CTL` that sets a bit in `p_flag2= `. 2. Added a SIGCAP that will be delivered on Capsicum violations. 3. Delivered SIGCAP if this bit is set, *after* delivering `SIGTRAP` (so th= at the debugger can see the failure and then the process can catch it). I am not sure if (3) is the correct sequence. When I'm debugging these thi= ngs I probably actually want to get the SIGTRAP after the SIGCAP, and only if t= he SIGCAP doesn't handle the failure, but I have no mechanism for signalling t= his to the kernel, so I'd most likely just stick a breakpoint at the end of my signal handler and ignore SIGTRAP entirely. Unfortunately, it turns out that I don't understand the signal delivery log= ic.=20 Calling `trapsignal` twice does not appear to work: If I request either sig= nal, everything works fine in my test program, but if I request both then my test fails. Unfortunately, the child process fails in startup with gdb attached= on -CURRENT. In a reduced test case, where I set both flags, then do `cap_enter` and `op= en` with trivial signal handlers that just print the signal that's delivered, I= see SIGTRAP arriving *before* SIGCAP. This is my modification to the syscall return path: https://github.com/davidchisnall/freebsd-src/blob/5329f8fc0bb881f9172c79009= 7c975f3429f6d67/sys/kern/subr_syscall.c#L225 I believe I need to do more to deliver two signals, synchronously, which is= why I didn't want to allow both mechanisms to exist, but I don't know what the extra work I need to do is and the `trapsignal` man page is not illuminatin= g. --=20 You are receiving this mail because: You are the assignee for the bug.=