From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Tom Turelinckx <tom-HiypchcOusz53ZRCpReHOg@public.gmane.org>
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: bus error on sparc64 running type-preservation test
Date: Tue, 14 Apr 2020 16:25:34 +1000 [thread overview]
Message-ID: <20200414062534.GL48061@umbus.fritz.box> (raw)
In-Reply-To: <002001d611b0$c2dd7d20$48987760$@turelinckx.be>
[-- Attachment #1: Type: text/plain, Size: 2453 bytes --]
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-04-14 6:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-13 16:09 bus error on sparc64 running type-preservation test Tom Turelinckx
2020-04-13 16:29 ` Tom Turelinckx
2020-04-14 6:25 ` David Gibson [this message]
[not found] ` <20200414062534.GL48061-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2020-04-14 16:34 ` Tom Turelinckx
[not found] ` <4c0be4b4-7f6e-4612-af7b-dfffb400597a-jFIJ+Wc5/Vo7lZ9V/NTDHw@public.gmane.org>
2020-04-21 3:22 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200414062534.GL48061@umbus.fritz.box \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tom-HiypchcOusz53ZRCpReHOg@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).