Page MenuHomeFreeBSD

Remove the cloned file descriptors for /dev/crypto.
ClosedPublic

Authored by jhb on Nov 21 2020, 12:47 AM.
Tags
None
Referenced Files
F81693433: D27302.diff
Sat, Apr 20, 1:18 AM
Unknown Object (File)
Mar 8 2024, 8:21 AM
Unknown Object (File)
Mar 8 2024, 8:21 AM
Unknown Object (File)
Mar 8 2024, 8:20 AM
Unknown Object (File)
Mar 8 2024, 8:20 AM
Unknown Object (File)
Mar 8 2024, 8:20 AM
Unknown Object (File)
Mar 8 2024, 8:10 AM
Unknown Object (File)
Feb 3 2024, 1:24 AM
Subscribers

Details

Summary

Crypto file descriptors were added in the original OCF import as a way
to provide per-open data (specifically the list of symmetric
sessions). However, this gives a bit of a confusing API where one has
to open /dev/crypto and then invoke an ioctl to obtain a second file
descriptor. Character devices have gained support for per-open data
via cdevpriv since OCF was imported, so simply the userland API by
permitting ioctls directly on /dev/crypto descriptors.

To provide backwards compatibility, CRIOGET now opens another
/dev/crypto descriptor via kern_openat(). This preserves prior
semantics in case CRIOGET is invoked multiple times on a single file
descriptor.

Test Plan
  • old and new cryptocheck work on a new kernel
  • openssl speed from 1.1.1 now works (doesn't work currently as it doesn't use CRIOGET)
  • Drew tested an earlier version of this with openssl speed as well

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 35022
Build 32007: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Nov 21 2020, 12:47 AM
jhb created this revision.
markj added inline comments.
sys/opencrypto/cryptodev.c
1354

As part of an attempt to reduce the usage of volatile in preference of atomic(9), we now have a refcount_load() which should be used here.

1454

This is going to fail if the process has restricted filesystem access, e.g., if it's in a chroot or jail without /dev/crypto, or it's in capability mode. That seems acceptable, but might be worth a comment.

This revision is now accepted and ready to land.Nov 22 2020, 7:24 PM
  • Use refcount_load().
  • Note limitations of CRIOGET compat shim.
This revision now requires review to proceed.Nov 24 2020, 11:03 PM
jhb marked an inline comment as done.
  • Tweak the comment a bit further.
jhb marked an inline comment as done.Nov 24 2020, 11:06 PM
This revision is now accepted and ready to land.Nov 24 2020, 11:07 PM
This revision was automatically updated to reflect the committed changes.