Unaligned accesses in metatree code
Submitted by Pedro Beja
Assigned to gvf..@..e.bugs
Link to original bug (#726456)
Description
Forwarded from Debian-BTS: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=596054 by Michael Cree
The gvfs metatree code has misaligned accesses to 64 bit data. On the Alpha architecture this causes traps to the kernel to complete the memory access (i.e. very inefficient) and pollutes the kernel logs with messages. While not a show stopper it is nevertheless annoying, particularly as the gvfs library is linked in a number of other packages (such as nautilus and evince) and they are all generating unaligned trap messages in the kernel log.
I attach a patch that "fixes" the problem by providing a means to tell the compiler (provided it is gcc) that the access is misaligned at the specific points in the code, thus the compiler generates code that can access the datum without causing unaligned traps to the kernel. The patch is really just to illustrate where the problem occurs -- a better approach is probably to fix the "Journal Entry" in the code to contain the 64 bit data (the field "mtime" in the structure) on 64 bit boundaries. I noted a comment in the code that said the mtime field must be 32 bit aligned but didn't give any reasons why, so I decided not to risk modifying the alignment.
patch attached by Michael Cree