Issue 8988 - Undefined Behavior in slapadd
Summary: Undefined Behavior in slapadd
Status: VERIFIED INVALID
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.47
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-07 10:10 UTC by noloader@gmail.com
Modified: 2022-11-14 11:37 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description noloader@gmail.com 2019-03-07 10:10:15 UTC
Full_Name: JW
Version: 2.4.47
OS: Linux (Fedora 29, x86_64, fully patched)
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (151.196.22.177)


I added -fsanitize=undefined to CFLAGS.

>>>>> Starting test001-slapadd for mdb...
running defines.sh
Running slapadd to build slapd database...
../../../libraries/liblmdb/mdb.c:7544:26: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7545:3: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6046:8: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:2418:7: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6938:10: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6939:6: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6939:6: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7287:6: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7303:18: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7303:18: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7306:6: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7335:11: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7339:12: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7341:20: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7342:15: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 52 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7343:15: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  52 00 52 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7343:15: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  52 00 52 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7346:9: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  52 00 52 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7349:6: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  52 00 52 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7357:6: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  52 00 52 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6050:9: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  52 00 52 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6054:11: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  52 00 52 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6069:25: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  52 00 52 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6286:26: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 52 00 14 00 00
00  00 00 00 00 36 00
              ^
../../../libraries/liblmdb/mdb.c:6288:9: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 52 00 14 00 00
00  00 00 00 00 36 00
              ^
../../../libraries/liblmdb/mdb.c:6290:6: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 52 00 14 00 00
00  00 00 00 00 36 00
              ^
id2entry.c:622:9: runtime error: left shift of 1 by 31 places cannot be
represented in type 'int'
../../../libraries/liblmdb/mdb.c:6071:11: runtime error: member access within
misaligned address 0x7f4a33564f9a for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a33564f9a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 52 00 14 00 00
00  00 00 00 00 36 00
              ^
../../../libraries/liblmdb/mdb.c:6075:13: runtime error: member access within
misaligned address 0x7f4a33564f9a for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a33564f9a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 52 00 14 00 00
00  00 00 00 00 36 00
              ^
../../../libraries/liblmdb/mdb.c:6164:6: runtime error: member access within
misaligned address 0x7f4a33564f9a for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a33564f9a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 52 00 14 00 00
00  00 00 00 00 36 00
              ^
../../../libraries/liblmdb/mdb.c:6242:9: runtime error: member access within
misaligned address 0x0000024240f2 for type 'struct MDB_page', which requires 8
byte alignment
0x0000024240f2: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6248:6: runtime error: member access within
misaligned address 0x0000024240f2 for type 'struct MDB_page', which requires 8
byte alignment
0x0000024240f2: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6785:19: runtime error: member access within
misaligned address 0x00000242417a for type 'struct MDB_page', which requires 8
byte alignment
0x00000242417a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 52 00 14 00 00
00  00 00 00 00 36 00
              ^
../../../libraries/liblmdb/mdb.c:6786:6: runtime error: member access within
misaligned address 0x00000242417a for type 'struct MDB_page', which requires 8
byte alignment
0x00000242417a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 52 00 14 00 00
00  00 00 00 00 36 00
              ^
../../../libraries/liblmdb/mdb.c:6681:7: runtime error: member access within
misaligned address 0x00000242417a for type 'struct MDB_page', which requires 8
byte alignment
0x00000242417a: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 52 00 14 00 00
00  00 00 00 00 36 00
              ^
../../../libraries/liblmdb/mdb.c:6712:10: runtime error: member access within
misaligned address 0x00000242417a for type 'struct MDB_page', which requires 8
byte alignment
0x00000242417a: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 52 00 14 00 00
00  00 00 00 00 36 00
              ^
../../../libraries/liblmdb/mdb.c:7553:25: runtime error: member access within
misaligned address 0x00000242313c for type 'struct MDB_page', which requires 8
byte alignment
0x00000242313c: note: pointer points here
  00 96 de fd 0b 00 00 00  00 00 00 00 08 00 72 00  10 00 30 00 00 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7291:9: runtime error: member access within
misaligned address 0x00000242313c for type 'struct MDB_page', which requires 8
byte alignment
0x00000242313c: note: pointer points here
  00 96 de fd 0b 00 00 00  00 00 00 00 08 00 72 00  10 00 30 00 00 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7298:16: runtime error: member access within
misaligned address 0x00000242313c for type 'struct MDB_page', which requires 8
byte alignment
0x00000242313c: note: pointer points here
  00 96 de fd 0b 00 00 00  00 00 00 00 08 00 72 00  10 00 30 00 01 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7298:16: runtime error: member access within
misaligned address 0x00000242313c for type 'struct MDB_page', which requires 8
byte alignment
0x00000242313c: note: pointer points here
  00 96 de fd 0b 00 00 00  00 00 00 00 08 00 72 00  10 00 30 00 01 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7299:16: runtime error: member access within
misaligned address 0x00000242313c for type 'struct MDB_page', which requires 8
byte alignment
0x00000242313c: note: pointer points here
  00 96 de fd 0b 00 00 00  00 00 00 00 08 00 72 00  12 00 30 00 01 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7299:16: runtime error: member access within
misaligned address 0x00000242313c for type 'struct MDB_page', which requires 8
byte alignment
0x00000242313c: note: pointer points here
  00 96 de fd 0b 00 00 00  00 00 00 00 08 00 72 00  12 00 30 00 01 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:5172:34: runtime error: load of misaligned
address 0x00000242314c for type 'size_t', which requires 8 byte alignment
0x00000242314c: note: pointer points here
  12 00 2a 00 01 00 00 00  00 00 00 00 01 00 00 00  00 00 00 00 6d 70 6c 65  2c
64 63 3d 63 6f 6d 00
              ^
../../../libraries/liblmdb/mdb.c:5173:27: runtime error: load of misaligned
address 0x00000242314c for type 'size_t', which requires 8 byte alignment
0x00000242314c: note: pointer points here
  12 00 2a 00 01 00 00 00  00 00 00 00 01 00 00 00  00 00 00 00 6d 70 6c 65  2c
64 63 3d 63 6f 6d 00
              ^
../../../libraries/liblmdb/mdb.c:6087:34: runtime error: member access within
misaligned address 0x7f4a3356bf12 for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a3356bf12: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6089:13: runtime error: member access within
misaligned address 0x7f4a3356bf12 for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a3356bf12: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6093:15: runtime error: member access within
misaligned address 0x7f4a3356bf12 for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a3356bf12: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:5282:10: runtime error: member access within
misaligned address 0x7f4a3356bf12 for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a3356bf12: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:5288:8: runtime error: member access within
misaligned address 0x7f4a3356bf12 for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a3356bf12: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:5302:6: runtime error: member access within
misaligned address 0x7f4a3356bf12 for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a3356bf12: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:5322:11: runtime error: member access within
misaligned address 0x7f4a3356bf12 for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a3356bf12: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6794:13: runtime error: member access within
misaligned address 0x0000024210c2 for type 'struct MDB_page', which requires 8
byte alignment
0x0000024210c2: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6825:22: runtime error: member access within
misaligned address 0x0000024210c2 for type 'struct MDB_page', which requires 8
byte alignment
0x0000024210c2: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6826:24: runtime error: member access within
misaligned address 0x0000024210c2 for type 'struct MDB_page', which requires 8
byte alignment
0x0000024210c2: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6827:24: runtime error: member access within
misaligned address 0x0000024210c2 for type 'struct MDB_page', which requires 8
byte alignment
0x0000024210c2: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6832:29: runtime error: member access within
misaligned address 0x0000024210c2 for type 'struct MDB_page', which requires 8
byte alignment
0x0000024210c2: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6831:68: runtime error: member access within
misaligned address 0x0000024210c2 for type 'struct MDB_page', which requires 8
byte alignment
0x0000024210c2: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6833:61: runtime error: member access within
misaligned address 0x0000024210c2 for type 'struct MDB_page', which requires 8
byte alignment
0x0000024210c2: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6833:46: runtime error: member access within
misaligned address 0x0000024210c2 for type 'struct MDB_page', which requires 8
byte alignment
0x0000024210c2: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:6834:18: runtime error: member access within
misaligned address 0x0000024210c2 for type 'struct MDB_page', which requires 8
byte alignment
0x0000024210c2: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 42 00 14 00 00
00  00 00 00 00 26 00
              ^
