Page MenuHomeFreeBSD

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

Authored by brooks on Mar 14 2018, 11:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 9, 3:48 AM
Unknown Object (File)
Mon, Sep 9, 12:17 AM
Unknown Object (File)
Sun, Sep 8, 10:01 PM
Unknown Object (File)
Sat, Sep 7, 7:54 PM
Unknown Object (File)
Mon, Sep 2, 11:40 AM
Unknown Object (File)
Sun, Sep 1, 3:41 AM
Unknown Object (File)
Thu, Aug 22, 3:06 AM
Unknown Object (File)
Jan 1 2024, 3:43 PM
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

cem added inline comments.
sys/dev/md/md.c
1776–1777 ↗(On Diff #40305)

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 ↗(On Diff #40305)

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 ↗(On Diff #40305)

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 ↗(On Diff #40305)

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 ↗(On Diff #40305)

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.