qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] linux-user/elfload: Fix handling of pure BSS segments


From: Alex Bennée
Subject: Re: [PATCH] linux-user/elfload: Fix handling of pure BSS segments
Date: Wed, 25 Nov 2020 09:39:38 +0000
User-agent: mu4e 1.5.7; emacs 28.0.50

Stephen Long <steplong@quicinc.com> writes:

> Hi Peter, 
>
>> (a) what does "fails to load" mean here? In the sample binary
>> I had, we got a SIGSEGV in zero_bss() when it tried to memset()
>> memory that hadn't been mmap()ed. Is that the only failure mode,
>> or can this manifest in other ways too?
>
> Apologies for the unclear commit msg. I was also seeing a SIGSEGV in
> zero_bss() with the binaries I was generating. I was using LLD to generate
> the binaries. The binaries all had LOAD segments with a file size of
> 0.

How hairy is the generation of these binaries? If it's all doable with
standard gcc/ldd command lines it would be useful to add them as a
tcg/multiarch test case.

>
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=919921 was the thread that
> Philippe pointed me to with the requested change that solved my issue.
>
>> (b) The comment immediately before this change says:
>>    * Some segments may be completely empty without any backing file
>>    * segment, in that case just let zero_bss allocate an empty buffer
>>    * for it.
>> which is justifying why it was looking at p_filesz and not vaddr_len.
>> With this change to the code, the comment becomes stale and needs
>> updating.
>
> I'll update the comment and the commit msg if this change makes sense to
> everybody.
>
>> (c) After this change, are there still cases where zero_bss()
>> needs to do its mmap()/page_set_flags(), or does that become
>> unnecessary ?
>
> Maybe someone else can speak to this. But, you might be right. I don't see
> this being necessary anymore.
>
> Thanks,
> Stephen


-- 
Alex Bennée



reply via email to

[Prev in Thread] Current Thread [Next in Thread]