../../../libraries/liblmdb/mdb.c:7336:31: runtime error: member access within
misaligned address 0x000002421064 for type 'struct MDB_page', which requires 8
byte alignment
0x000002421064: note: pointer points here
  00 00 00 00 0f 00 00 00  00 00 00 00 00 00 52 00  14 00 44 00 72 00 44 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7336:18: runtime error: member access within
misaligned address 0x000002421064 for type 'struct MDB_page', which requires 8
byte alignment
0x000002421064: note: pointer points here
  00 00 00 00 0f 00 00 00  00 00 00 00 00 00 52 00  14 00 44 00 72 00 44 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6778:17: runtime error: member access within
misaligned address 0x000002422104 for type 'struct MDB_page', which requires 8
byte alignment
0x000002422104: note: pointer points here
  9b ee 35 5f 10 00 00 00  00 00 00 00 08 00 72 00  14 00 24 00 02 00 00 00  00
00 00 00 03 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6779:10: runtime error: member access within
misaligned address 0x000002422104 for type 'struct MDB_page', which requires 8
byte alignment
0x000002422104: note: pointer points here
  9b ee 35 5f 10 00 00 00  00 00 00 00 08 00 72 00  14 00 24 00 02 00 00 00  00
00 00 00 03 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6779:10: runtime error: member access within
misaligned address 0x000002422104 for type 'struct MDB_page', which requires 8
byte alignment
0x000002422104: note: pointer points here
  9b ee 35 5f 10 00 00 00  00 00 00 00 08 00 72 00  14 00 24 00 02 00 00 00  00
00 00 00 03 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6829:41: runtime error: member access within
misaligned address 0x000002429dd4 for type 'struct MDB_page', which requires 8
byte alignment
0x000002429dd4: note: pointer points here
  00 96 de fd 0a 00 00 00  00 00 00 00 08 00 72 00  20 00 20 00 01 00 00 00  00
00 00 00 02 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6829:57: runtime error: member access within
misaligned address 0x000002429dd4 for type 'struct MDB_page', which requires 8
byte alignment
0x000002429dd4: note: pointer points here
  00 96 de fd 0a 00 00 00  00 00 00 00 08 00 72 00  20 00 20 00 01 00 00 00  00
00 00 00 02 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:5346:8: runtime error: member access within
misaligned address 0x7f4a33565aaa for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a33565aaa: note: pointer points here
 00 00  00 00 0e 00 00 00 00 00  00 00 08 00 52 00 16 00  16 00 96 00 56 00 16
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:5347:11: runtime error: member access within
misaligned address 0x7f4a33565aaa for type 'struct MDB_page', which requires 8
byte alignment
0x7f4a33565aaa: note: pointer points here
 00 00  00 00 0e 00 00 00 00 00  00 00 08 00 52 00 16 00  16 00 96 00 56 00 16
00  00 00 00 00 00 00
              ^
Starting slapd on TCP/IP port 9011...
Using ldapsearch to retrieve all the entries...
Filtering ldapsearch results...
Filtering original ldif used to create database...
Comparing filter output...
Running slapadd with unordered LDIF...
../../../libraries/liblmdb/mdb.c:7544:26: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7545:3: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6046:8: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:2418:7: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6938:10: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6939:6: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6939:6: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7287:6: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7303:18: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7303:18: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7306:6: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7335:11: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7339:12: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7341:20: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 00 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7342:15: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  76 00 62 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7343:15: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  62 00 62 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7343:15: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  62 00 62 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7346:9: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  62 00 62 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7349:6: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  62 00 62 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7357:6: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  62 00 62 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6050:9: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  62 00 62 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6054:11: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  62 00 62 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6069:25: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 12 00  62 00 62 00 00 00 00
00  00 00 00 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6286:26: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 62 00 14 00 00
00  00 00 00 00 46 00
              ^
../../../libraries/liblmdb/mdb.c:6288:9: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 62 00 14 00 00
00  00 00 00 00 46 00
              ^
../../../libraries/liblmdb/mdb.c:6290:6: runtime error: member access within
misaligned address 0x0000020d339a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d339a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 62 00 14 00 00
00  00 00 00 00 46 00
              ^
id2entry.c:622:9: runtime error: left shift of 1 by 31 places cannot be
represented in type 'int'
../../../libraries/liblmdb/mdb.c:6071:11: runtime error: member access within
misaligned address 0x7f30b251af8a for type 'struct MDB_page', which requires 8
byte alignment
0x7f30b251af8a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 62 00 14 00 00
00  00 00 00 00 46 00
              ^
../../../libraries/liblmdb/mdb.c:6075:13: runtime error: member access within
misaligned address 0x7f30b251af8a for type 'struct MDB_page', which requires 8
byte alignment
0x7f30b251af8a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 62 00 14 00 00
00  00 00 00 00 46 00
              ^
../../../libraries/liblmdb/mdb.c:6164:6: runtime error: member access within
misaligned address 0x7f30b251af8a for type 'struct MDB_page', which requires 8
byte alignment
0x7f30b251af8a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 62 00 14 00 00
00  00 00 00 00 46 00
              ^
../../../libraries/liblmdb/mdb.c:6242:9: runtime error: member access within
misaligned address 0x0000020f842e for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f842e: note: pointer points here
 00 00 00 00 0a 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6248:6: runtime error: member access within
misaligned address 0x0000020f842e for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f842e: note: pointer points here
 00 00 00 00 0a 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6785:19: runtime error: member access within
misaligned address 0x0000020f84ca for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f84ca: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 62 00 14 00 00
00  00 00 00 00 46 00
              ^
../../../libraries/liblmdb/mdb.c:6786:6: runtime error: member access within
misaligned address 0x0000020f84ca for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f84ca: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 62 00 14 00 00
00  00 00 00 00 46 00
              ^
../../../libraries/liblmdb/mdb.c:6681:7: runtime error: member access within
misaligned address 0x0000020f84ca for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f84ca: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 62 00 14 00 00
00  00 00 00 00 46 00
              ^
../../../libraries/liblmdb/mdb.c:6712:10: runtime error: member access within
misaligned address 0x0000020f84ca for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f84ca: note: pointer points here
 00 00  00 00 0a 00 00 00 00 00  00 00 00 00 52 00 14 00  14 00 62 00 14 00 00
00  00 00 00 00 46 00
              ^
../../../libraries/liblmdb/mdb.c:7553:25: runtime error: member access within
misaligned address 0x0000020f74ec for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f74ec: note: pointer points here
  9b ee 35 5f 0b 00 00 00  00 00 00 00 08 00 72 00  10 00 30 00 00 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7291:9: runtime error: member access within
misaligned address 0x0000020f74ec for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f74ec: note: pointer points here
  9b ee 35 5f 0b 00 00 00  00 00 00 00 08 00 72 00  10 00 30 00 00 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7298:16: runtime error: member access within
