Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jan 2022 23:33:58 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        freebsd-current <freebsd-current@freebsd.org>
Subject:   UBSAN report for main [so: 14] /usr/sbin/traceroute: various misaligned address reports
Message-ID:  <22B1E944-641D-4BD3-A4B2-384767D966FC@yahoo.com>
References:  <22B1E944-641D-4BD3-A4B2-384767D966FC.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I tried a /usr/sbin/traceroute from a chroot that had been built using
WITH_UBSAN=3D in use. It got the common lib/libc/stdio/fread.c zero =
offset
to null pointer notice but also reported "member access within =
misaligned
address" for types:

'struct ifreq', which requires 8 byte alignment

'union (unnamed union at =
/usr/obj/BUILDs/main-amd64-nodbg-clang-alt/usr/main-src/amd64.amd64/tmp/us=
r/include/net/if.h:398:2)', which requires 8 byte alignment

'struct sockaddr', which requires 8 byte alignment

'unsigned char', which requires 8 byte alignment

The reports are:

/usr/main-src/lib/libc/stdio/fread.c:133:10: runtime error: applying =
zero offset to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior =
/usr/main-src/lib/libc/stdio/fread.c:133:10 in=20
/usr/main-src/contrib/traceroute/ifaddrlist.c:113:13: runtime error: =
member access within misaligned address 0x7fffffff55fc for type 'struct =
ifreq', which requires 8 byte alignment
0x7fffffff55fc: note: pointer points here
  00 00 00 00 6c 6f 30 00  00 00 00 00 00 00 00 00  00 00 00 00 1c 1c 00 =
00  00 00 00 00 fe 80 00 02
              ^=20
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior =
/usr/main-src/contrib/traceroute/ifaddrlist.c:113:13 in=20
/usr/main-src/contrib/traceroute/ifaddrlist.c:113:13: runtime error: =
member access within misaligned address 0x7fffffff560c for type 'union =
(unnamed union at =
/usr/obj/BUILDs/main-amd64-nodbg-clang-alt/usr/main-src/amd64.amd64/tmp/us=
r/include/net/if.h:398:2)', which requires 8 byte alignment
0x7fffffff560c: note: pointer points here
  00 00 00 00 1c 1c 00 00  00 00 00 00 fe 80 00 02  00 00 00 00 00 00 00 =
00  00 00 00 01 00 00 00 00
              ^=20
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior =
/usr/main-src/contrib/traceroute/ifaddrlist.c:113:13 in=20
/usr/main-src/contrib/traceroute/ifaddrlist.c:113:13: runtime error: =
member access within misaligned address 0x7fffffff560c for type 'struct =
sockaddr', which requires 8 byte alignment
0x7fffffff560c: note: pointer points here
  00 00 00 00 1c 1c 00 00  00 00 00 00 fe 80 00 02  00 00 00 00 00 00 00 =
00  00 00 00 01 00 00 00 00
              ^=20
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior =
/usr/main-src/contrib/traceroute/ifaddrlist.c:113:13 in=20
/usr/main-src/contrib/traceroute/ifaddrlist.c:113:22: runtime error: =
load of misaligned address 0x7fffffff560c for type 'unsigned char', =
which requires 8 byte alignment
0x7fffffff560c: note: pointer points here
  00 00 00 00 1c 1c 00 00  00 00 00 00 fe 80 00 02  00 00 00 00 00 00 00 =
00  00 00 00 01 00 00 00 00
              ^=20
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior =
/usr/main-src/contrib/traceroute/ifaddrlist.c:113:22 in=20
/usr/main-src/contrib/traceroute/ifaddrlist.c:118:13: runtime error: =
member access within misaligned address 0x7fffffff55fc for type 'struct =
ifreq', which requires 8 byte alignment
0x7fffffff55fc: note: pointer points here
  00 00 00 00 6c 6f 30 00  00 00 00 00 00 00 00 00  00 00 00 00 1c 1c 00 =
00  00 00 00 00 fe 80 00 02
              ^=20
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior =
/usr/main-src/contrib/traceroute/ifaddrlist.c:118:13 in=20
/usr/main-src/contrib/traceroute/ifaddrlist.c:118:13: runtime error: =
member access within misaligned address 0x7fffffff560c for type 'union =
(unnamed union at =
/usr/obj/BUILDs/main-amd64-nodbg-clang-alt/usr/main-src/amd64.amd64/tmp/us=
r/include/net/if.h:398:2)', which requires 8 byte alignment
0x7fffffff560c: note: pointer points here
  00 00 00 00 1c 1c 00 00  00 00 00 00 fe 80 00 02  00 00 00 00 00 00 00 =
00  00 00 00 01 00 00 00 00
              ^=20
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior =
/usr/main-src/contrib/traceroute/ifaddrlist.c:118:13 in=20
/usr/main-src/contrib/traceroute/ifaddrlist.c:118:13: runtime error: =
member access within misaligned address 0x7fffffff560c for type 'struct =
sockaddr', which requires 8 byte alignment
0x7fffffff560c: note: pointer points here
  00 00 00 00 1c 1c 00 00  00 00 00 00 fe 80 00 02  00 00 00 00 00 00 00 =
00  00 00 00 01 00 00 00 00
              ^=20
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior =
/usr/main-src/contrib/traceroute/ifaddrlist.c:118:13 in=20

=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?22B1E944-641D-4BD3-A4B2-384767D966FC>