-
Notifications
You must be signed in to change notification settings - Fork 667
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
Use pass by value for write ioctls #626
Conversation
Can you give an example of a an ioctl that was improperly defined with the old macro? |
Using the following ioctl:
It is defined here: http://elixir.free-electrons.com/linux/latest/source/include/net/bluetooth/hci_sock.h#L68 By applying my patch, the ioctl finally worked, otherwise I got a enodev error. By comparing strace of a c program doing the same operation and my rust program, I saw that the difference was the last argument to ioctl. For the c strace it was just "0" and for the rust implementation it was a pointer. Are there any ioctl that expect a pointer? |
So it definitely seems that lack of test coverage is part of this problem. I'd like to see some tests included here that can confirm this works as expected. Is that possible to add some that will work in CI? |
Hmm, I think that you will need root access and CI will probably not give you root. ^^ |
Not necessarily. Plenty of ioctls don't require root access, for example terminal control ioctls. All we need here is test coverage for one ioctl of each type supported by the |
@bkchr Just wanted to ping you on this as we'd love to get this merged. |
Yeah I also would like to get this merged. I already searched for a list of ioctls that don't need root access, but the search was not successful. Does someone of you have a list of ioctls that I could use? I just need them and would add the test cases. |
@bkchr there's no master list of IOCTLs. Anybody can define a new one. But if you do "grep -R SIOC /usr/include" you should find plenty. |
I use the With the |
Good catch @bkchr. I'm OK with getting this merged without doing the additional work on tests off the bat since this does appear to be a problem. We might need to look at users of nix to see what the impact might be, but this could be a breaking change in some cases. I think the only other requirement before merging would be to add a note on the changing (and its breaking potential) to the CHANGELOG.md file. Looking at some of my own code using this, I see at least one case where I will need to update the calling code ( |
Yes, since this appears to be a bug, let's get this added to the list of Fixed changes. |
Okay I changed the Changelog :) I think that if you need a pointer for a write, you can use |
bors r+ |
Timed out |
bors r+ |
bors r- |
Canceled |
bors r+ |
Build succeeded |
The kernel expects that the values are passed by value and not by pointer for writing ioctls.