misaligned address 0x0000020f74ec for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f74ec: note: pointer points here
  9b ee 35 5f 0b 00 00 00  00 00 00 00 08 00 72 00  10 00 30 00 01 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7298:16: runtime error: member access within
misaligned address 0x0000020f74ec for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f74ec: note: pointer points here
  9b ee 35 5f 0b 00 00 00  00 00 00 00 08 00 72 00  10 00 30 00 01 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7299:16: runtime error: member access within
misaligned address 0x0000020f74ec for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f74ec: note: pointer points here
  9b ee 35 5f 0b 00 00 00  00 00 00 00 08 00 72 00  12 00 30 00 01 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:7299:16: runtime error: member access within
misaligned address 0x0000020f74ec for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f74ec: note: pointer points here
  9b ee 35 5f 0b 00 00 00  00 00 00 00 08 00 72 00  12 00 30 00 01 00 00 00  00
00 00 00 01 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:5172:34: runtime error: load of misaligned
address 0x0000020f74fc for type 'size_t', which requires 8 byte alignment
0x0000020f74fc: note: pointer points here
  12 00 2a 00 01 00 00 00  00 00 00 00 01 00 00 00  00 00 00 00 74 2c 64 63  3d
65 78 61 6d 70 6c 65
              ^
../../../libraries/liblmdb/mdb.c:5173:27: runtime error: load of misaligned
address 0x0000020f74fc for type 'size_t', which requires 8 byte alignment
0x0000020f74fc: note: pointer points here
  12 00 2a 00 01 00 00 00  00 00 00 00 01 00 00 00  00 00 00 00 74 2c 64 63  3d
65 78 61 6d 70 6c 65
              ^
../../../libraries/liblmdb/mdb.c:6778:17: runtime error: member access within
misaligned address 0x0000020f74c4 for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f74c4: note: pointer points here
  00 96 de fd 0b 00 00 00  00 00 00 00 08 00 72 00  14 00 24 00 01 00 00 00  00
00 00 00 02 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6779:10: runtime error: member access within
misaligned address 0x0000020f74c4 for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f74c4: note: pointer points here
  00 96 de fd 0b 00 00 00  00 00 00 00 08 00 72 00  14 00 24 00 01 00 00 00  00
00 00 00 02 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6779:10: runtime error: member access within
misaligned address 0x0000020f74c4 for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f74c4: note: pointer points here
  00 96 de fd 0b 00 00 00  00 00 00 00 08 00 72 00  14 00 24 00 01 00 00 00  00
00 00 00 02 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6087:34: runtime error: member access within
misaligned address 0x7f30b2525eee for type 'struct MDB_page', which requires 8
byte alignment
0x7f30b2525eee: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6089:13: runtime error: member access within
misaligned address 0x7f30b2525eee for type 'struct MDB_page', which requires 8
byte alignment
0x7f30b2525eee: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6093:15: runtime error: member access within
misaligned address 0x7f30b2525eee for type 'struct MDB_page', which requires 8
byte alignment
0x7f30b2525eee: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:5282:10: runtime error: member access within
misaligned address 0x7f30b2525eee for type 'struct MDB_page', which requires 8
byte alignment
0x7f30b2525eee: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:5288:8: runtime error: member access within
misaligned address 0x7f30b2525eee for type 'struct MDB_page', which requires 8
byte alignment
0x7f30b2525eee: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:5302:6: runtime error: member access within
misaligned address 0x7f30b2525eee for type 'struct MDB_page', which requires 8
byte alignment
0x7f30b2525eee: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:5322:11: runtime error: member access within
misaligned address 0x7f30b2525eee for type 'struct MDB_page', which requires 8
byte alignment
0x7f30b2525eee: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6794:13: runtime error: member access within
misaligned address 0x0000020f842e for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f842e: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6825:22: runtime error: member access within
misaligned address 0x0000020f842e for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f842e: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6826:24: runtime error: member access within
misaligned address 0x0000020f842e for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f842e: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6827:24: runtime error: member access within
misaligned address 0x0000020f842e for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f842e: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6832:29: runtime error: member access within
misaligned address 0x0000020f842e for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f842e: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6831:68: runtime error: member access within
misaligned address 0x0000020f842e for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f842e: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6833:61: runtime error: member access within
misaligned address 0x0000020f842e for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f842e: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6833:46: runtime error: member access within
misaligned address 0x0000020f842e for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f842e: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:6834:18: runtime error: member access within
misaligned address 0x0000020f842e for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f842e: note: pointer points here
 00 00 00 00 0e 00  00 00 00 00 00 00 00 00  52 00 14 00 14 00 46 00  14 00 00
00 00 00 00 00  2a 00
             ^
../../../libraries/liblmdb/mdb.c:7336:31: runtime error: member access within
misaligned address 0x0000020f833a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f833a: note: pointer points here
 00 00  00 00 04 00 00 00 00 00  00 00 00 00 52 00 14 00  42 00 74 00 42 00 00
00  00 00 00 0b 6f 75
              ^
../../../libraries/liblmdb/mdb.c:7336:18: runtime error: member access within
misaligned address 0x0000020f833a for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f833a: note: pointer points here
 00 00  00 00 04 00 00 00 00 00  00 00 00 00 52 00 14 00  42 00 74 00 42 00 00
00  00 00 00 0b 6f 75
              ^
../../../libraries/liblmdb/mdb.c:7365:5: runtime error: null pointer passed as
argument 2, which is declared to never be null
../../../libraries/liblmdb/mdb.c:6829:41: runtime error: member access within
misaligned address 0x0000020d33a4 for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d33a4: note: pointer points here
  00 96 de fd 08 00 00 00  00 00 00 00 08 00 72 00  18 00 18 00 01 00 00 00  00
00 00 00 02 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:6829:57: runtime error: member access within
misaligned address 0x0000020d33a4 for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d33a4: note: pointer points here
  00 96 de fd 08 00 00 00  00 00 00 00 08 00 72 00  18 00 18 00 01 00 00 00  00
00 00 00 02 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:5304:10: runtime error: member access within
misaligned address 0x0000020d335c for type 'struct MDB_page', which requires 8
byte alignment
0x0000020d335c: note: pointer points here
  00 96 de fd 0a 00 00 00  00 00 00 00 08 00 72 00  18 00 38 00 01 00 00 00  00
00 00 00 02 00 00 00
              ^
../../../libraries/liblmdb/mdb.c:5346:8: runtime error: member access within
misaligned address 0x0000020f64bc for type 'struct MDB_page', which requires 8
byte alignment
0x0000020f64bc: note: pointer points here
  00 96 de fd 09 00 00 00  00 00 00 00 08 00 72 00  1e 00 26 00 01 00 00 00  00
00 00 00 02 00 00 00
              ^
Comment 1 Quanah Gibson-Mount 2019-06-06 23:39:00 UTC
--On Thursday, March 07, 2019 10:10 AM +0000 noloader@gmail.com wrote:

> Full_Name: JW
> Version: 2.4.47
> OS: Linux (Fedora 29, x86_64, fully patched)
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (151.196.22.177)
>
>
> I added -fsanitize=undefined to CFLAGS.

Hello,

In this case, the compiler is the problem.  LMDB is 100% correct regarding 
alignment on all supported CPUs (which is most of them).  The x86 family 
fully supports unaligned access, so LMDB makes use of this.  On other CPUs, 
which do not support unaligned access (e.g., SPARC), LMDB doesn't use them.

This ITS will be closed.

--Quanah



--

Quanah Gibson-Mount
Product Architect
Symas Corporation
Packaged, certified, and supported LDAP solutions powered by OpenLDAP:
<http://www.symas.com>


