This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Encoding page size in the ELF header


Hi -

> > >>> Could the app more portably use
> > >>> int critical_data __attribute__((section(".data.critical")));
> > >>> and maybe a linker script widgetry to assure padding [...]
> [...]
> To see why, suppose I have the following PT_LOAD segments:
> 
>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>   LOAD           0x000000 0x00000000 0x00000000 0x84cc4 0x84cc4 R E 0x1000
>   LOAD           0x085000 0x00085000 0x00085000 0x00458 0x0240c RW  0x1000

> [...] But the largest power of 2 to which 0x85000 is
> aligned is 0x1000 (4k); 0x85000 mod 0x2000 is 0x1000. Thus it's
> impossible for both load segments to be simultaneously aligned mod
> 0x2000 or any larger power of two.

An application that wishes to protect itself against larger page
sizes, but still play page-protection tricks, can include pessimistic
padding (ahead and/or behind) for its mprotecty sections, basically
hard-coding a maximum acceptable page size.  If the data protection
with current tooling is that important, they can probably afford even
a 1MB page full of padding/alignment.

- FChE


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]