Em sex., 10 de out. de 2025 às 22:00, Kevin Reid <
kpr...@switchb.org> escreveu:
> On Fri, Oct 10, 2025 at 3:17 PM Vinícius dos Santos Oliveira <
vini.i...@gmail.com> wrote:
>> The proxy would just forward every call to oldfd. It can be used in any place where you'd use oldfd.
>
> You will need to think about whether any of the things doable using “every call” can be used to get separate, persistent access to something that outlasts the proxy. Presumably dup() doesn't, but also consider fd-passing and any wacky ioctls for strange device files. (I don't know whether FreeBSD has many of those.)
This is already solved by cap_rights_limit(). The revokerfd alone
can't be secure. For one, mmap() would be one of such things that is
difficult/impossible to revoke.
> In general, proxy-based revocation has to be either transitive (creating proxies for other capabilities passed through the proxy, becoming a membrane) or work with cooperating objects that don't have any operations that could bypass the revocability. (What exactly qualifies as correct cooperation depends on the application.)
For the suggested design, I was thinking of the former (transitivity).
>> revokfd_revoke would be called on the revoker fd (that you keep
>> private on your process and never pass around) and block until current
>> proxy operations return.
>
> What happens to the proxy fd if the revoker fd is closed? I think the answer should be that this is revocation, too, because that is robust against failure cases that could otherwise prevent revocation (e.g. the holder of the revoker fd crashing). But if so, you should also think about whether closing blocks, and if so, then whether closing is the only way to revoke.
Good point. Here's an idea:
As I drafted initially, revokfd_revoke() would block until current
operations abort/finish. That matters. When/if the proxy-creator
process crashes, fd will be closed, so it can't revoke anything.
However, the proxified fd will be closed still, so once current
operations (indirectly holding a strong ref to the original fd)
finish, the resource will be closed already.
I agree with you that it should mean revocation too.