Summary: | sys-fs/btrfs-progs-0.9.11 causes unaligned accesses | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Ben Peddell <lightspeed85> |
Component: | [OLD] Core system | Assignee: | Mike Gilbert <floppym> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | slyfox |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | ARM | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 371525 |
Description
Ben Peddell
2013-01-25 14:52:09 UTC
I don't plan to diverge from upstream in this package -- I'm not knowledgeable enough to know when it is safe to do so. Please continue to submit patches upstream. Actually, it looks like one of those patches landed upstream very recently: http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-progs.git;a=commit;h=0b0a954e4383d2074c499523e2aa89527e5ac053 Whoa! Instead of 4 alignment traps when running mkfs.btrfs, I now get 3234 alignment traps when using the default '-O2 -pipe' CFLAGS. When using the btrfs-progs default '-g -O1' CFLAGS, no alignment traps are encountered. It looks like gcc 4.5.4 optimizes out memcpy when it is copying 4 bytes and optimization level 2 is selected. e.g. one of the functions that got alignment errors is leaf_space_used in ctree.c It inlines btrfs_item_end_nr(l, start); That inlines btrfs_item_end(); That inlines btrfs_item_offset() and btrfs_item_size(), both of which use memcpy to try to avoid those alignment traps. I'll try a newer gcc, and see if this is still the case. I have submitted a patch upstream to attempt to resolve this. Looking at /usr/src/linux/include/linux/unaligned/memmove.h, they've known that memcpy gets optimized out by gcc for word-sized moves. Unfortunately, it seems that gcc 4.5.4 (and probably 4.6 and 4.7) also optimize out memmove for word-sized moves. Therefore my proposed patch uses the packed struct method of unaligned access. https://patchwork.kernel.org/patch/2051321/ Looking for btrfs-progs related bugs I've found this one. It seems that this version is gone from portage and mentioned patch in last post was queued by David Sterba for integration in 2013. Marking as FIXED. |