On Mon, Apr 13, 2020 at 06:29:52PM +0200, Tom Turelinckx wrote: > I wrote: > > > I have no idea how to fix this, but the following gdb backtrace (from v1.6.0) may help someone else: > > With -O0: > > Reading symbols from dtc... > (gdb) r -I dts -O dts -o tests/type-preservation.dts.test.dts tests/type-preservation.dts > Starting program: /build/device-tree-compiler-1.6.0/dtc -I dts -O dts -o tests/type-preservation.dts.test.dts tests/type-preservation.dts > > Program received signal SIGBUS, Bus error. > 0x0000010000017f2c in write_propval_int (f=0x1000012e300, p=0x100001348af "", len=4, width=4) at treesource.c:116 > 116 fprintf(f, "0x%02"PRIx32, fdt32_to_cpu(*(const fdt32_t*)p)); > (gdb) bt > #0 0x0000010000017f2c in write_propval_int (f=0x1000012e300, p=0x100001348af "", len=4, width=4) at treesource.c:116 > #1 0x0000010000018704 in write_propval (f=0x1000012e300, prop=0x100001348e0) at treesource.c:251 > #2 0x0000010000018b8c in write_tree_source_node (f=0x1000012e300, tree=0x10000134960, level=3) at treesource.c:310 > #3 0x0000010000018c04 in write_tree_source_node (f=0x1000012e300, tree=0x10000134a30, level=2) at treesource.c:314 > #4 0x0000010000018c04 in write_tree_source_node (f=0x1000012e300, tree=0x10000134b20, level=1) at treesource.c:314 > #5 0x0000010000018c04 in write_tree_source_node (f=0x1000012e300, tree=0x10000134c10, level=0) at treesource.c:314 > #6 0x0000010000018e28 in dt_to_source (f=0x1000012e300, dti=0x100001325c0) at treesource.c:344 > #7 0x0000010000005f1c in main (argc=8, argv=0x7fefffff528) at dtc.c:351 Yeah, it definitely looks like an alignment problem. The 'p' parameter to write_propval_int() is not 4-byte aligned, but width == 4, which means it will attempt to read from p as a 32-bit integer pointer. Some grepping also suggests several other places in dtc which could suffer from the same problem, though I suspect they're less likely to trigger. I've just merged and pushed a change which I think will fix this to the master branch. Could you build and test that please? If you can make a minimal testcase which triggers this problem and submit it as an addition to the dtc testsuite, that would be terrific. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature