From: Pavel Machek <pavel@denx.de>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Pavel Machek <pavel@denx.de>, Ulrich Hecht <uli@fpond.eu>,
"cip-dev@lists.cip-project.org" <cip-dev@lists.cip-project.org>,
Florian Bezdeka <florian.bezdeka@siemens.com>,
Chris Paterson <Chris.Paterson2@renesas.com>,
Hung Tran <hung.tran.jy@renesas.com>
Subject: Re: RE: [cip-dev] ldconfig segfault on RZ/Five was Re: Preparing isar-cip-core for RZ/Five
Date: Sat, 10 Dec 2022 21:25:56 +0100 [thread overview]
Message-ID: <Y5TrVMvSR9ytEp4I@duo.ucw.cz> (raw)
In-Reply-To: <b38ebaa1-bb3f-f2d8-b200-0cdd18cf07cd@siemens.com>
[-- Attachment #1: Type: text/plain, Size: 2751 bytes --]
Hi!
> >> This is very good observation. Thanks!
> >>
> >> And indeed it looks like _any_ non-PIE executable fails. See:
> >>
> >
> > Just a brief about the issue and solution:
> >
> > TEXT_START_ADDR is the start of text segment of an application. This is being set to 0x10000 for RISCV platforms.
> >
> > So when an application is compiled with the static flag the load would start from 0x10000 - xyz (depending on size of the application)
> >
> > Entry point 0x101c0
> > There are 5 program headers, starting at offset 64Program Headers:
> > Type Offset VirtAddr PhysAddr
> > FileSiz MemSiz Flags Align
> > LOAD 0x0000000000000000 0x0000000000010000 0x0000000000010000
> > 0x0000000000059b48 0x0000000000059b48 R E 0x1000
> > LOAD 0x0000000000059b60 0x000000000006ab60 0x000000000006ab60
> > 0x0000000000001f68 0x0000000000003528 RW 0x1000
> > So for the above application which is compiled statically we can see the entry point is 0x101c0 and load 0x0000000000010000.
> >
> > Andes cores have local memories ILM and DLM that are mapped in the
> >>region H'0_0003_0000 - H'0_0004_FFFF on the RZ/Five SoC. When the
> >>virtual address falls in this range the MMU doesnt trigger a page
> >>fault and assume the virtual address as physical address and hence
> >>the application fails to run (panics somewhere).
...
> Good that the issue is understood and likely solved now. Make sure to
> upstream this as quickly as possible. It targets a fundamental tool and
> requires recompilation of many components. And Debian will freeze the
> toolchain in early January - although:
>
> "It is unlikely that the release arch of bookworm will include riscv64."
> [1] :(
I'm pretty sure this is not complete fix. Yes, we should change the
toolchain, but the problem is really in the hardware: you can't just
take part of _virtual_ address space and reserve it. Not if you want
to claim board is riscv64 compatible. Someone else (manual mmap, some
kind of JIT, some kind of emulator) might want normal RAM there.
I believe this is quite important and should be solved in hardware (at
least in next generation).
Can ILM/DLM be disabled?
If we can not fix it at hardware level, we'll really need to prevent
attempts to map anything at that virtual memory range. Clear -EPERM
from mmap is better than strange behaviour at runtime, and it is
must-have from security perspective.
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-12-10 20:26 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
2022-11-29 18:57 ` Prabhakar Mahadev Lad
2022-12-10 7:23 ` Jan Kiszka
2022-12-10 20:25 ` Pavel Machek [this message]
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=Y5TrVMvSR9ytEp4I@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