From: Pavel Machek <pavel@denx.de>
To: Ulrich Hecht <uli@fpond.eu>
Cc: cip-dev@lists.cip-project.org,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
Florian Bezdeka <florian.bezdeka@siemens.com>,
Chris Paterson <Chris.Paterson2@renesas.com>,
Hung Tran <hung.tran.jy@renesas.com>,
Pavel Machek <pavel@denx.de>
Subject: Re: [cip-dev] ldconfig segfault on RZ/Five was Re: Preparing isar-cip-core for RZ/Five
Date: Thu, 13 Oct 2022 23:47:37 +0200 [thread overview]
Message-ID: <20221013214737.GC14791@duo.ucw.cz> (raw)
In-Reply-To: <1263180941.78238.1665650193479@webmail.strato.com>
[-- Attachment #1: Type: text/plain, Size: 2906 bytes --]
Hi!
> > On 10/12/2022 11:50 AM CEST Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> > I did a quick test with the patches pointed by Florian but unfortunately ldconfig still fails.
>
> I did some experiments on RZ/Five with this issue, and I'm almost positive that there is something wrong (or doesn't work as documented) with the icache handling on this SoC.
>
> 1. The issue only affects non-PIE executables (there are very few of those, basically just ldconfig, gcc, cpp and gcov* on the Debian system), and it occurs very early during the execution of the program. According to the datasheet, the cache on the ax45mp-1c core is virtually indexed, so it is unlikely that a PIE executable will ever hit anything in the cache when newly loaded, but it is much more likely with non-PIE executables.
>
This is very good observation. Thanks!
And indeed it looks like _any_ non-PIE executable fails. See:
root@smarc-rzfive:/my# cat mytest.c
#include <stdio.h>
void main(void) { printf("ahoj svete\n"); }
root@smarc-rzfive:/my# clang mytest.c -fno-pie -static
mytest.c:3:1: warning: return type of 'main' is not 'int' [-Wmain-return-type]
void main(void) { printf("ahoj svete\n"); }
^
mytest.c:3:1: note: change return type to 'int'
void main(void) { printf("ahoj svete\n"); }
^~~~
int
1 warning generated.
root@smarc-rzfive:/my# ./a.out
[ 279.010424] a.out[214]: unhandled signal 11 code 0x1 at 0xffffff8c38bd1524
(-O3 -g might be useful to add to clang command line).
Then you can
b _dl_discover_osversion
run
(gdb) disassemble /r
Dump of assembler code for function _dl_discover_osversion:
0x000000000002538a <+0>: 41 71 addi sp,sp,-496
0x000000000002538c <+2>: a8 00 addi a0,sp,72
0x000000000002538e <+4>: 86 f7 sd ra,488(sp)
0x0000000000025390 <+6>: a2 f3 sd s0,480(sp)
0x0000000000025392 <+8>: a6 ef sd s1,472(sp)
0x0000000000025394 <+10>: ca eb sd s2,464(sp)
=> 0x0000000000025396 <+12>: ef 60 a1 5c jal ra,0x3b960 <uname>
0x000000000002539a <+16>: 93 05 a1 0c addi a1,sp,202
0x000000000002539e <+20>: 49 e5 bnez a0,0x25428 <_dl_discover_osversion+158>
0x00000000000253a0 <+22>: 81 48 li a7,0
0x00000000000253a2 <+24>: 01 45 li a0,0
0x00000000000253a4 <+26>: 25 48 li a6,9
0x00000000000253a6 <+28>: 13 03 e0 02 li t1,46
It clearly tries to call uname, which.. it should, according to the
source code. But somehow it ends up in completely different function:
(gdb) stepi
Program received signal SIGILL, Illegal instruction.
0x000000000003b2fe in wcsrtombs ()
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2022-10-13 21:47 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 18:36 Preparing isar-cip-core for RZ/Five Jan Kiszka
2022-10-03 20:12 ` Chris Paterson
2022-10-04 7:15 ` Jan Kiszka
2022-10-04 18:28 ` Jan Kiszka
2022-10-04 19:36 ` Jan Kiszka
2022-10-04 19:47 ` Jan Kiszka
2022-10-05 18:21 ` Pavel Machek
2022-10-06 6:29 ` Jan Kiszka
2022-10-06 6:49 ` Jan Kiszka
2022-10-06 7:07 ` Jan Kiszka
2022-10-06 7:08 ` Prabhakar Mahadev Lad
2022-10-06 7:26 ` Jan Kiszka
2022-10-06 11:43 ` Pavel Machek
2022-10-06 11:51 ` Jan Kiszka
2022-10-06 22:07 ` ldconfig segfault on RZ/Five was " Pavel Machek
2022-10-06 22:32 ` Pavel Machek
2022-10-07 8:18 ` Jan Kiszka
2022-10-07 10:19 ` Pavel Machek
2022-10-08 8:27 ` Jan Kiszka
2022-10-09 8:29 ` Jan Kiszka
2022-10-09 8:42 ` [cip-dev] " Biju Das
2022-10-11 9:30 ` Jan Kiszka
2022-10-11 10:34 ` Biju Das
2022-10-11 18:51 ` Florian Bezdeka
2022-10-11 20:15 ` Jan Kiszka
2022-10-11 20:48 ` Prabhakar Mahadev Lad
2022-10-12 9:50 ` Prabhakar Mahadev Lad
2022-10-13 8:36 ` Ulrich Hecht
2022-10-13 10:35 ` Pavel Machek
2022-10-13 21:47 ` Pavel Machek [this message]
2022-11-29 18:57 ` Prabhakar Mahadev Lad
2022-12-10 7:23 ` Jan Kiszka
2022-12-10 20:25 ` Pavel Machek
2022-12-12 13:51 ` Prabhakar Mahadev Lad
2022-12-12 13:24 ` Prabhakar Mahadev Lad
2022-10-09 19:20 ` Chris Paterson
2022-10-05 5:43 ` [cip-dev] " Biju Das
2022-10-04 22:30 ` Prabhakar Mahadev Lad
2022-10-05 5:45 ` Jan Kiszka
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=20221013214737.GC14791@duo.ucw.cz \
--to=pavel@denx.de \
--cc=Chris.Paterson2@renesas.com \
--cc=cip-dev@lists.cip-project.org \
--cc=florian.bezdeka@siemens.com \
--cc=hung.tran.jy@renesas.com \
--cc=jan.kiszka@siemens.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=uli@fpond.eu \
/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