[uClibc] Re: [grsec] crt1S.S file for uClibc

Peter S. Mazinger ps.m at gmx.net
Wed Oct 15 18:52:19 UTC 2003


On Tue, 14 Oct 2003 pageexec at freemail.hu wrote:

> initfini.awk splits up initfini.S into crti.S and crtn.S. these
> files contain among others the epilogue and prologue code for _init
> and _fini, respectively. the problem is that the epilogues contain
> garbage code which causes an early termination (return from) the
> given functions without properly cleaning up the stack and hence
> execution flow ends up in some data segment and gets killed under
> PaX or causes a SIGSEGV otherwise. the garbage code in question is
> nothing else but the helper function used in PIC self-position
> calculation. this helper code gets emitted just before the
> prologue normally but due to the bug it ends up in the epilogues
> as well.
> 
> what goes into crtn.S is controlled by the 'omitcrtn' variable in
> the awk script. i believe the problem is that it is set/reset at
> the wrong place. in particular, this line is wrong:
> 
> /_init:/||/_fini:/{omitcrtn=1}
> 
> by the time the lines matching this are emitted, it's too late,
> the PIC helper function has been emitted into crtn.S as well
> and will cause premature function return.
> 
> my suggested fix is to use this instead the above line:
> 
> /_init_PROLOG_BEGINS/{omitcrti=0;print ".section .init" >> "crtn.S";getline}
> /_fini_PROLOG_BEGINS/{omitcrti=0;print ".section .fini" >> "crtn.S";getline}

With the suggested change I get on building in the directory libpthread
multiple definitions of _init and _fini.
Maybe the suggested change does not need defining usage of crti.o and 
crtn.o on building this library (START_FILES/END_FILES in Makefile)?

Peter

-- 
Peter S. Mazinger <ps.m at gmx.net>   ID: 0xA5F059F2    NIC: IXUYHSKQLI
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2


____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu



More information about the uClibc mailing list