--- Begin Message ---
Source: libi8x
Version: 0.0.5-1
Severity: important
User: [email protected]
Usertags: alignment
Hi!
I've been doing a full rebuild of the Debian archive, building all
source packages targeting armel and armhf using arm64 hardware. We are
planning in future to move all of our 32-bit armel/armhf builds to
using arm64 machines, so this rebuild is to identify packages that
might have problems with this configuration.
A feature of the arm64 kernel is that it does *not* support fixing up
code with broken alignment, so code that might have built and run OK
on our older armel/armhf build machines due to kernel fixups will now
fail.
When building your package, I've found a bus error (aka alignment
fault). The full log is online at
https://www.einval.com/debian/arm/rebuild-logs/armel/FAIL/libi8x_0.0.5-1_armel.log
for reference
I've done a quick bit of debugging to find the source of the
bug. Here's a gdb stacktrace and variable printout to demonstrate the
problem.
(sid-armel)steve@mjolnir:~/debian/build/libi8x/libi8x-0.0.5$ gdb
/home/steve/debian/build/libi8x/libi8x-0.0.5/tests/valid/.libs/test-corpus
tests/core
GNU gdb (Debian 8.2-1) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from
/home/steve/debian/build/libi8x/libi8x-0.0.5/tests/valid/.libs/test-corpus...done.
[New LWP 5680]
Core was generated by
`/home/steve/debian/build/libi8x/libi8x-0.0.5/tests/valid/.libs/test-corpus'.
Program terminated with signal SIGBUS, Bus error.
#0 0xf7a9a0a8 in i8x_rb_read_int64_t (rb=rb@entry=0x1e57bc0,
result=0xff7f4af8, result@entry=0xff7f4af0)
at readbuf.c:158
158 I8X_RB_READ_FIXED_MULTI (64)
warning: File "/home/steve/debian/build/libi8x/libi8x-0.0.5/.gdbinit"
auto-loading has been declined by your `auto-load safe-path' set to
"$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path
/home/steve/debian/build/libi8x/libi8x-0.0.5/.gdbinit
line to your configuration file "/home/steve/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/steve/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
(gdb) bt
#0 0xf7a9a0a8 in i8x_rb_read_int64_t (rb=rb@entry=0x1e57bc0,
result=0xff7f4af8, result@entry=0xff7f4af0)
at readbuf.c:158
#1 0xf7a8d888 in i8x_code_read_operand (rb=0x1e57bc0, type=I8X_OPR_INT64,
operand=operand@entry=0x1e57988,
code=<optimized out>) at code.c:246
#2 0xf7a8e3a4 in i8x_code_unpack_bytecode (code=0x1e57908) at code.c:376
#3 i8x_code_init (code=0x1e57908) at code.c:757
#4 i8x_code_new (func=func@entry=0x1e57718, code=code@entry=0x1e57744) at
code.c:831
#5 0xf7a972d4 in i8x_bcf_init (func=0x1e57718) at function.c:143
#6 i8x_func_new_bytecode (note=<optimized out>, func=0xff7f4bf8) at
function.c:185
#7 0x0058ad1c in do_test (ctx=0x1dda150,
filename=0x1ddaec8
"corpus/i8c/0.0.3/32el/test_load_constant/test_output/0027-0001") at
valid/test-corpus.c:104
#8 0x0058b094 in ftw_callback (fpath=0x1ddaec8
"corpus/i8c/0.0.3/32el/test_load_constant/test_output/0027-0001",
sb=sb@entry=0xff7f6c50, typeflag=<optimized out>) at valid/test-corpus.c:142
#9 0xf7a023fc in process_entry (data=data@entry=0xff7f7290,
dir=dir@entry=0xff7f6d08,
name=name@entry=0x1e3f8fb "0027-0001", namlen=<optimized out>, d_type=8) at
ftw.c:464
#10 0xf7a0284c in ftw_dir (data=data@entry=0xff7f7290, st=0x8,
st@entry=0xff7f6d58,
old_dir=0xf7ae1968 <__stack_chk_guard>, old_dir@entry=0xff7f6e08) at
ftw.c:543
#11 0xf7a02584 in process_entry (data=data@entry=0xff7f7290,
dir=dir@entry=0xff7f6e08, name=<optimized out>,
name@entry=0x1e4adf3 "test_output", namlen=<optimized out>, d_type=4) at
ftw.c:461
#12 0xf7a0284c in ftw_dir (data=data@entry=0xff7f7290, st=0x4,
st@entry=0xff7f6e58,
old_dir=0xf7ae1968 <__stack_chk_guard>, old_dir@entry=0xff7f6f08) at
ftw.c:543
#13 0xf7a02584 in process_entry (data=data@entry=0xff7f7290,
dir=dir@entry=0xff7f6f08, name=<optimized out>,
name@entry=0x1df4333 "test_load_constant", namlen=<optimized out>,
d_type=4) at ftw.c:461
#14 0xf7a0284c in ftw_dir (data=data@entry=0xff7f7290, st=0x4,
st@entry=0xff7f6f58, old_dir=0xf7ae1968 <__stack_chk_guard>,
old_dir@entry=0xff7f7008) at ftw.c:543
#15 0xf7a02584 in process_entry (data=data@entry=0xff7f7290,
dir=dir@entry=0xff7f7008, name=<optimized out>,
name@entry=0x1debfe3 "32el", namlen=<optimized out>, d_type=4) at ftw.c:461
#16 0xf7a0284c in ftw_dir (data=data@entry=0xff7f7290, st=0x4,
st@entry=0xff7f7058,
old_dir=0xf7ae1968 <__stack_chk_guard>, old_dir@entry=0xff7f7108) at
ftw.c:543
#17 0xf7a02584 in process_entry (data=data@entry=0xff7f7290,
dir=dir@entry=0xff7f7108, name=<optimized out>,
name@entry=0x1de3f93 "0.0.3", namlen=<optimized out>, d_type=4) at ftw.c:461
#18 0xf7a0284c in ftw_dir (data=data@entry=0xff7f7290, st=0x4,
st@entry=0xff7f7158,
old_dir=0xf7ae1968 <__stack_chk_guard>, old_dir@entry=0xff7f7208) at
ftw.c:543
#19 0xf7a02584 in process_entry (data=data@entry=0xff7f7290,
dir=dir@entry=0xff7f7208, name=<optimized out>,
name@entry=0x1ddbf4b "i8c", namlen=<optimized out>, d_type=4) at ftw.c:461
#20 0xf7a0284c in ftw_dir (data=data@entry=0xff7f7290, st=0x4,
old_dir=0xf7ae1968 <__stack_chk_guard>,
old_dir@entry=0x0) at ftw.c:543
#21 0xf7a030b0 in ftw_startup (dir=<optimized out>, is_nftw=is_nftw@entry=0,
func=<optimized out>,
descriptors=<optimized out>, flags=flags@entry=0) at ftw.c:768
#22 0xf7a03248 in ftw64 (path=<optimized out>, func=<optimized out>,
descriptors=<optimized out>) at ftw.c:817
#23 0x0058b134 in i8x_validation_test (ctx=<optimized out>) at
valid/test-corpus.c:157
#24 0x0058b6e0 in i8x_validation_test_main () at libi8x-test.c:147
#25 0x0058aa24 in main (argc=<optimized out>, argv=<optimized out>) at
../libi8x-test/validation-test.h:32
(gdb) list
153 I8X_RB_READ_FIXED_MULTI_1 (int ## SIZE ## _t, bswap_ ## SIZE)
\
154 I8X_RB_READ_FIXED_MULTI_1 (uint ## SIZE ## _t, bswap_ ## SIZE)
155
156 I8X_RB_READ_FIXED_MULTI (16)
157 I8X_RB_READ_FIXED_MULTI (32)
158 I8X_RB_READ_FIXED_MULTI (64)
159
160 I8X_EXPORT i8x_err_e
161 i8x_rb_read_sleb128 (struct i8x_readbuf *rb, intptr_t *rp)
162 {
(gdb)
163 const char *ptr = rb->ptr;
164 intptr_t result = 0;
165 int shift = 0;
166
167 while (1)
168 {
169 uint8_t byte;
170 i8x_err_e err;
171
172 err = i8x_rb_read_uint8_t (rb, &byte);
(gdb) p tmp
$1 = <optimized out>
(gdb) p rb
$2 = (struct i8x_readbuf *) 0x1e57bc0
(gdb) p result
$3 = (int64_t *) 0xff7f4af8
(gdb) p *result
$4 = 42809880576
(gdb) p rb
$5 = (struct i8x_readbuf *) 0x1e57bc0
(gdb) p *rb
$6 = {_ob = {ops = 0xf7aaeec0 <i8x_readbuf_ops>, parent = 0x1e574b0, refcount =
{1, 0}, userdata = 0x0,
userdata_cleanup = 0x0, use_debug_allocator = true, is_moribund = false,
is_poisoned = false},
start = 0x1e0c141 "\017", limit = 0x1e0c14a "\001\002\004\006", ptr =
0x1e0c142 "",
byte_order = I8X_BYTE_ORDER_NATIVE}
Looks like rb->ptr is bogus, not aligned.
-- System Information:
Debian Release: 9.6
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.9.0-8-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8),
LANGUAGE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
--- End Message ---