Comment 2 OpenLDAP project 2019-06-06 23:39:24 UTC
Compiler flaw
Comment 3 Quanah Gibson-Mount 2019-06-06 23:39:24 UTC
changed notes
changed state Open to Closed
Comment 4 noloader@gmail.com 2019-06-07 03:06:59 UTC
On Thu, Jun 6, 2019 at 7:39 PM Quanah Gibson-Mount <quanah@symas.com> wrote:
>
> --On Thursday, March 07, 2019 10:10 AM +0000 noloader@gmail.com wrote:
>
> > Full_Name: JW
> > Version: 2.4.47
> > OS: Linux (Fedora 29, x86_64, fully patched)
> > URL: ftp://ftp.openldap.org/incoming/
> > Submission from: (NULL) (151.196.22.177)
> >
> > I added -fsanitize=undefined to CFLAGS.
>
> In this case, the compiler is the problem.

I'm pretty sure the compiler is correct.

The instrumentation does not produce false positives. It operates on
real data and simply does not produce false positives.

> LMDB is 100% correct regarding
> alignment on all supported CPUs (which is most of them).  The x86 family
> fully supports unaligned access, so LMDB makes use of this.

It is not the processor; it is the C language. The C language does not allow it.

> On other CPUs,
> which do not support unaligned access (e.g., SPARC), LMDB doesn't use them.

The undefined behavior exists even after disabling the unaligned
accesses with custom patches. For example, there is still undefined
behavior even after changes like this:

-#if defined(__i386) || defined(__x86_64)
-#define MISALIGNED_OK 1
-#else
#define ALIGNER (sizeof(size_t)-1)
-#endif

We also fixed COPY_PGNO but the undefined behavior remained.

