[ORLinux] Unaligned access exception in Linux 2.6.39 kernel

Stefan Kristiansson stefan.kristiansson at saunalahti.fi
Wed Jun 1 09:00:25 CEST 2011


> > 
> > On Tue, 2011-05-31 at 16:29 +0100, Jeremy Bennett wrote:
> > > The following test program consistently crashes Linux 2.6.39 with an
> > > unaligned access exception in wait_consider_task.
> > > 
> > 
> > What's your memory configuration?  I'm seeing the program segfault once
> > or twice before all the system memory seems to have been chewed up and
> > the program is killed by the out-of-memory reaper before it gets very
> > far at all...
> > 
> > Though there seems to be a memory allocation problem of sorts, I haven't
> > seen the kernel crash yet, unfortunately.  Will continue to investigate
> > this tomorrow.
> > 
> > /Jonas
> 
> I am seeing the same behaviour as you Jonas, with the addition that I get a couple of those before the oom-kill:
> Mismatch: data4 = "", res = -98
> Mismatch: data4 = "", res = -98
> 
> Stefan

To pinpoint this a bit more, the following (slightly modified) pthread example 
from wikipedia (http://en.wikipedia.org/wiki/POSIX_Threads)
is behaving badly as well.
I get segfaults and rc == 0 asserts.
----
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

#define NUM_THREADS     5

void *TaskCode(void *argument)
{
        int tid;

        tid = *((int *) argument);
        printf("Hello World! It's me, thread %d!\n", tid);

        /* optionally: insert more useful stuff here */

        return NULL;
}

int main (int argc, char *argv[])
{
        pthread_t threads[NUM_THREADS];
        int thread_args[NUM_THREADS];
        int rc, i, j;
        for (j = 0; j < 1000; j++) {
                printf("Iteration %d\n", j);
                /* create all threads */
                for (i=0; i<NUM_THREADS; ++i) {
                        thread_args[i] = i;
                        printf("In main: creating thread %d\n", i);
                        rc = pthread_create(&threads[i], NULL, TaskCode, (void *) &thread_args[i]);
                        assert(0 == rc);
                }

                /* wait for all threads to complete */
                for (i=0; i<NUM_THREADS; ++i) {
                        rc = pthread_join(threads[i], NULL);
                        assert(0 == rc);
                }
        }
        exit(EXIT_SUCCESS);
}
----
Stefan



More information about the Linux mailing list