Unaligned memory access on linux 2.6.39 on x86

59 views Asked by At

I have a CGI which has some structures that are #pragma packed. It's working well on linux 2.6.33 but same CGI with same request is getting Aborted (segfault may be) when i boot linux 2.6.39 kernel.

If I remove the pragma packs the code is working on linux 2.6.39.

I am using Intel(R) Atom(TM) CPU D510.

What might be the reason ? Can I tune kernel so that the CGI will work.

Removing pragma packs is the last thing I want to do.(Its going to affect some other code)

The structure which is causing the problem is

#pragma pack(push, 1)
typedef struct some
{
    UINT    i1;
    string  s1;
    BYTE    b1;
    char    c1[MAX_LENGTH + 1];
    char    c2[MAX_LENGTH + 1];
    char    c3[MAX_LENGTH + 1];
    char    c4[MAX_LENGTH + 1];
    string  s2;
    UINT    i2;

    public:
    some()
    {
            i1 = MACRO;
            memset(c1, 0, sizeof(c1));
            memset(c2, 0, sizeof(c2));
            memset(c3, 0, sizeof(c3));
            memset(c4, 0, sizeof(c4));
    }

}       some, *pE;
#pragma pack(pop)
0

There are 0 answers