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

race condition in get_all #12

Closed
ThomasWaldmann opened this issue Aug 11, 2016 · 2 comments
Closed

race condition in get_all #12

ThomasWaldmann opened this issue Aug 11, 2016 · 2 comments
Labels

Comments

@ThomasWaldmann
Copy link

ThomasWaldmann commented Aug 11, 2016

  1. you first determine the size of the xattr list
  2. then you alloc a buffer of that size
  3. then you actually fetch the list into the buffer

if between 1 and 3 the xattr list changes in the filesystem, the call fails.

at other places in the code I've seen a while loop for such cases.

BTW, I was looking at your code because we just had such a race condition in our code, discovered in the wild, in practical use. (borgbackup has xattr code for linux, freebsd, osx).

@iustin
Copy link
Owner

iustin commented Oct 23, 2016

Thanks for the report! Cleaning this up properly could use some refactoring, I'll see what I can do.

@iustin iustin added the bug label Oct 23, 2016
@iustin iustin closed this as completed in 4cb3598 Oct 25, 2016
@ThomasWaldmann
Copy link
Author

great it is fixed.

it is a bit of a pity that such xattr code is not managed centrally and for all platforms in the stdlib. so everybody has to fall into same pitfalls and every implementation has its own drawbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants