[uClibc 0005464]: Memcpy forward copy breaks with unaligned transfers in memcpy(ARM)

bugs at busybox.net bugs at busybox.net
Mon Oct 20 07:54:07 UTC 2008


The following issue has been CLOSED 
====================================================================== 
http://busybox.net/bugs/view.php?id=5464 
====================================================================== 
Reported By:                upakul
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   5464
Category:                   Architecture Specific
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             10-17-2008 05:26 PDT
Last Modified:              10-20-2008 00:54 PDT
====================================================================== 
Summary:                    Memcpy forward copy breaks with unaligned transfers
in memcpy(ARM)
Description: 
Hi all,

The issue observed is that if we try to do unaligned transfers in the case
of forward copy it raises an error. However everything works fine in the
case of backward copy. 

To reproduce write a simple program like:

#include <stdio.h>
#include <string.h>
#include <sys/time.h>

static volatile char dst[4*1024*1024+64],src[4*1024*1024+64];

int main(int argc, char **argv)
{
   int i, count=atoi(argv[2]);
   char *newsrc = (char *)( ( ( ((int)&src[31])/32 )*32) +
atoi(argv[1]));
   char *newdst = (char *)( ( ( ((int)&dst[31])/32 )*32) +
atoi(argv[1]));
   memset(newsrc,'A',4194304); 
   memset(newdst,'B',4194304); 
   for (i=0;i<count;i++)
   {
     memcpy(newdst, newsrc, 4194304);
   }
   return 0;
}

Where argv[1] is the alignment. It will throw error if alignment is 1,3
and so on... However the same thing works fine in the case of backward
copy[To perform a backward copy, declare the buffers as static volatile
char src[4*1024*1024+64], dst[4*1024*1024+64];]
====================================================================== 

---------------------------------------------------------------------- 
 bernhardf - 10-17-08 05:41  
---------------------------------------------------------------------- 
You need to specify which version of uClibc you are using. 

---------------------------------------------------------------------- 
 upakul - 10-17-08 06:00  
---------------------------------------------------------------------- 
uClibc version used is 0.9.29

 

---------------------------------------------------------------------- 
 bernhardf - 10-17-08 06:05  
---------------------------------------------------------------------- 
ISTR that there were fixes in this area (0.9.27 is very old). Try a recent
version, I'd recommend to use trunk which will be released as 0.9.30
soon:
$ svn co svn://uclibc.org/trunk/uClibc 

---------------------------------------------------------------------- 
 upakul - 10-19-08 21:37  
---------------------------------------------------------------------- 
The issue is not visible with the latest version. 

Thanks. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-17-08 05:26  upakul         New Issue                                    
10-17-08 05:26  upakul         Status                   new => assigned     
10-17-08 05:26  upakul         Assigned To               => uClibc          
10-17-08 05:41  bernhardf      Note Added: 0013724                          
10-17-08 05:52  upakul         Note Added: 0013734                          
10-17-08 06:00  upakul         Note Edited: 0013734                         
10-17-08 06:05  bernhardf      Note Added: 0013744                          
10-17-08 06:06  bernhardf      version                   => 0.9.27          
10-19-08 21:37  upakul         Note Added: 0013854                          
10-20-08 00:54  bernhardf      Status                   assigned => closed  
======================================================================




More information about the uClibc-cvs mailing list