From nobody Wed Jun 03 08:04:59 2026 X-Original-To: freebsd-hackers@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 4gVgH04zF5z6gGjW for ; Wed, 03 Jun 2026 08:05:16 +0000 (UTC) (envelope-from oshogbo@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gVgH03vlWz3cT9 for ; Wed, 03 Jun 2026 08:05:16 +0000 (UTC) (envelope-from oshogbo@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780473916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BCMFzaXeOSAaCVecqrAM4dFKxqfC8rSJHLAUPkKTfdY=; b=Gov0Um+um3Mdu3wEdSKcABF4Bk3A2dh9Xutq3N6ADHhW8XXJS/dl19sDSF3YaZx92HbaBq 5UvcEmP1+opuT5tgjFzllDl0JHD43Utr+oKz5ofpbuWUyvFELjsQIRUfSx6FSJRTlGKVPy TU/tVdz7dgPbWXytKBKf9tJdR1DTiZLHb2B5cmRud66MQgWYf6QawFL77eOsMIwaD7ZfSG k5CVrR/+O2bXcH5LH+VNUPtBVq/rsOY1V81jWLV0H946fhyOQpZYGxWItdhaGAsEREC13t Vm3KuqXjMM5JijeJ5TpFldHw+6farPmkmRHTbDuVfSp4LyrtpJsc6gGW2i0CuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780473916; a=rsa-sha256; cv=none; b=eUm1cU3sLRi4zeJXwyctu291IHXSacp0B+w1uiKfUAa5t4eSXHkmTs4BqiIweTuAPe2t4P iN4cMeBgycX6lXm6i1Erjyi9tcxzZ5U7EeAF7bJz7NWzJSlL2BBxwpKA4TfU/EBckOevsv /y9PZV6/NCVGBRFJwD0DlM7OLlwnP+5sdF+jtxDPnDb/B0etpDHI3qu6iJ0g/qCbQ3Ak1E KcTTmUgEIIRvZYEkpP6ixCdD8FPFkhu1JlXwYVaI76b5wbsayp7PTAf7dWzvie23zzi3ST sQLhx7OnVlTs/Y4rjaexjXOK5SQLqo5/On6hbE5tpPd0heqztvBTZ0baCtMH2Q== 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=1780473916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BCMFzaXeOSAaCVecqrAM4dFKxqfC8rSJHLAUPkKTfdY=; b=hbBvkKLPdqwabOGR1Vzx9pDotN1eNSsAqvaz/N8ScTZWWxA/A5VJ5UC14OUOTsgWKUwOaZ kRO8xXXjxNJ0R5dwhc6YcVp+PQHkw2xsg12RmPmpKw0FxyIYIeIuPuVuvgBefVNYuvIz05 iKs+YKw1edtNTsAllq+n4uPDjPrpqdvoW1hWvH4zAuNLIwBzZPFvkj716GQMOIpbECENoa lSaZvHg0LBNqIwEUru0NpaZ539Ao+TpDRDVekye+J3hcspOr4EnbCkIbzTj+rqimF5mtmj yMH2pvXG5fJDvDsMkZfuDMyuj+cY8Obi8lmRO87jY2DmNjxiFywrNOKWRM98oA== Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) (Authenticated sender: oshogbo) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gVgH03RQxz8Bt for ; Wed, 03 Jun 2026 08:05:16 +0000 (UTC) (envelope-from oshogbo@freebsd.org) Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-5174363a843so5259791cf.1 for ; Wed, 03 Jun 2026 01:05:16 -0700 (PDT) X-Gm-Message-State: AOJu0YyxEQS/7KqGmujljA+ZPANm/8MzilqHm13aVmkAx2aiI6gIz2cj kvXrjDSp6MPf71L7Qh2VpRRPxx9W0B13kPghQkgWbPHnlOmtRms5jWdVw1XWhi6EqZ6nQvVi/6R mG6gTWkNPDXL9wCJou/2xAtQauK1pH70= X-Received: by 2002:ac8:5fc2:0:b0:516:ca56:a44d with SMTP id d75a77b69052e-517796ffb6emr25541671cf.6.1780473911187; Wed, 03 Jun 2026 01:05:11 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 References: <7f5f2137-bd4d-4e27-8049-cf585849103e@FreeBSD.org> In-Reply-To: <7f5f2137-bd4d-4e27-8049-cf585849103e@FreeBSD.org> From: Mariusz Zaborski Date: Wed, 3 Jun 2026 10:04:59 +0200 X-Gmail-Original-Message-ID: X-Gm-Features: AVHnY4KdrcelBVa1-s3z5JMglaorV4s-xhyyoLq14DkhMMeysobUYKZntajCOiw Message-ID: Subject: Re: rights(4) split? CAP_WRITE -> CAP_WRITE_DATA + CAP_WRITE_CTRL To: Kyle Evans Cc: "freebsd-hackers@FreeBSD.org" , freebsd-arch@freebsd.org, pjd@freebsd.org Content-Type: multipart/alternative; boundary="00000000000002207e065354e3ab" --00000000000002207e065354e3ab Content-Type: text/plain; charset="UTF-8" Hello, I think the idea of splitting CAP_WRITE into CAP_WRITE_DATA and CAP_WRITE_CTRL makes sense, especially for cases where a process should be able to exchange data but not transfer file descriptors. From my perspective, the biggest concern is the capability change itself. While source compatibility can largely be preserved by making CAP_WRITE an alias for CAP_WRITE_DATA | CAP_WRITE_CTRL, there is still some potential for compatibility issues with existing applications and binaries that rely on the current semantics of CAP_WRITE. Other than that, the use case seems reasonable, and being able to explicitly prohibit SCM_RIGHTS on a socketpair could be a useful hardening measure Thanks, Mariusz On Tue, 2 Jun 2026 at 20:19, Kyle Evans wrote: > Hi, > > I'm looking at an application where it would be useful to be able to > construct a socketpair(2) that can't be used to send fds over, out of an > abundance of caution. The application in prison0 is effectively a broker > between two jails that it hands each an end of the socketpair, then steps > out of the way -- I don't see a reason to leave it capable of carrying > SCM_RIGHTS. > > I'd like to propose splitting CAP_WRITE into CAP_WRITE_DATA and > CAP_WRITE_CTRL, with CAP_WRITE being an alias for DATA|CTRL. The caveat is > that I don't know if being able to revoke data but not control messages is > really feasible or useful, off-hand. > > In any event, my plan would be to use the last bit available in rights idx > 0 for the CTRL right, rename the current CAP_WRITE to CAP_WRITE_DATA, and > create a new CAP_WRITE name for the two combined. There's some chance for > breakage in applications that haven't been rebuilt with the new definition > of CAP_WRITE, but I suspect most of them aren't attempting to send control > messages. The in-kernel users of CAP_WRITE look like they could mostly be > scoped down to CAP_WRITE_DATA specifically, though maybe that gets a little > awkward in `flags_to_rights` mapping of O_WRONLY/O_RDWR. > > Thoughts? Terrible idea? > > Thanks, > > Kyle Evans > > --00000000000002207e065354e3ab Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

I think the idea of splitting CAP_= WRITE into CAP_WRITE_DATA and CAP_WRITE_CTRL makes sense, especially for ca= ses where a process should be able to exchange data but not transfer file d= escriptors.

From my perspective, the biggest concern is the capabili= ty change itself. While source compatibility can largely be preserved by ma= king CAP_WRITE an alias for CAP_WRITE_DATA | CAP_WRITE_CTRL, there is still= some potential for compatibility issues with existing applications and bin= aries that rely on the current semantics of CAP_WRITE.

Other than th= at, the use case seems reasonable, and being able to explicitly prohibit SC= M_RIGHTS on a socketpair could be a useful hardening measure

= Thanks,
Mariusz


On Tue, 2 Jun 2026= at 20:19, Kyle Evans <kevans@free= bsd.org> wrote:
Hi,

I'm looking at an application where it would be useful to be able to co= nstruct a socketpair(2) that can't be used to send fds over, out of an = abundance of caution.=C2=A0 The application in prison0 is effectively a bro= ker between two jails that it hands each an end of the socketpair, then ste= ps out of the way -- I don't see a reason to leave it capable of carryi= ng SCM_RIGHTS.

I'd like to propose splitting CAP_WRITE into CAP_WRITE_DATA and CAP_WRI= TE_CTRL, with CAP_WRITE being an alias for DATA|CTRL.=C2=A0 The caveat is t= hat I don't know if being able to revoke data but not control messages = is really feasible or useful, off-hand.

In any event, my plan would be to use the last bit available in rights idx = 0 for the CTRL right, rename the current CAP_WRITE to CAP_WRITE_DATA, and c= reate a new CAP_WRITE name for the two combined.=C2=A0 =C2=A0There's so= me chance for breakage in applications that haven't been rebuilt with t= he new definition of CAP_WRITE, but I suspect most of them aren't attem= pting to send control messages.=C2=A0 The in-kernel users of CAP_WRITE look= like they could mostly be scoped down to CAP_WRITE_DATA specifically, thou= gh maybe that gets a little awkward in `flags_to_rights` mapping of O_WRONL= Y/O_RDWR.

Thoughts? Terrible idea?

Thanks,

Kyle Evans

--00000000000002207e065354e3ab--