-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cuse(4): COMPAT_FREEBSD64 support #2238
base: dev
Are you sure you want to change the base?
Conversation
@@ -1133,7 +1149,18 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd, | |||
|
|||
pccmd->entered = curthread; | |||
|
|||
*pcmd = pccmd->sub; | |||
#ifdef COMPAT_FREEBSD64 | |||
if (!SV_CURPROC_FLAG(SV_CHERI)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this up to between lines 1129 and 1130, then you don't need to check the ABI, you can just use the ioctl to determine it. Checking the ABI should only be done when the ioctls have the same encoding for both.
#ifdef COMPAT_FREEBSD64 | ||
if (!SV_CURPROC_FLAG(SV_CHERI)) { | ||
pcmd64 = (struct cuse_command64 *)data; | ||
pcmd64->dev = (uint64_t)pccmd->sub.dev; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When building a hybrid kernel, cc complains about a missing __cheri_addr
qualifier here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just use a uintptr_t
cast instead of a uint64_t
cast and then it will DTRT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have PTROUT for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm although that's using uintptr_t not uintcap_t (and you want the latter, as the former will be the same as uint64_t for hybrid kernels...)
pcmd64->dev = (uint64_t)pccmd->sub.dev; | ||
CP(pccmd->sub, *pcmd64, fflags); | ||
CP(pccmd->sub, *pcmd64, per_file_handle); | ||
CP(pccmd->sub, *pcmd64, data_pointer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per_file_handle
and data_pointer
are capabilities as well, presumably these assignments also want casts with __cheri_addr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uintcap_t doesn't need such annotations, it's always address rather than offset
Add COMPAT_FREEBSD64 needed for webcamd(8).