After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 772605 - [review] ubsan reports unaligned access to stats64 members in nm-linux-platform.c [bg/platform-unaligned-stats64-bgo772605]
[review] ubsan reports unaligned access to stats64 members in nm-linux-platfo...
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks: nm-review
 
 
Reported: 2016-10-08 12:48 UTC by Beniamino Galvani
Modified: 2016-10-14 09:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Beniamino Galvani 2016-10-08 12:48:38 UTC
The undefined behavior sanitizer complains with:

platform/nm-linux-platform.c:1482:31: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
                  ^
platform/nm-linux-platform.c:1483:29: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
                  ^
platform/nm-linux-platform.c:1484:31: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
                  ^
platform/nm-linux-platform.c:1485:29: runtime error: member access within misaligned address 0x61a000016fac for type 'struct rtnl_link_stats64', which requires 8 byte alignment
0x61a000016fac: note: pointer points here
  bc 00 17 00 bf 05 00 00  00 00 00 00 bf 05 00 00  00 00 00 00 b5 68 02 00  00 00 00 00 b5 68 02 00
Comment 1 Beniamino Galvani 2016-10-08 12:52:41 UTC
Fix in branch bg/platform-unaligned-stats64-bgo772605.
Comment 2 Thomas Haller 2016-10-09 14:27:04 UTC
usually, all our code in a header file should have "nm" prefixes. But I think for stuff that is taken as a whole from somewhere else, there is value in leavin it in it's unmodified form (unless the form has come issues). Then, we can diff the file with the origin, and possibly re-import a newer versions without having conflicts.

The prime example for this is shared/nm-utils/gsystem-local-alloc.h, which is unmodified from libgsystem.

A counter-example is shvarFile.h, for how it should not be done: we kept the non-nm-names, but heavily modified the files that were originally imported. I think that is wrong, because as we already modify shvarFile.h, we could just as well adjust the coding style.

I would take src/basic/unaligned.h as-is, without any modification.
Comment 3 Beniamino Galvani 2016-10-10 09:51:54 UTC
(In reply to Thomas Haller from comment #2)
> I would take src/basic/unaligned.h as-is, without any modification.

Fair enough, branch updated.
Comment 4 Thomas Haller 2016-10-10 10:52:36 UTC
lgtm