Stephen Long <stepl...@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