Page MenuHomeFreeBSD

Move implementation of ioctls into kern_*() functions.
ClosedPublic

Authored by brooks on Mar 14 2018, 11:59 PM.
Tags
None
Referenced Files
F101853621: D14700.diff
Mon, Nov 4, 5:32 PM
Unknown Object (File)
Wed, Oct 30, 1:57 AM
Unknown Object (File)
Sep 22 2024, 12:41 PM
Unknown Object (File)
Sep 9 2024, 3:48 AM
Unknown Object (File)
Sep 9 2024, 12:17 AM
Unknown Object (File)
Sep 8 2024, 10:01 PM
Unknown Object (File)
Sep 7 2024, 7:54 PM
Unknown Object (File)
Sep 2 2024, 11:40 AM
Subscribers

Details

Summary

Move locks from outside ioctl to the individual implementations.

This is the first step of changing the implementations to act on a
kernel-internal request struct rather than on struct md_ioctl and to
removing the use of kern_ioctl in mountroot.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 15583
Build 15619: arc lint + arc unit

Event Timeline

cem added inline comments.
sys/dev/md/md.c
1776–1777

else break? Doesn't seem to be any point in continuing the loop once the output buffer is full. That can wait for a separate commit though.

This revision is now accepted and ready to land.Mar 15 2018, 12:34 AM

With this structure, I would expect the lock to be pushed into individual ioctl routines, in fact.

sys/dev/md/md.c
1747

Perhaps use the opportunity and return EFAULT if this copyout failed ?

I'll update following @kib's suggestions shortly.

sys/dev/md/md.c
1776–1777

The continued looping is to finish counting which is the ABI (both a count and a terminator, historically the terminator only existed if the set didn't fit). The ABI is broken by design and prior to r330880 the loop was a kernel buffer overflow.

sys/dev/md/md.c
1776–1777

If that's what it's for, it's broken now. We won't ever increment i again. Probably need else i++; or similar.

brooks added inline comments.
sys/dev/md/md.c
1776–1777

Oops, fixed in HEAD, will fix here.

  • Rebase
  • Return immediatly if copyout of md_label fails.
  • Move locking into command implementations.
  • Unconditionally increment count to preserve ABI.
This revision now requires review to proceed.Mar 15 2018, 4:49 PM
This revision is now accepted and ready to land.Mar 15 2018, 4:56 PM
brooks retitled this revision from Move implementation of ioctls into kern_*_locked() functions. to Move implementation of ioctls into kern_*() functions..Mar 15 2018, 5:00 PM
brooks edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.