-
Notifications
You must be signed in to change notification settings - Fork 36
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
the use of plfs_getxattr relies upon the user knowing the length of the extended attribute #335
Comments
Consensus from comments in 331 suggest adding another argument to plfs_getxattr would be appropriate. Additional error checking should occur to make sure what the user passes as the length is big enough for the xattr. It doesn't look like we have any code that can determine the size of an already set xattr, so this would have to be developed. Probably in XAttr.cpp... |
On Thu, Dec 12, 2013 at 09:47:32AM -0800, David wrote:
prob just IOStore Stat() the key file...? st_size of the file would struct stat st; chuck |
Also add length as a parameter to setattr. getattr can discover length by stat'ing the file, no?
|
The client user should definitely not stat the file, as that's assuming a certain implementation and the implementation can change. It's safest to have a library call that should know the implementation get the value. Brett -----Original Message----- Also add length as a parameter to setattr. getattr can discover length by stat'ing the file, no?
— |
plfs_setxattr already has a required length parameter, so I don't think it needs to change: plfs_setxattr(Plfs_fd *fd, const void *value, const char *key, size_t len) It looks like we do follow POSIX's setxattr syntax as the return value for setxattr is 0 for success, -1 for failure, which is basically what our plfs_errno does. So I think we're ok here unless I have missed something. |
The client user would not be doing the stat. The stat would be done On Thu, Dec 12, 2013 at 12:47 PM, Brett Kettering
|
We should probably target this fix to go in to 2.6 since it will change the external API. |
Please see Issue #331 for where this behavior was noticed. In short, we are not following the capabilities of POSIX getxattr in that a user can find out how big the xattr is so that they can make sure they have enough memory for it. Right now, we rely on the user to provide the length of the attribute, which is somewhat naive. If the length is too small, we return a truncated value; if the length is too big, we read off the end of the file that houses the xattr (generates an error).
The text was updated successfully, but these errors were encountered: