Re: rust_binder: use KVVec for files_to_translate

From: Alice Ryhl

Date: Sat Aug 29 2026 - 06:31:00 EST


On Fri, Aug 28, 2026 at 11:06 AM SCADA StrangeLove
<scadastrangelove@xxxxxxxxx> wrote:
>
> Thanks for the review!
>
> > One it looks like you're missing [PATCH] in the email title.
> > Also, as checkpatch points out, Suggested-by must be an email
> > address.
>
> Both fixed in v2 (sending shortly).
>
> > Also, should the close_on_free vector also be a KVVec?
>
> No -- close_on_free is 4 bytes/entry, matching the wire format, so its
> worst case is ~1,048,554 entries (~4 MiB, exactly SZ_4M - 88 bytes).
> That fits under KMALLOC_MAX_SIZE on every config rust_binder ships on
> today, but only because SZ_4M and KMALLOC_MAX_SIZE happen to coincide,
> not because anything enforces it -- if either constant changes, this
> stops being true. files_to_translate and reservations don't have that
> margin at all: they blow past 4 MiB at far lower fd counts because
> their per-entry kernel size is larger than the wire size, which is why
> those two need the fix regardless.

Sounds pretty fragile to me. Would be simpler to just use KVVec anyway
in case we add a target where KMALLOC_MAX_SIZE is smaller.

Alice