diff options
author | David Sterba <dsterba@suse.com> | 2016-09-12 11:13:24 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-09-21 11:50:05 +0200 |
commit | da64ae3a0f7498e356a72e7f1b65a704ddfbb6bc (patch) | |
tree | 86c0454b8a160700ddd78767ebdc086284592774 /extent_io.h | |
parent | f9309584bf9c58054d588077ba51d8123df54571 (diff) |
btrfs-progs: reorganize extent_buffer and fix alignment of data
Reported by UBSAN, the checksum code tries to access unaligned data that
come from the extent_buffer.
struct extent_buffer {
struct cache_extent cache_node; /* 0 48 */
u64 start; /* 48 8 */
u64 dev_bytenr; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
u32 len; /* 64 4 */
/* XXX 4 bytes hole, try to pack */
struct extent_io_tree * tree; /* 72 8 */
struct list_head lru; /* 80 16 */
struct list_head recow; /* 96 16 */
int refs; /* 112 4 */
u32 flags; /* 116 4 */
int fd; /* 120 4 */
char data[0]; /* 124 0 */
/* size: 128, cachelines: 2, members: 11 */
/* sum members: 120, holes: 1, sum holes: 4 */
/* padding: 4 */
};
Add explicit alignment to data.
Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=156471
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'extent_io.h')
-rw-r--r-- | extent_io.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/extent_io.h b/extent_io.h index d9594c32..208c4fea 100644 --- a/extent_io.h +++ b/extent_io.h @@ -97,7 +97,7 @@ struct extent_buffer { int refs; u32 flags; int fd; - char data[]; + char data[] __attribute__((aligned(8))); }; static inline void extent_buffer_get(struct extent_buffer *eb) |