64bit accesses unaligned
Bryan Phillippe
bp at darkforest.org
Thu Aug 11 15:02:45 EDT 2011
Sorry about the attachment; trying again...
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libnl.unaligned.patch.txt
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20110811/9a1024e6/attachment.txt>
-------------- next part --------------
Here is the most significant part:
Index: src/lib/route/link.c
===================================================================
--- src/lib/route/link.c.orig
+++ src/lib/route/link.c
@@ -467,38 +467,48 @@ static int link_msg_parser(struct nl_cac
link->ce_mask |= LINK_ATTR_STATS;
}
if (tb[IFLA_STATS64]) {
- struct rtnl_link_stats64 *st = nla_data(tb[IFLA_STATS64]);
+ /*
+ * This structure contains 64bit parameters, and per the
+ * documentation in lib/attr.c, must not be accessed
+ * directly (because of alignment to 4 instead of 8).
+ * Therefore, copy the data to the stack and access it from
+ * there, where it will be aligned to 8.
+ */
...
Thanks,
--
-bp
On Aug 11, 2011, at 11:43 AM, Bryan Phillippe wrote:
> Hello,
>
> I'm using libnl-3.0 on an ARM processor and found a problem with unaligned accesses to 64bit variables. This patch explains what I found - what are your thoughts?
>
> <libnl.unaligned.patch>
>
> Thanks,
> --
> -bp
>
>
More information about the libnl
mailing list