Subject: Re: Dynamic limits for SysV semaphores and message queues
To: None <>
From: Mindaugas R. <>
List: tech-kern
Date: 10/07/2007 21:48:54
Greg Troxel <> wrote:
> The code mallocs a large area that is the sum of sizes, and then uses
> the sizes to grab sub-areas.  This does not guarantee that all of the
> sub-areas will have appropriate alignment for their data structures.
> For example, if the second area were char foo[17], the third area
> wouldn't even be byte aligned.  I don't know what's in all the structs,
> and they're probably all 8-byte aligned, but this seems in general
> not safe.

Hmm.. why not? The sizeof() and compiler should do the right thing. Also,
keep in mind that buffers are divided into the 8 byte segments, so there
cannot be something like char foo[17]. However, I still do not see how
aligning relates with safety here.. perhaps I miss something?..

You made me re-check the code, and I have found another bug :) The
recalculated value of msginfo.msgmax must be used while allocating.


P.S. The patch is updated.

Best regards,