OpenAMP / open-amp

The main OpenAMP library implementing RPMSG, Virtio, and Remoteproc for RTOS etc
https://www.openampproject.org/
Other
678 stars 278 forks source link

Fixes #550: OpenAMP elf loader loads ELF sections to their load addresses #551

Closed UmairKhanUET closed 4 months ago

UmairKhanUET commented 4 months ago

Unlike the Linux rproc elf loader, the OpenAMP elf loader loads the remote elf program segments to their load addresses instead of their link addresses. This results in memory corruption when the remote firmware attempts to relocate segments from their link addresses to load addresses at runtime such as the data section.

Signed-off-by: Umair Khan umair_khan@mentor.com

tnmysh commented 4 months ago

Yes, I will get back on this. I was wondering how its working without this patch.

@bentheredonethat FYI.

arnopo commented 4 months ago

Yes, I will get back on this. I was wondering how its working without this patch.

@bentheredonethat FYI.

Probably because you have same memory mapping regarding the main and remote processor.

UmairKhanUET commented 4 months ago

Yes, I will get back on this. I was wondering how its working without this patch.

@bentheredonethat FYI.

May be because generally when firmware runs out of RAM, the ELF sections are placed at same link and load addresses. But it doesn't stop one from having different addresses either. May be this is the first time we are seeing such a case.

arnopo commented 4 months ago

LGTM, @tnmysh , @edmooring could you verify that this does not introduce regression on yopur platforms?

@tnmysh , @edmooring, @bentheredonethat : Gentle reminder

tnmysh commented 4 months ago

@arnopo I have been trying to look for history on when this code was used on Xilinx's platforms. I can't find it being used currently or anytime in near past. It's very hard to prepare setup for this atleast with 2023 petalinux.

The code looks okay for me, and we don't have any use case currently that is practicing this code. I am okay with code, and sure no regression will happen on xlnx platforms as it's not being used.

arnopo commented 4 months ago

Thanks @edmooring and @tnmysh for the feedback.

We have to find a way to better test it. Look to me that the load code could be optimized to make this more simple with less footprint. let's add this in agenda of next open-amp meeting call.