Skip to content
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

Bad length passed to client process in write operation #28

Closed
edouardklein opened this issue Apr 27, 2012 · 3 comments
Assignees
Milestone

Comments

@edouardklein
Copy link

@edouardklein edouardklein commented Apr 27, 2012

Hi,

I use a client (9pfuse from plan9port) that communicate with OSXfuse through a file descriptor. When doing a read on this file descriptor, this client expects the first 4 bytes to be an int whose value is the number of bytes read by the read operation (i.e. the return value of read).

This condition is not true when I create a new file on the file system, for example through the command :
echo Hello > /tmp/mntp/NewFile.txt

The value of the int is the length of the header (64), but what is read is the header plus the data (here 64+6 bytes).

I have a very, very ugly fix : adding the following at line 369 of fuse_device.c in kext :
(((struct fuse_in_header*)ftick->tk_ms_fiov.base)->len) = (__u32)(ftick->tk_ms_fiov.len) + (__u32)(ftick->tk_ms_bufsize);

With this, the specific client I use no longer crashes, but I think it breaks other things and it is not a proper fix.

Maybe the client is wrong, and FUSE behave correctly, I did not find the FUSE specifications. If anybody could point me to it, it woud be nice.

If this is indeed a problem, then I hope somebody more knowledgeable than me will be able to fix it.

@bfleischer

This comment has been minimized.

Copy link
Member

@bfleischer bfleischer commented May 7, 2012

Thanks for your bug report, Edouard. You are absolutely right, we need to take the size of the write buffer into account. The fix will be in the next OSXFUSE release.

@ghost ghost assigned bfleischer May 7, 2012
@bfleischer

This comment has been minimized.

Copy link
Member

@bfleischer bfleischer commented May 8, 2012

This should do it osxfuse/kext@091fe79

@bfleischer bfleischer closed this May 8, 2012
@edouardklein

This comment has been minimized.

Copy link
Author

@edouardklein edouardklein commented May 10, 2012

Thank you for having written the correct fix !

Le 08/05/12 05:42, Benjamin Fleischer a écrit :

This should do it osxfuse/kext@091fe79


Reply to this email directly or view it on GitHub:
#28 (comment)

bfleischer added a commit that referenced this issue May 28, 2012
* (framework) Use OSXFUSE logo as default volume icon

* (kext) Fix length of FUSE_WRITE message in strategy operation

  Closes issue #28: Bad length passed to client process in write operation

* (kext) Finish ticket reference counting

* (kext) Do not wait for an answer, if we are not interested in the result

* (kext) Fix race condition in fticket_aw_pull_uio (FT_A_BUF)

* (framework) Fix header search path

* (prefpane) Fix path of kernel extension

* (prefpane) Fix path of preferences file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.