[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re: [PATCH] linux-user/elfload: Fix handling of pure BSS segments
From: |
Stephen Long |
Subject: |
Re: Re: [PATCH] linux-user/elfload: Fix handling of pure BSS segments |
Date: |
Tue, 24 Nov 2020 10:47:54 -0800 |
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.
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