httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Slotmem patch for alignment
Date Mon, 17 Jan 2011 17:51:46 GMT
Hi,

I wrote a small patch fixing an alignment issue for mod_slotmem:

http://people.apache.org/~rjung/patches/mod_slotmem_shm_alignment.patch

The problem is: mod_slotmem uses a header for meta data before the 
actual data slots. The addresses used for the data slots are offset by 
the size of the meta data. Currently this size is divisible by 4 but not 
by 8 and thus the data put into the slots is only aligned at 4 byte 
boudaries. If there is data inside the slots needing 8 byte alignment, 
then the compiler can not arrange for that.

I fixed it by increasing the offset to the APR default alignment. Please 
check whether you think there's a problem with it. It tried it in 
combination with a separate proxy patch I'll post in a minute and both 
together fix the crashes observed on Solaris Sparc.

One additional remark: I didn't actually understand the original code lines:

    apr_size_t basesize = (item_size * item_num);
    apr_size_t size = sizeof(sharedslotdesc_t) +
                      (item_num * sizeof(char)) + basesize;

What's the reason for the "(item_num * sizeof(char))" part? I can't 
actually see, where this part of the memory is being used.

Regards,

Rainer


Mime
View raw message