pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmocore/+/41950?usp=email )
Change subject: osmo_io: Fix misaligment of iofd->cmsg used as struct cmsghdr
......................................................................
osmo_io: Fix misaligment of iofd->cmsg used as struct cmsghdr
Fixes following ASAN runtime error:
"""
src/stream.c:398:47: runtime error: member access within misaligned address
0x516000012b81 for type 'struct cmsghdr', which requires 8 byte alignment
0x516000012b81: note: pointer points here
51 00 00 00 30 00 00 00 00 00 00 00 84 00 00 00 01 00 00 00 00 00 00 00 00
00 00 00 00 00 00 03
^
"""
Related: OS#6905
Change-Id: Ia80dfc4dbffe85514b18dcf8d36b85bfafd76d64
---
M src/core/osmo_io_internal.h
1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/41950/1
diff --git a/src/core/osmo_io_internal.h b/src/core/osmo_io_internal.h
index c15262b..7900a44 100644
--- a/src/core/osmo_io_internal.h
+++ b/src/core/osmo_io_internal.h
@@ -170,8 +170,11 @@
/*! msghdr is in the cancel_queue list */
bool in_cancel_queue;
- /*! control message buffer for passing sctp_sndrcvinfo along */
- char cmsg[0]; /* size is determined by iofd->cmsg_size on recvmsg, and
by mcghdr->msg_controllen on sendmsg */
+ /*! control message buffer for passing sctp_sndrcvinfo along.
+ * Size is determined by iofd->cmsg_size on recvmsg, and by
mcghdr->msg_controllen on sendmsg.
+ * Alignment of the array is required due to cast to "struct cmsghdr",
eg. by CMSG_FIRSTHDR().
+ */
+ char cmsg[0] __attribute__ ((aligned(8)));
};
enum iofd_seg_act {
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41950?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia80dfc4dbffe85514b18dcf8d36b85bfafd76d64
Gerrit-Change-Number: 41950
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>