summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Kerola2019-07-14 11:17:32 +0200
committerSami Kerola2019-07-14 12:53:59 +0200
commitf55dd4cc2dadfa74e5a207a4058489fa4d10387a (patch)
treec2335b506b9ca3bba3bd17ca85a73ff1e3079d31
parentlibblkid: check number of test_blkid_save arguments correctly (diff)
downloadkernel-qcow2-util-linux-f55dd4cc2dadfa74e5a207a4058489fa4d10387a.tar.gz
kernel-qcow2-util-linux-f55dd4cc2dadfa74e5a207a4058489fa4d10387a.tar.xz
kernel-qcow2-util-linux-f55dd4cc2dadfa74e5a207a4058489fa4d10387a.zip
libblkid: fix address sanitizer issues
With aligned attribute many blkid tests fail with following error. So instead of aligning to 4K add padding that makes the struct same size without causing asan trip over. libblkid/src/superblocks/drbd.c:179:6: runtime error: member access within misaligned address 0x55913d7e6958 for type 'struct meta_data_on_disk_9', which requires 4096 byte alignment In zfs structure it seems compiler is adding padding, that does not mix well with be32_to_cpu() and other bit operations. libblkid/src/superblocks/zfs.c:109:23: runtime error: load of misaligned address 0x7ff6406540e4 for type 'uint32_t' (aka 'unsigned int'), which requires 8 byte alignment Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r--libblkid/src/superblocks/drbd.c2
-rw-r--r--libblkid/src/superblocks/zfs.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/libblkid/src/superblocks/drbd.c b/libblkid/src/superblocks/drbd.c
index 4ebaf1739..c27a8b384 100644
--- a/libblkid/src/superblocks/drbd.c
+++ b/libblkid/src/superblocks/drbd.c
@@ -109,7 +109,7 @@ struct meta_data_on_disk_9 {
struct peer_dev_md_on_disk_9 peers[DRBD_PEERS_MAX];
uint64_t history_uuids[HISTORY_UUIDS];
- char padding[0] __attribute__((aligned(4096)));
+ uint8_t padding[2704];
} __attribute__((packed));
diff --git a/libblkid/src/superblocks/zfs.c b/libblkid/src/superblocks/zfs.c
index 4d4b46d55..0af14fb65 100644
--- a/libblkid/src/superblocks/zfs.c
+++ b/libblkid/src/superblocks/zfs.c
@@ -58,7 +58,7 @@ struct nvuint64 {
uint32_t nvu_type;
uint32_t nvu_elem;
uint64_t nvu_value;
-};
+} __attribute__((packed));
struct nvlist {
uint32_t nvl_unknown[3];