Page MenuHomeFreeBSD

uiomove_*: centralize the copy function selection
ClosedPublic

Authored by brooks on Fri, Jun 19, 9:27 PM.
Tags
None
Referenced Files
F160251566: D57688.id180197.diff
Mon, Jun 22, 2:04 PM
F160187240: D57688.id180233.diff
Mon, Jun 22, 12:28 AM
Unknown Object (File)
Sun, Jun 21, 6:43 PM
Unknown Object (File)
Sun, Jun 21, 6:21 PM
Unknown Object (File)
Sat, Jun 20, 3:30 AM

Details

Summary

Add an inline uiomove_docopy() for the central set of switch statements
which choose between userspace and kernel and if data is going to or
from the iovec.

While here, switch from bcopy to memcpy.

Sponsored by: Innovate UK

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 74074
Build 70957: arc lint + arc unit

Event Timeline

With CHERI we'll be adding to variants of UIO_READ/UIO_WRITE that preserved pointer provenance and centralizing the definitions will make adding that a lot cleaner.

sys/sys/_uio_common.h
43 ↗(On Diff #180110)

I'm not totally convinced this needs to be inlined. It might be better to just make it a function in subr_uio.c.

sys/sys/_uio_common.h
43 ↗(On Diff #180110)

I support this.

Also I think that the name might be changed to reflect that this is a iovec component processing, like uiomove_step() or something better.

  • Rename to uiomove_step to move to subr_uio.c
  • Pass struct uio * as the last argument (similar to other functions) instead of separate segflg and rw arguments
sys/arm/arm/uio_machdep.c
96

Don't 'goto out' leak sfbuf? For arm this matter.

sys/i386/i386/uio_machdep.c
96

Same leak, it seems.

sys/powerpc/powerpc/uio_machdep.c
102

sfbuf leak

sys/riscv/riscv/uio_machdep.c
123

Now it is not sfbuf leak, but the transient map leak, which is pre-existing bug in the code.

Fix sfbuf and transient map leaks

sys/amd64/amd64/uio_machdep.c
106

Could 'goto out' be replaced by break?

113–114

With the new organization, do we still need the unmap on the return path?

Drop gotos.

Remove the gratutious post-loop pmap_unmap_io_transient's.

This revision is now accepted and ready to land.Sat, Jun 20, 8:39 PM