On Fri, Mar 01, 2002 at 01:37:27PM -0500, Jeff Trawick wrote: > > Yes, I completely agree that each structure needs to be 64-bit aligned. > > I don't see how the shared memory code itself is incorrect. > > It is incorrect because it is returning addresses that aren't 64-bit > aligned. > > This code is in error: > > /* metadata isn't usable */ > new_m->usable = (char *)new_m->base + sizeof(apr_size_t); > > given that new_m->usable is returned to the application as storage > that it can use. > > My test program was intended to show a SIGBUS where it does the same > thing that Apache is doing when it gets a SIGBUS. In my test > program's case, I added 4 to the result of malloc() to get storage > which wasn't aligned. In Apache's case, the code above to set > new_m->usable is doing essentially the same thing (adding 4 to a > properly-aligned value resulting in a storage address which is not > properly aligned).
Ah yes, I see what you mean now. Yes this is also a problem and should be aligned just like anything else. Can we put that alignment macro in a common place in APR, since it is not useful to apps and internals? -aaron
