Page MenuHomeFreeBSD

oce(4): Don't directly access usespace
ClosedPublic

Authored by brooks on Jun 13 2023, 9:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 22, 10:29 AM
Unknown Object (File)
Fri, Jun 21, 8:35 AM
Unknown Object (File)
Fri, Jun 21, 8:34 AM
Unknown Object (File)
Fri, Jun 21, 2:29 AM
Unknown Object (File)
Fri, Jun 21, 1:30 AM
Unknown Object (File)
Thu, Jun 20, 1:04 AM
Unknown Object (File)
Sun, Jun 16, 11:43 PM
Unknown Object (File)
Mar 21 2024, 12:42 PM
Subscribers

Details

Summary

Replace direct stores to userspace address (never safe and broken on
modern CPUs) with a copyout. Use a static assert on the size to ensure
we don't overflow the field.

Sponsored by: DARPA

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This driver should probably be on the list of potential drivers to cull in 15. Other than quite a few bug fixes to ioctl handling it hasn't seen any non-sweeping commits since 2016.

This driver should probably be on the list of potential drivers to cull in 15.

Probably - are you willing to add the man page deprecation notice and gone_in?

This driver should probably be on the list of potential drivers to cull in 15.

Probably - are you willing to add the man page deprecation notice and gone_in?

D40531

sys/dev/oce/oce_if.c
2296

Probably we want to check for an error here? And not do anything if rc is already not equal to 0.

sys/dev/oce/oce_if.c
2282

Missing braces.

This revision is now accepted and ready to land.Jun 14 2023, 5:37 PM
jhb added inline comments.
sys/dev/oce/oce_if.c
2296

rc is known to be zero here I think. If rc was non-zero up at line 2275 (new) we jump to the error label. Similarly the new goto at 2282 means that rc is known to be zero here.

brooks added inline comments.
sys/dev/oce/oce_if.c
2296

The previous version didn't check the copyout return (I'd blindly copied the strncpy). I chose a slightly different strategy since falling through is ok here.

This revision was automatically updated to reflect the committed changes.
brooks marked an inline comment as done.