[Development] QSharedMemory POSIX implementation
Calogero Mauceri
mauceri at actgate.com
Wed Jul 9 17:32:29 CEST 2014
On 7/9/2014 5:22 PM, Thiago Macieira wrote:
> On Wednesday 09 July 2014 16:17:38 Calogero Mauceri wrote:
>> Hi all,
>>
>> I find QSharedMemory very useful, and I'm extensively using it for cross
>> platform IPC.
>>
>> I noticed in the code (qsharedmemory_unix.cpp) there are two
>> implementations for that class, one using System V IPC and the other
>> using POSIX IPC (mmap). On both Linux and Mac versions of Qt, the System
>> V primitives are used and there is no way to compile Qt using the POSIX
>> implementation (-posix-ipc option is not available in configure).
>>
>> Is there any reason why the System V implementation is preferred? I'd
>> like to switch to the POSIX one to overcome limits in some platforms
>> where the maximum shared memory allowed is only 4MB.
> Warning: here there be dragons.
>
> That code path has probably not been compiled in years. Just patch your Qt to
> enable it.
>
> Note that POSIX memory sharing like that runs a huge risk. Never accept shared
> memory segments from untrusted applications, since they can crash you: all you
> need to do is use a file-backed segment of memory (as opposed to anonymous
> mmap) and then shrink the file. Linux is getting an extension to prevent that,
> called memory sealing, but I'm guessing Linux isn't your problem OS.
>
Thanks Thiago for your quick reply.
I did not know the POSIX implementation was not supported.
My main problems are on Mac systems, the default shared memory settings
there are very restrictive. I'll need to modify them somehow from my
application.
Thanks,
Calogero
--
Calogero Mauceri
Software Engineer
Applied Coherent Technology Corporation (ACT)
www.actgate.com
More information about the Development
mailing list