Introduce the allocuio() and freeuio() functions to allocate and deallocate
struct uio. This hides the actual allocator interface, so it is easier to modify
the sub-allocation layout of struct uio and the corresponding iovec array.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
I do not have much objections against this change, but I wonder what do you mean by 'changing the sub-allocation layout'. Note that uio->uio_iov is often modified during uio life, resulting in the pointer no longer pointing to the initial iov vector at the time of uio allocation.
This is originally motivated by a change in CheriBSD, where I modify the way struct uio is allocated. This specific patch reduces our diff.
In particular, the problem is the fact that the uio_iov sub-allocation may not be aligned enough and I don't think it can be solved with padding. The proper way to handle this in CheriBSD would be to use multiple allocations, which ensure that no overflow can occur between the struct uio fields and the iovec array. I have a separate patch where the cost of the double allocation is amortized by embedding a small iovec array into struct uio, which should cover most use-cases and satisfy the alignment/size requirements for a CHERI architecture. There I also handle the issue of changing uio->uio_iov during the uio life.
sys/kern/subr_uio.c | ||
---|---|---|
403 |
Do you have somebody to commit this for you?
If not, please mail me git-format-patches.