** Description changed:

  Binary package hint: squashfs-tools
  
  mksquashfs.c currently accesses the following structures through
  misaligned pointers: at least the following:
  
  squashfs_base_inode_header *
  squashfs_dir_entry *
  squashfs_dir_header *
  squashfs_dir_inode_header *
  squashfs_ldir_inode_header *
  squashfs_reg_inode_header *
  squashfs_symlink_inode_header *
  unsigned short *
  
  I haven't checked the rest of this package, but there are likely to be
  issues elsewhere as well.
  
  Not all memory access instructions can access at unaligned addresses on
  ARM; GCC assumes that pointers are properly aligned for their type
  because attempts by a C program to access an lvalue via a pointer which
  is not properly aligned for the lvalue's type are not permitted under
  strict interpretation of the C language specification.
  
  Particularly when doing block transfers of whole structures (*obj_p_dest
  = *obj_p_src) and equivalent operations, LDM or STM instructions are
  emitted by the compiler: these _always_ fault into the kernel if the
  base address is unaligned, and can cause a significant performance hit.
  
  In addition, prior to Linux 2.6.31, the kernel cannot successfully
  emulate all misaligned LDM or STM instructions for Thumb ... leading to
  the SIGILLs which have been observed on the lucid buildds (2.6.28
  kernel) when moving to v7.
  
- 
  Possible workarounds:
-   * fix squashfs-tools to use strict C only (laborious... either build 
squashfs filesystem structures at true alignment and then copy them into place 
in the output, or 
-   * declare all the affected types with __attribute__ (( __packed__ )) so GCC 
knows the structures may be accessed at misaligned locations (care must be 
taken to make sure the structures' sizes and internal arrangement do not change 
as a result of this, and the resulting code may run significantly slower --- 
I've not checked for the implications of this.  Some other check is needed for 
unsigned short, or it must be wrapped in a structure or union type, because GCC 
cannot tag basic types with the __packed__ attribute)
-   * apply the appropriate LDM/STM emulation patches to the kernel used on the 
buildds (if feasible --- I'll try and feed back on this)
+   * Build squashfs-tools with -marm
+   * fix squashfs-tools to use strict C only (laborious... either build 
squashfs filesystem structures at true alignment and then copy them into place 
in the output, or
+   * declare all the affected types with __attribute__ (( __packed__ )) so GCC 
knows the structures may be accessed at misaligned locations (care must be 
taken to make sure the structures' sizes and internal arrangement do not change 
as a result of this, and the resulting code may run significantly slower --- 
I've not checked for the implications of this.  Some other check is needed for 
unsigned short, or it must be wrapped in a structure or union type, because GCC 
cannot tag basic types with the __packed__ attribute)
+   * apply the appropriate LDM/STM emulation patches to the kernel used on the 
buildds (if feasible --- I'll try and feed back on this)

-- 
[armel] non-ISO-C misaligned pointer punning causes slowness and SIGILLs
https://bugs.launchpad.net/bugs/494667
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to