This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Alignment trap question about eglibc 2.18


Hi,

I have encountered Alignment trap problem about Alignment trap on eglibc 2.18 and ARM A15 board.
And i think this problem exist in glibc 2.18 too.

The log messages:
[ 5462.945839] Alignment trap: test_aligned (11601) PC=0xb6e5096c Instr=0xe591a03c Address=0xb6f59259 FSR 0x221
[ 5462.945853] Alignment trap: test_aligned (11601) PC=0xb6e50970 Instr=0xe5b1b040 Address=0xb6f5925d FSR 0x221
[ 5462.945868] Alignment trap: test_aligned (11601) PC=0xb6e5097c Instr=0xe5912004 Address=0xb6f59261 FSR 0x221

The testcase:

#include <unistd.h>
#include <sys/mman.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <fcntl.h>

void main(void)
{
        volatile unsigned int i;
        void *dist;
        int fd = -1;

        fd = open("/dev/mem", O_RDWR | O_SYNC);
        if (fd < 0) {
                printf("open /dev/mem error.\n");
        }
        dist = mmap(0, 8192, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0xb9500000);   //0x95000000 is reserved memory address
        if (dist == MAP_FAILED) {
                perror("mmap error");
        }
        while (1) {
               memcpy(dist + 2097, dist, 2048);
        }
}

I have used gdb to trace the testcase, and fount it used the memcpy in memcpy_impl.S.
The memcpy_impl.S of eglibc 2.18 and memcpy_impl.S of glibc 2.18 are same.

Questions:

Is this a bug of glibc ?

If not, is that something wrong with me ?



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]