Re: file offset corruption on 32-bit machines?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Bodo Eggert
Date: Friday, April 11, 2008 - 5:24 am

Diego Calleja <diegocg@gmail.com> wrote:


AS far as I understand, the race is e.g.:

fpos := A:a, we want to make process/thread a read A:b or B:a without it
being a correct value in fpos. a!=b!=c, A!=B, A!=C.

a: read fpos.high (A:?)
b: write fpos (B:b)
a: read fpos.low (A:b)


If you change this to 

a: read fpos.high
a: read fpos.low
a: read fpos.high
a: read fpos.low

and compare the results, you need to

a: read fpos.high (A:?)
b: write fpos (B:b)
a: read fpos.low (A:b)
b: write fpos (A:c)
a: read fpos.high (A:b),(A:?)
b: write fpos (C:b)
a: read fpos.low (A:b),(A:b)

That would be winning three races in order to hit the bug. 


OTOH, writers MUST NOT be interrupted, because:

b: write fpos.high (B:a)
a: read fpos.high (B:?)
a: read fpos.low (B:a)
a: read fpos.high (B:a),(B:?)
a: read fpos.low (B:a),(B:a)
b: write fpos.low (B:b)


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: file offset corruption on 32-bit machines?, Bodo Eggert, (Fri Apr 11, 5:24 am)
Re: file offset corruption on 32-bit machines?, Lennart Sorensen, (Fri Apr 11, 6:55 am)
Re: file offset corruption on 32-bit machines?, Bryan Henderson, (Fri Apr 11, 9:59 am)
Re: file offset corruption on 32-bit machines?, Lennart Sorensen, (Fri Apr 11, 10:15 am)
Re: file offset corruption on 32-bit machines?, Bryan Henderson, (Fri Apr 11, 2:29 pm)
Re: file offset corruption on 32-bit machines?, Pavel Machek, (Sat Apr 12, 1:48 am)
Re: file offset corruption on 32-bit machines?, Jan Kara, (Mon Apr 14, 9:20 am)
Re: file offset corruption on 32-bit machines?, Lennart Sorensen, (Mon Apr 14, 9:22 am)
Re: file offset corruption on 32-bit machines?, Jan Kara, (Mon Apr 14, 9:53 am)
Re: file offset corruption on 32-bit machines?, Alan Cox, (Mon Apr 14, 9:54 am)
Re: file offset corruption on 32-bit machines?, Lennart Sorensen, (Mon Apr 14, 10:06 am)
Re: file offset corruption on 32-bit machines?, Alexey Dobriyan, (Mon Apr 14, 11:34 am)
Re: file offset corruption on 32-bit machines?, Jan Kara, (Mon Apr 14, 12:03 pm)
Re: file offset corruption on 32-bit machines?, Lennart Sorensen, (Mon Apr 14, 12:29 pm)
Re: file offset corruption on 32-bit machines?, Jan Kara, (Mon Apr 14, 12:42 pm)
Re: file offset corruption on 32-bit machines?, Lennart Sorensen, (Mon Apr 14, 12:45 pm)
Re: file offset corruption on 32-bit machines?, Pavel Machek, (Tue Apr 15, 1:57 am)
Re: file offset corruption on 32-bit machines?, Lennart Sorensen, (Tue Apr 15, 8:32 am)
Re: file offset corruption on 32-bit machines?, Pavel Machek, (Tue Apr 15, 10:34 am)
Re: file offset corruption on 32-bit machines?, Lennart Sorensen, (Tue Apr 15, 11:24 am)
Re: file offset corruption on 32-bit machines?, Pavel Machek, (Tue Apr 15, 12:12 pm)
Re: file offset corruption on 32-bit machines?, Lennart Sorensen, (Tue Apr 15, 12:49 pm)
Re: file offset corruption on 32-bit machines?, Pavel Machek, (Tue Apr 15, 1:06 pm)
Re: file offset corruption on 32-bit machines?, Peter Zijlstra, (Tue Apr 15, 1:28 pm)
Re: file offset corruption on 32-bit machines?, Lennart Sorensen, (Tue Apr 15, 1:29 pm)
Re: file offset corruption on 32-bit machines?, Bryan Henderson, (Tue Apr 15, 3:11 pm)
Re: file offset corruption on 32-bit machines?, Pavel Machek, (Wed Apr 16, 1:15 am)
Re: file offset corruption on 32-bit machines?, Peter Zijlstra, (Wed Apr 16, 1:20 am)
Re: file offset corruption on 32-bit machines?, Jamie Lokier, (Wed Apr 16, 2:40 am)
Re: file offset corruption on 32-bit machines?, Alan Cox, (Wed Apr 16, 3:54 am)
Re: file offset corruption on 32-bit machines?, Lennart Sorensen, (Wed Apr 16, 6:57 am)