-
Notifications
You must be signed in to change notification settings - Fork 10
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
OFD locking broken on 32-bit Linux? #15
Comments
Is there a way to test this, e.g. some Docker image? Or is it unreliable, if you don't really run 32bit kernel? |
FYI, GHC also has the same in instance Storable FLock where
sizeOf _ = #{size struct flock}
alignment _ = #{alignment struct flock}
poke ptr x = do
fillBytes ptr 0 (sizeOf x)
#{poke struct flock, l_type} ptr (l_type x)
#{poke struct flock, l_whence} ptr (l_whence x)
#{poke struct flock, l_start} ptr (l_start x)
#{poke struct flock, l_len} ptr (l_len x)
#{poke struct flock, l_pid} ptr (l_pid x) EDIT: I'm tempted to wait until GHC has the patch (or shows it is not required). I think it still has way to run by not using |
Actually, there are no portability implications by definition; OFD locking is Linux specific and |
Yes, I know. Hence the mention of
Yes, see the GHC ticket. |
What that image is based on. It's manifest says I assume it's some Ubuntu variant, but I'm not running it on my machine without knowing for sure. |
The glibc bug seems to be fixed in 2.28 but on Ubuntu-18.04 it is
Can someone try on Ubuntu Eoan, it uses 2.30 https://packages.ubuntu.com/eoan/libc-bin, if it's so, then we can just use the To clarify: the fix for older glibc's shouldn't break newer ones. If we change |
As the workaround for now: compile |
My thought here is that we should probably just use |
If you're interested, I have
|
Broken upstream, see haskellari/lukko#15
Broken upstream, see haskellari/lukko#15
Broken upstream, see haskellari/lukko#15
Problem persists on Debian 11, Still needs If no proper fix to this is on the horizon, how about default-setting |
Previously, OFD locking was broken on 32-bit, because it would somehow end up using the 64-bit fcntl() function, but pass it 32-bit off_t values in struct flock. To fix this, tell libc to use always use 64-bit file offsets. This is the same fix that was applied for a similar issue in GHC[1]. [1]: https://gitlab.haskell.org/ghc/ghc/-/commit/9853fc5e3556e733b56976b0a2fce9e82130a9ef Fixes: haskellari#15
@leftaroundabout how did you test it. The #38 doesn't fail. I cannot reproduce the failure myself, so I cannot verify the fix either. |
@phadej I don't even remember what this issue was about or why it mattered to me, sorry. |
I suspect that OFD locking is broken on 32-bit Linux in both
lukko
andbase
.Specifically, we end up calling
fcntl64
yet use the 32-bitstruct flock
. glibc suffered a similar bug some years ago. The following patch works around the issue although I'm still investigating the portability implications:The text was updated successfully, but these errors were encountered: