[PATCH] D44943: Fill the last page of each executable section with 0xcc or equivalent.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 30 01:03:00 PDT 2018
grimar added inline comments.
================
Comment at: lld/ELF/Writer.cpp:2209
+ continue;
+ if ((Sec->Offset + Sec->Size) % Target->PageSize == 0)
+ continue;
----------------
ruiu wrote:
> grimar wrote:
> > So, should this check be removed for simplicity of code?
> > (basing on comments, it makes no sense to have it, right?)
> >
> > Then, btw, code could be:
> >
> > ```
> > for (OutputSection *Sec : OutputSections)
> > if (Sec->PtLoad && Sec->PtLoad == PT_LOAD && (Sec->PtLoad->p_flags & PF_X))
> > fillTrap(Buf + alignDown(Sec->Offset + Sec->Size, Target->PageSize));
> > ```
> No it can't. If a section ends exactly at a page boundary, no padding is needed.
Ah, I see now, it would fill the next page with traps without this check.
https://reviews.llvm.org/D44943
More information about the llvm-commits
mailing list