The GCC Compile Farm (https://cfarm.tetaneutral.net/machines/list/)
has three SPARC machines. SPARC does not tolerate unaligned accesses
well, especially due to the optimized 64-bit move instruction.
OpenLDAP might consider testing on the SPARC machines.

In the bigger picture, OpenLDAP is causing other program and library
testing to fail testing. When we test other programs and libraries
that depend upon OpenLDAP in a similar fashion, the undefined behavior
in OpenLDAP surfaces in the other program and libraries. It is making
a lot of extra work for folks who perform extra testing.

I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
important project, and the undefined behavior is causing too many
tangential problems.

Jeff

Comment 5 Howard Chu 2019-06-07 13:32:34 UTC
noloader@gmail.com wrote:
> On Thu, Jun 6, 2019 at 7:39 PM Quanah Gibson-Mount <quanah@symas.com> wrote:
>>
>> --On Thursday, March 07, 2019 10:10 AM +0000 noloader@gmail.com wrote:
>>
>>> Full_Name: JW
>>> Version: 2.4.47
>>> OS: Linux (Fedora 29, x86_64, fully patched)
>>> URL: ftp://ftp.openldap.org/incoming/
>>> Submission from: (NULL) (151.196.22.177)
>>>
>>> I added -fsanitize=undefined to CFLAGS.
>>
>> In this case, the compiler is the problem.
> 
> I'm pretty sure the compiler is correct.
> 
> The instrumentation does not produce false positives. It operates on
> real data and simply does not produce false positives.
> 
>> LMDB is 100% correct regarding
>> alignment on all supported CPUs (which is most of them).  The x86 family
>> fully supports unaligned access, so LMDB makes use of this.
> 
> It is not the processor; it is the C language. The C language does not allow it.

That is incorrect. The C language allows it, but does not fully specify the behavior.
On some machines unaligned accesses are allowed, on others it is not. On X86 family
it is allowed, and we use it.
> 
>> On other CPUs,
>> which do not support unaligned access (e.g., SPARC), LMDB doesn't use them.
> 
> The undefined behavior exists even after disabling the unaligned
> accesses with custom patches. For example, there is still undefined
> behavior even after changes like this:
> 
> -#if defined(__i386) || defined(__x86_64)
> -#define MISALIGNED_OK 1
> -#else
> #define ALIGNER (sizeof(size_t)-1)
> -#endif
> 
> We also fixed COPY_PGNO but the undefined behavior remained.
> 
> The GCC Compile Farm (https://cfarm.tetaneutral.net/machines/list/)
> has three SPARC machines. SPARC does not tolerate unaligned accesses
> well, especially due to the optimized 64-bit move instruction.

We have already tested on SPARC and as we already noted above, we do not use
unaligned accesses on SPARC.

> OpenLDAP might consider testing on the SPARC machines.
> 
> In the bigger picture, OpenLDAP is causing other program and library
> testing to fail testing. When we test other programs and libraries
> that depend upon OpenLDAP in a similar fashion, the undefined behavior
> in OpenLDAP surfaces in the other program and libraries. It is making
> a lot of extra work for folks who perform extra testing.
> 
> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
> important project, and the undefined behavior is causing too many
> tangential problems.

Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
part of the language for its intended use as a system programming language, writing
machine-specific programs. Anyone who says it is prohibited by the spec is wrong.

> Jeff
> 
> 
> 
> 


-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 6 noloader@gmail.com 2019-06-07 13:50:37 UTC
On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
>
> noloader@gmail.com wrote:
> ...
> > I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
> > important project, and the undefined behavior is causing too many
> > tangential problems.
>
> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
> part of the language for its intended use as a system programming language, writing
> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.

I don't believe this is correct.

Maybe you are thinking of implementation defined behavior?

Jeff

Comment 7 Howard Chu 2019-06-07 13:59:27 UTC
noloader@gmail.com wrote:
> On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
>>
>> noloader@gmail.com wrote:
>> ...
>>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
>>> important project, and the undefined behavior is causing too many
>>> tangential problems.
>>
>> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
>> part of the language for its intended use as a system programming language, writing
>> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.
> 
> I don't believe this is correct.
> 
> Maybe you are thinking of implementation defined behavior?

That would apply to how a particular compiler implementation treats some piece of code.
Whether a CPU supports unaligned access is machine-defined. Since our code is already
properly ifdef'd for the machines which do or don't support it, the fact that this is
"non-portable" is not an issue.

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 8 noloader@gmail.com 2019-06-07 14:02:34 UTC
On Fri, Jun 7, 2019 at 9:59 AM Howard Chu <hyc@symas.com> wrote:
>
> noloader@gmail.com wrote:
> > On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
> >>
> >> noloader@gmail.com wrote:
> >> ...
> >>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
> >>> important project, and the undefined behavior is causing too many
> >>> tangential problems.
> >>
> >> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
> >> part of the language for its intended use as a system programming language, writing
> >> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.
> >
> > I don't believe this is correct.
> >
> > Maybe you are thinking of implementation defined behavior?
>
> That would apply to how a particular compiler implementation treats some piece of code.
> Whether a CPU supports unaligned access is machine-defined. Since our code is already
> properly ifdef'd for the machines which do or don't support it, the fact that this is
> "non-portable" is not an issue.

The undefined behavior is causing OpenLDAP to fail testing.

Worse, it is causing test failures in programs and libraries which use
OpenLDAP. The OpenLDAP bugs have cross-pollinated into other programs
and libraries. It is not simply contained or limited to OpenLDAP.

That's a big problem for testing a QA folks.

Jeff

Comment 9 Howard Chu 2019-06-07 14:08:52 UTC
Jeffrey Walton wrote:
> On Fri, Jun 7, 2019 at 9:59 AM Howard Chu <hyc@symas.com> wrote:
>>
>> noloader@gmail.com wrote:
>>> On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
>>>>
>>>> noloader@gmail.com wrote:
>>>> ...
>>>>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
>>>>> important project, and the undefined behavior is causing too many
>>>>> tangential problems.
>>>>
>>>> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
>>>> part of the language for its intended use as a system programming language, writing
>>>> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.
>>>
>>> I don't believe this is correct.
>>>
>>> Maybe you are thinking of implementation defined behavior?
>>
>> That would apply to how a particular compiler implementation treats some piece of code.
>> Whether a CPU supports unaligned access is machine-defined. Since our code is already
>> properly ifdef'd for the machines which do or don't support it, the fact that this is
>> "non-portable" is not an issue.
> 
> The undefined behavior is causing OpenLDAP to fail testing.
> 
> Worse, it is causing test failures in programs and libraries which use
> OpenLDAP. The OpenLDAP bugs have cross-pollinated into other programs
> and libraries. It is not simply contained or limited to OpenLDAP.
> 
> That's a big problem for testing a QA folks.

Then the tests are broken, because these are not bugs.

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 10 noloader@gmail.com 2019-06-07 18:02:11 UTC
On Fri, Jun 7, 2019 at 10:08 AM Howard Chu <hyc@symas.com> wrote:
>
> Jeffrey Walton wrote:
> > On Fri, Jun 7, 2019 at 9:59 AM Howard Chu <hyc@symas.com> wrote:
> >>
> >> noloader@gmail.com wrote:
> >>> On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
> >>>>
> >>>> noloader@gmail.com wrote:
> >>>> ...
> >>>>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
> >>>>> important project, and the undefined behavior is causing too many
> >>>>> tangential problems.
> >>>>
> >>>> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
> >>>> part of the language for its intended use as a system programming language, writing
> >>>> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.
> >>>
> >>> I don't believe this is correct.
> >>>
> >>> Maybe you are thinking of implementation defined behavior?
> >>
> >> That would apply to how a particular compiler implementation treats some piece of code.
> >> Whether a CPU supports unaligned access is machine-defined. Since our code is already
> >> properly ifdef'd for the machines which do or don't support it, the fact that this is
> >> "non-portable" is not an issue.
> >
> > The undefined behavior is causing OpenLDAP to fail testing.
> >
> > Worse, it is causing test failures in programs and libraries which use
> > OpenLDAP. The OpenLDAP bugs have cross-pollinated into other programs
> > and libraries. It is not simply contained or limited to OpenLDAP.
> >
> > That's a big problem for testing a QA folks.
>
> Then the tests are broken, because these are not bugs.

They are absolutely OpenLDAP bugs. The unaligned accesses are
Undefined Behavior.

* https://stackoverflow.com/a/46790815/608639
* https://stackoverflow.com/a/46790813/608639
* https://stackoverflow.com/a/28895321/608639
* https://stackoverflow.com/a/51126453/608639
* https://stackoverflow.com/q/39908946/608639
...

I get that you think your project is fine. Many folks take that myopic
view of the world. I call it the greedy model.

Greedy models show up all over the place. For example, every website
that requires a different account and different 16 character password.
That's the greedy password model where a site think it is the only one
someone visits.

What baffles me is your insistence on polluting other program and
library results. That's not your place to screw up testing for other
programs and libraries.

Jeff

Comment 11 Howard Chu 2019-06-07 18:37:36 UTC
Jeffrey Walton wrote:
> On Fri, Jun 7, 2019 at 10:08 AM Howard Chu <hyc@symas.com> wrote:
>>
>> Jeffrey Walton wrote:
>>> On Fri, Jun 7, 2019 at 9:59 AM Howard Chu <hyc@symas.com> wrote:
>>>>
>>>> noloader@gmail.com wrote:
>>>>> On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
>>>>>>
>>>>>> noloader@gmail.com wrote:
>>>>>> ...
>>>>>>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
>>>>>>> important project, and the undefined behavior is causing too many
>>>>>>> tangential problems.
>>>>>>
>>>>>> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
>>>>>> part of the language for its intended use as a system programming language, writing
>>>>>> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.
>>>>>
>>>>> I don't believe this is correct.
>>>>>
>>>>> Maybe you are thinking of implementation defined behavior?
>>>>
>>>> That would apply to how a particular compiler implementation treats some piece of code.
>>>> Whether a CPU supports unaligned access is machine-defined. Since our code is already
>>>> properly ifdef'd for the machines which do or don't support it, the fact that this is
>>>> "non-portable" is not an issue.
>>>
>>> The undefined behavior is causing OpenLDAP to fail testing.
>>>
>>> Worse, it is causing test failures in programs and libraries which use
>>> OpenLDAP. The OpenLDAP bugs have cross-pollinated into other programs
>>> and libraries. It is not simply contained or limited to OpenLDAP.
>>>
>>> That's a big problem for testing a QA folks.
>>
>> Then the tests are broken, because these are not bugs.
> 
> They are absolutely OpenLDAP bugs. The unaligned accesses are
> Undefined Behavior.

Simply because the C standard doesn't specify what the behavior is doesn't make it a bug.
It would be unreasonable to expect the standards body to exhaustively list all of the
possible behaviors on all of the possible hardware architectures that the language is
implemented for. Leaving it undefined in the spec only means they chose not to specify
a behavior. That means the actual behavior depends on the underlying machine. On the
x86 family the behavior is well defined.

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 12 Howard Chu 2019-06-07 18:53:14 UTC
hyc@symas.com wrote:
> Jeffrey Walton wrote:
>> On Fri, Jun 7, 2019 at 10:08 AM Howard Chu <hyc@symas.com> wrote:
>>>
>>> Jeffrey Walton wrote:
>>>> On Fri, Jun 7, 2019 at 9:59 AM Howard Chu <hyc@symas.com> wrote:
>>>>>
>>>>> noloader@gmail.com wrote:
>>>>>> On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
>>>>>>>
>>>>>>> noloader@gmail.com wrote:
>>>>>>> ...
>>>>>>>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
>>>>>>>> important project, and the undefined behavior is causing too many
>>>>>>>> tangential problems.
>>>>>>>
>>>>>>> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
>>>>>>> part of the language for its intended use as a system programming language, writing
>>>>>>> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.
>>>>>>
>>>>>> I don't believe this is correct.
>>>>>>
>>>>>> Maybe you are thinking of implementation defined behavior?
>>>>>
>>>>> That would apply to how a particular compiler implementation treats some piece of code.
>>>>> Whether a CPU supports unaligned access is machine-defined. Since our code is already
>>>>> properly ifdef'd for the machines which do or don't support it, the fact that this is
>>>>> "non-portable" is not an issue.
>>>>
>>>> The undefined behavior is causing OpenLDAP to fail testing.
>>>>
>>>> Worse, it is causing test failures in programs and libraries which use
>>>> OpenLDAP. The OpenLDAP bugs have cross-pollinated into other programs
>>>> and libraries. It is not simply contained or limited to OpenLDAP.
>>>>
>>>> That's a big problem for testing a QA folks.
>>>
>>> Then the tests are broken, because these are not bugs.
>>
>> They are absolutely OpenLDAP bugs. The unaligned accesses are
>> Undefined Behavior.
> 
> Simply because the C standard doesn't specify what the behavior is doesn't make it a bug.
> It would be unreasonable to expect the standards body to exhaustively list all of the
> possible behaviors on all of the possible hardware architectures that the language is
> implemented for. Leaving it undefined in the spec only means they chose not to specify
> a behavior. That means the actual behavior depends on the underlying machine. On the
> x86 family the behavior is well defined.

Also note: Behaviors are left undefined when they are non-portable. But being non-portable
isn't illegal in C. The entire purpose of conditional compilation is to support non-portable
code.

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 13 Howard Chu 2019-06-07 18:57:51 UTC
Howard Chu wrote:
> hyc@symas.com wrote:
>> Jeffrey Walton wrote:
>>> On Fri, Jun 7, 2019 at 10:08 AM Howard Chu <hyc@symas.com> wrote:
>>>>
>>>> Jeffrey Walton wrote:
>>>>> On Fri, Jun 7, 2019 at 9:59 AM Howard Chu <hyc@symas.com> wrote:
>>>>>>
>>>>>> noloader@gmail.com wrote:
>>>>>>> On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
>>>>>>>>
>>>>>>>> noloader@gmail.com wrote:
>>>>>>>> ...
>>>>>>>>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
>>>>>>>>> important project, and the undefined behavior is causing too many
>>>>>>>>> tangential problems.
>>>>>>>>
>>>>>>>> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
>>>>>>>> part of the language for its intended use as a system programming language, writing
>>>>>>>> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.
>>>>>>>
>>>>>>> I don't believe this is correct.
>>>>>>>
>>>>>>> Maybe you are thinking of implementation defined behavior?
>>>>>>
>>>>>> That would apply to how a particular compiler implementation treats some piece of code.
>>>>>> Whether a CPU supports unaligned access is machine-defined. Since our code is already
>>>>>> properly ifdef'd for the machines which do or don't support it, the fact that this is
>>>>>> "non-portable" is not an issue.
>>>>>
>>>>> The undefined behavior is causing OpenLDAP to fail testing.
>>>>>
>>>>> Worse, it is causing test failures in programs and libraries which use
>>>>> OpenLDAP. The OpenLDAP bugs have cross-pollinated into other programs
>>>>> and libraries. It is not simply contained or limited to OpenLDAP.
>>>>>
>>>>> That's a big problem for testing a QA folks.
>>>>
>>>> Then the tests are broken, because these are not bugs.
>>>
>>> They are absolutely OpenLDAP bugs. The unaligned accesses are
>>> Undefined Behavior.
>>
>> Simply because the C standard doesn't specify what the behavior is doesn't make it a bug.
>> It would be unreasonable to expect the standards body to exhaustively list all of the
>> possible behaviors on all of the possible hardware architectures that the language is
>> implemented for. Leaving it undefined in the spec only means they chose not to specify
>> a behavior. That means the actual behavior depends on the underlying machine. On the
>> x86 family the behavior is well defined.
> 
> Also note: Behaviors are left undefined when they are non-portable. But being non-portable
> isn't illegal in C. The entire purpose of conditional compilation is to support non-portable
> code.
> 
Worth reading https://www.yodaiken.com/2018/12/31/undefined-behavior-and-the-purpose-of-c/

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 14 noloader@gmail.com 2019-06-08 07:15:49 UTC
On Fri, Jun 7, 2019 at 2:37 PM Howard Chu <hyc@symas.com> wrote:
>
> Jeffrey Walton wrote:
> > On Fri, Jun 7, 2019 at 10:08 AM Howard Chu <hyc@symas.com> wrote:
> >>
> >> Jeffrey Walton wrote:
> >>> On Fri, Jun 7, 2019 at 9:59 AM Howard Chu <hyc@symas.com> wrote:
> >>>>
> >>>> noloader@gmail.com wrote:
> >>>>> On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
> >>>>>>
> >>>>>> noloader@gmail.com wrote:
> >>>>>> ...
> >>>>>>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
> >>>>>>> important project, and the undefined behavior is causing too many
> >>>>>>> tangential problems.
> >>>>>>
> >>>>>> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
> >>>>>> part of the language for its intended use as a system programming language, writing
> >>>>>> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.
> >>>>>
> >>>>> I don't believe this is correct.
> >>>>>
> >>>>> Maybe you are thinking of implementation defined behavior?
> >>>>
> >>>> That would apply to how a particular compiler implementation treats some piece of code.
> >>>> Whether a CPU supports unaligned access is machine-defined. Since our code is already
> >>>> properly ifdef'd for the machines which do or don't support it, the fact that this is
> >>>> "non-portable" is not an issue.
> >>>
> >>> The undefined behavior is causing OpenLDAP to fail testing.
> >>>
> >>> Worse, it is causing test failures in programs and libraries which use
> >>> OpenLDAP. The OpenLDAP bugs have cross-pollinated into other programs
> >>> and libraries. It is not simply contained or limited to OpenLDAP.
> >>>
> >>> That's a big problem for testing a QA folks.
> >>
> >> Then the tests are broken, because these are not bugs.
> >
> > They are absolutely OpenLDAP bugs. The unaligned accesses are
> > Undefined Behavior.
>
> Simply because the C standard doesn't specify what the behavior is doesn't make it a bug.

The C standard does specify the behavior. It falls clearly in
Undefined Behavior.

> It would be unreasonable to expect the standards body to exhaustively list all of the
> possible behaviors on all of the possible hardware architectures that the language is
> implemented for. Leaving it undefined in the spec only means they chose not to specify
> a behavior. That means the actual behavior depends on the underlying machine. On the
> x86 family the behavior is well defined.

You seem to have a misunderstanding of the standard and unaligned
accesses. You also seem to be conflating two different concepts.

First, unaligned accesses, are undefined behavior. They are forbidden
by the standard in 6.3.2.3 Pointers:

    7. A pointer to an object type may be converted to
    a pointer to a different object type. If the resulting pointer
    is not correctly aligned for the referenced type, the
    behavior is undefined.

And Appendix J.2, Undefined Behavior, says:

    Conversion between two pointer types produces a result
    that is incorrectly aligned (6.3.2.3).

You are violating the C standard in macros like COPY_PGNO. Effectively
you are casting a uint8_t array to an uint16_t*. You cannot do that
because uint16_t* increases the alignment requirements.

Tools like UBsan are telling you when you violate the rules. They
specifically flagged COPY_PGNO as incurring undefined behavior. (Tools
like UBsan will miss some UB, but that's a different error and not
applicable to this discussion).

You insistence on claiming the code is correct is befuddling. You are
effectively saying the world is wrong, including the C standard, the
compiler writers, other projects, the QA personnel testing the
software and users like me.

There's nothing special about me being wrong. I've had to acknowledged
that often. However, I would take pause in claiming the C standard is
wrong or the compiler writers, like GCC and LLVM devs, are wrong.
That's pretty bold.

Second, conflating concepts, is the difference between the C standard
and processor capabilities. The C code has undefined behavior, and it
does not matter what the processor is capable of.

And it does not matter if the compiler decides to generate code that
performs unaligned accesses. The compiler is free to do what it wants,
even when it frustrates the user or makes the user envious. However,
you cannot wrote code that uses unaligned objects even though the
compiler may generate equivalent code.

Jeff

Comment 15 Howard Chu 2019-06-08 07:47:31 UTC
Jeffrey Walton wrote:
> On Fri, Jun 7, 2019 at 2:37 PM Howard Chu <hyc@symas.com> wrote:
>>
>> Jeffrey Walton wrote:
>>> On Fri, Jun 7, 2019 at 10:08 AM Howard Chu <hyc@symas.com> wrote:
>>>>
>>>> Jeffrey Walton wrote:
>>>>> On Fri, Jun 7, 2019 at 9:59 AM Howard Chu <hyc@symas.com> wrote:
>>>>>>
>>>>>> noloader@gmail.com wrote:
>>>>>>> On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
>>>>>>>>
>>>>>>>> noloader@gmail.com wrote:
>>>>>>>> ...
>>>>>>>>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
>>>>>>>>> important project, and the undefined behavior is causing too many
>>>>>>>>> tangential problems.
>>>>>>>>
>>>>>>>> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
>>>>>>>> part of the language for its intended use as a system programming language, writing
>>>>>>>> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.
>>>>>>>
>>>>>>> I don't believe this is correct.
>>>>>>>
>>>>>>> Maybe you are thinking of implementation defined behavior?
>>>>>>
>>>>>> That would apply to how a particular compiler implementation treats some piece of code.
>>>>>> Whether a CPU supports unaligned access is machine-defined. Since our code is already
>>>>>> properly ifdef'd for the machines which do or don't support it, the fact that this is
>>>>>> "non-portable" is not an issue.
>>>>>
>>>>> The undefined behavior is causing OpenLDAP to fail testing.
>>>>>
>>>>> Worse, it is causing test failures in programs and libraries which use
>>>>> OpenLDAP. The OpenLDAP bugs have cross-pollinated into other programs
>>>>> and libraries. It is not simply contained or limited to OpenLDAP.
>>>>>
>>>>> That's a big problem for testing a QA folks.
>>>>
>>>> Then the tests are broken, because these are not bugs.
>>>
>>> They are absolutely OpenLDAP bugs. The unaligned accesses are
>>> Undefined Behavior.
>>
>> Simply because the C standard doesn't specify what the behavior is doesn't make it a bug.
> 
> The C standard does specify the behavior. It falls clearly in
> Undefined Behavior.

The fact a behavior is undefined does not make it illegal.

> And Appendix J.2, Undefined Behavior, says:
> 
>     Conversion between two pointer types produces a result
>     that is incorrectly aligned (6.3.2.3).
> 
> You are violating the C standard in macros like COPY_PGNO. Effectively
> you are casting a uint8_t array to an uint16_t*. You cannot do that
> because uint16_t* increases the alignment requirements.

All internal fields of LMDB are (at least) 2-byte aligned, so these copies always
meet alignment requirements.

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 16 noloader@gmail.com 2019-06-08 08:02:58 UTC
On Sat, Jun 8, 2019 at 3:47 AM Howard Chu <hyc@symas.com> wrote:
>
> Jeffrey Walton wrote:
> > On Fri, Jun 7, 2019 at 2:37 PM Howard Chu <hyc@symas.com> wrote:
> >>
> >> Jeffrey Walton wrote:
> >>> On Fri, Jun 7, 2019 at 10:08 AM Howard Chu <hyc@symas.com> wrote:
> >>>>
> >>>> Jeffrey Walton wrote:
> >>>>> On Fri, Jun 7, 2019 at 9:59 AM Howard Chu <hyc@symas.com> wrote:
> >>>>>>
> >>>>>> noloader@gmail.com wrote:
> >>>>>>> On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
> >>>>>>>>
> >>>>>>>> noloader@gmail.com wrote:
> >>>>>>>> ...
> >>>>>>>>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
> >>>>>>>>> important project, and the undefined behavior is causing too many
> >>>>>>>>> tangential problems.
> >>>>>>>>
> >>>>>>>> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
> >>>>>>>> part of the language for its intended use as a system programming language, writing
> >>>>>>>> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.
> >>>>>>>
> >>>>>>> I don't believe this is correct.
> >>>>>>>
> >>>>>>> Maybe you are thinking of implementation defined behavior?
> >>>>>>
> >>>>>> That would apply to how a particular compiler implementation treats some piece of code.
> >>>>>> Whether a CPU supports unaligned access is machine-defined. Since our code is already
> >>>>>> properly ifdef'd for the machines which do or don't support it, the fact that this is
> >>>>>> "non-portable" is not an issue.
> >>>>>
> >>>>> The undefined behavior is causing OpenLDAP to fail testing.
> >>>>>
> >>>>> Worse, it is causing test failures in programs and libraries which use
> >>>>> OpenLDAP. The OpenLDAP bugs have cross-pollinated into other programs
> >>>>> and libraries. It is not simply contained or limited to OpenLDAP.
> >>>>>
> >>>>> That's a big problem for testing a QA folks.
> >>>>
> >>>> Then the tests are broken, because these are not bugs.
> >>>
> >>> They are absolutely OpenLDAP bugs. The unaligned accesses are
> >>> Undefined Behavior.
> >>
> >> Simply because the C standard doesn't specify what the behavior is doesn't make it a bug.
> >
> > The C standard does specify the behavior. It falls clearly in
> > Undefined Behavior.
>
> The fact a behavior is undefined does not make it illegal.

A program with undefined behavior is, by definition, and illegal program.

> > And Appendix J.2, Undefined Behavior, says:
> >
> >     Conversion between two pointer types produces a result
> >     that is incorrectly aligned (6.3.2.3).
> >
> > You are violating the C standard in macros like COPY_PGNO. Effectively
> > you are casting a uint8_t array to an uint16_t*. You cannot do that
> > because uint16_t* increases the alignment requirements.
>
> All internal fields of LMDB are (at least) 2-byte aligned, so these copies always
> meet alignment requirements.

No, they are not. Some of them are 1-byte aligned. UBsan tells you that.

Others require 4-byte alignment. UBsan tells you that, too.

Jeff

Comment 17 Howard Chu 2019-06-08 09:15:20 UTC
Jeffrey Walton wrote:
> On Sat, Jun 8, 2019 at 3:47 AM Howard Chu <hyc@symas.com> wrote:
>>
>> Jeffrey Walton wrote:
>>> On Fri, Jun 7, 2019 at 2:37 PM Howard Chu <hyc@symas.com> wrote:
>>>>
>>>> Jeffrey Walton wrote:
>>>>> On Fri, Jun 7, 2019 at 10:08 AM Howard Chu <hyc@symas.com> wrote:
>>>>>>
>>>>>> Jeffrey Walton wrote:
>>>>>>> On Fri, Jun 7, 2019 at 9:59 AM Howard Chu <hyc@symas.com> wrote:
>>>>>>>>
>>>>>>>> noloader@gmail.com wrote:
>>>>>>>>> On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
>>>>>>>>>>
>>>>>>>>>> noloader@gmail.com wrote:
>>>>>>>>>> ...
>>>>>>>>>>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
>>>>>>>>>>> important project, and the undefined behavior is causing too many
>>>>>>>>>>> tangential problems.
>>>>>>>>>>
>>>>>>>>>> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
>>>>>>>>>> part of the language for its intended use as a system programming language, writing
>>>>>>>>>> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.
>>>>>>>>>
>>>>>>>>> I don't believe this is correct.
>>>>>>>>>
>>>>>>>>> Maybe you are thinking of implementation defined behavior?
>>>>>>>>
>>>>>>>> That would apply to how a particular compiler implementation treats some piece of code.
>>>>>>>> Whether a CPU supports unaligned access is machine-defined. Since our code is already
>>>>>>>> properly ifdef'd for the machines which do or don't support it, the fact that this is
>>>>>>>> "non-portable" is not an issue.
>>>>>>>
>>>>>>> The undefined behavior is causing OpenLDAP to fail testing.
>>>>>>>
>>>>>>> Worse, it is causing test failures in programs and libraries which use
>>>>>>> OpenLDAP. The OpenLDAP bugs have cross-pollinated into other programs
>>>>>>> and libraries. It is not simply contained or limited to OpenLDAP.
>>>>>>>
>>>>>>> That's a big problem for testing a QA folks.
>>>>>>
>>>>>> Then the tests are broken, because these are not bugs.
>>>>>
>>>>> They are absolutely OpenLDAP bugs. The unaligned accesses are
>>>>> Undefined Behavior.
>>>>
>>>> Simply because the C standard doesn't specify what the behavior is doesn't make it a bug.
>>>
>>> The C standard does specify the behavior. It falls clearly in
>>> Undefined Behavior.
>>
>> The fact a behavior is undefined does not make it illegal.
> 
> A program with undefined behavior is, by definition, and illegal program.

This is pure nonsense. You realize, don't you, that the C spec has no definition
of threads? All multithreaded programs are using undefined behavior. And yet
here we are, using threads for over 2 decades.

The gcc/clang folks have their heads up their asses. They've deliberately
misinterpreted the spec claiming undefined behaviors are forbidden, supposedly
to enable essential optimizations. Most of which only apply to obscure corner
cases in compiler benchmark suites, that nobody in the real world ever benefits from.

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 18 openldap-technical@kolttonen.fi 2020-02-02 19:08:27 UTC
Hello,

On Sat, 8 Jun 2019, hyc@symas.com wrote:

> The gcc/clang folks have their heads up their asses. They've 
> deliberately misinterpreted the spec claiming undefined behaviors are 
> forbidden, supposedly to enable essential optimizations. Most of which 
> only apply to obscure corner cases in compiler benchmark suites, that 
> nobody in the real world ever benefits from.

I realize this thread is very old, but Jeff and the C compiler folks are 
right. All C programs that invoke undefined behavior are illegal C 
programs and should be fixed.

Posix threads are well-defined by Posix standards, so calling them 
"undefined behaviour" is not a valid argument.

Best regards,
Jokke Hämäläinen
Comment 19 openldap-technical@kolttonen.fi 2020-02-02 20:17:53 UTC

On Sun, 2 Feb 2020, openldap-technical@kolttonen.fi wrote:

> I realize this thread is very old, but Jeff and the C compiler folks are 
> right. All C programs that invoke undefined behavior are illegal C 
> programs and should be fixed.
> 
> Posix threads are well-defined by Posix standards, so calling them 
> "undefined behaviour" is not a valid argument.

To make it clear that UB in C programs is horrible, let me provide a real 
world example of UB: Cyrus IMAPD had an unnoticed dormant strcpy() related 
UB bug for several years. You see, the manual page of strcpy() says that 
the src and dst strings must not overlap, or else the C program invokes 
UB.

For many years, Cyrus operated correctly even though the src and dst 
strings *did* overlap in one part of their database code. UB of course 
allows this behaviour too. The reason was because GNU libc folks had 
written their strcpy() implementation in such a way that breaking the 
contract of having non-overlapping strings did not cause any problems.

Then, years later, GNU libc folks deciced to optimize (or otherwise 
change) their strcpy() implementation. Now the new implementation punished 
all UB invokers, and we saw our Cyrus mailbox database slowly but surely 
getting corrupted.

It is indeed shocking to hear that LMDB implementation invokes UB. GCC and 
Clang could change their behaviour tomorrow, and LMDB could get corrupted, 
crash or whatever. And certainly the blame would be on LMDB code, not the 
compiler writers.

Best Regards,
Jokke Hämäläinen
Comment 20 Howard Chu 2020-02-03 16:15:12 UTC
openldap-technical@kolttonen.fi wrote:
>   This message is in MIME format.  The first part should be readable text,
>   while the remaining parts are likely unreadable without MIME-aware tools.
> 
> ---1463811718-806940296-1580670508=:196090
> Content-Type: text/plain; charset=ISO-8859-15
> Content-Transfer-Encoding: 8BIT
> 
> 
> Hello,
> 
> On Sat, 8 Jun 2019, hyc@symas.com wrote:
> 
>> The gcc/clang folks have their heads up their asses. They've 
>> deliberately misinterpreted the spec claiming undefined behaviors are 
>> forbidden, supposedly to enable essential optimizations. Most of which 
>> only apply to obscure corner cases in compiler benchmark suites, that 
>> nobody in the real world ever benefits from.
> 
> I realize this thread is very old, but Jeff and the C compiler folks are 
> right. All C programs that invoke undefined behavior are illegal C 
> programs and should be fixed.
> 
> Posix threads are well-defined by Posix standards, so calling them 
> "undefined behaviour" is not a valid argument.

No. The POSIX spec is *not* a part of the C spec - yet it is still valid.
Which simply proves the point that just because something is not defined
in the C spec does not make it invalid. The compiler guys are idiots for
taking this position.

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 21 openldap-technical@kolttonen.fi 2020-02-03 18:39:46 UTC
Hello,

On Mon, 3 Feb 2020, hyc@symas.com wrote:

> No. The POSIX spec is *not* a part of the C spec - yet it is still valid.

POSIX spec *is* a C standard that exists in addition to the ISO C 
standard. ISO C defines the so-called "basic language and features" of C 
if you can call it that.

> Which simply proves the point that just because something is not defined
> in the C spec does not make it invalid. The compiler guys are idiots for
> taking this position.

Like Jeff already said, wrongly aligned object access *is* defined by the 
ISO C specification. It is wrong and explicitly defined as Undefined 
Behaviour. Invoking UB is playing with fire, and calling compiler writers 
with offending names does not change that fact at all.

Spending long time on comp.lang.c should be mandatory for all C 
programmers out there. It is shocking to invoke UB and not bother to fix 
it, instead blaming compiler writers and C standard writers.

Best regards,
Jokke Hämäläinen
Comment 22 noloader@gmail.com 2021-12-17 01:49:06 UTC
On Fri, Jun 7, 2019 at 9:59 AM Howard Chu <hyc@symas.com> wrote:
>
> noloader@gmail.com wrote:
> > On Fri, Jun 7, 2019 at 9:32 AM Howard Chu <hyc@symas.com> wrote:
> >>
> >> noloader@gmail.com wrote:
> >> ...
> >>> I encourage OpenLDAP to fix the undefined behavior. OpenLDAP is an
> >>> important project, and the undefined behavior is causing too many
> >>> tangential problems.
> >>
> >> Undefined behavior is not a bug, nor is it prohibited by the C spec. It is a necessary
> >> part of the language for its intended use as a system programming language, writing
> >> machine-specific programs. Anyone who says it is prohibited by the spec is wrong.

The kernel recently got bitten using the same pattern of unaligned
short pointers through casts. GCC produced code which corrupted
initramfs during unpacking.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100363.

OpenLDAP should fix that code.
Comment 23 Howard Chu 2022-01-06 17:16:12 UTC
> Running slapadd to build slapd database...
../../../libraries/liblmdb/mdb.c:7544:26: runtime error: member access within
misaligned address 0x0000023fe67a for type 'struct MDB_page', which requires 8
byte alignment
0x0000023fe67a: note: pointer points here
 00 00  00 00 03 00 00 00 00 00  00 00 00 00 52 00 10 00  66 00 00 00 00 00 00
00  00 00 00 00 00 00

The code in question is accessing an unsigned short on a 2 byte boundary. I.e., its alignment is correct. UBsan is incorrect here.
Comment 24 Howard Chu 2022-11-14 11:37:42 UTC
(In reply to openldap-technical@kolttonen.fi from comment #21)
> Hello,

> Spending long time on comp.lang.c should be mandatory for all C 
> programmers out there. It is shocking to invoke UB and not bother to fix 
> it, instead blaming compiler writers and C standard writers.
> 
> Best regards,
> Jokke Hämäläinen

I'm quite sure I've spent more time on comp.lang.c than most people out there.

https://groups.google.com/g/comp.lang.c/c/BiVJrHbtZE4/m/W1C3fC-n2pEJ

https://groups.google.com/g/comp.lang.c/c/3TGIxk3epBw/m/CXVzV5aEehsJ

...

I was also a gcc maintainer from gcc 1.x to 2.x days.