RFC: Hybrid (wineserver / process-local) native semaphores

Daniel Santos daniel.santos at pobox.com
Sat Sep 12 08:02:36 CDT 2015


On 09/12/2015 05:50 AM, Stefan Dösinger wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Am 2015-09-12 um 10:01 schrieb Daniel Santos:
>> do'h! I found the problem. Apparently you cannot use the posix
>> library to open a semaphore in a 32-bit program that you created in
>> a 64-bit program -- it doesn't assure that you're speaking the same
>> ABI. I'm really rather relieved that the problem isn't something
>> more deeply buried.
> Am I misunderstanding something, or doesn't that mean your approach
> won't work for a WoW6432 wine build?
>

Well, more specifically this approach using glibc's implementation of 
posix semaphores will not work for a build with both 32 and 64 bits. The 
implementation uses a different data structure depending upon rather 
you're building with 32 or 64 bits, but when you create a semaphore in a 
64 bit program and pass that name to a 32-bit program it still lets you 
open it, even though the struct isn't compatible. So that's why its 
failing. It might be a bug in glibc, depending upon how they've 
documented it.

It should still work with sysv semaphores. I could also write my own 
semaphore and use that in shared memory (like the glibc implementation) 
to avoid the syscall overhead but that would still leave us with the 
problem of exposing the wineserver to potential corruption, so I think 
I'll just stick with the sysv route for this proof-of-concept for now. 
We were discussing various other ways to solve this problem in chat, but 
I'll have to write out what I came up with later.

Daniel



More information about the wine-devel mailing list