[PING][PATCH] Refactor debug routines.
Ondřej Bílka
neleai@seznam.cz
Wed Oct 30 15:12:00 GMT 2013
On Wed, Oct 23, 2013 at 01:15:56AM +0200, OndÅej BÃlka wrote:
> Hi,
>
> After I looked at generic and x86-64 code I found following problems.
> a) Performance. Performance of checking memset_chk and memcpy_chk is
> comparable to nonchecking ones. A strcpy_chk on benchtests is much
> slower than stupid variant. Other functions are also slow because debug
> has often byte-by-byte implementation.
> b) Extensibility. Adding overlap checks is easier to add in c than
> assembly.
>
> A solution is to write functions in style of bounds check followed by
> jump to corresponding routine.
> This should produce identic assembly as assembly files in ideal case,
> unfortunately gcc (or our annotations) contains a bug and does not issue
> tailcall. Code for memset is following
>
> 0000000000000000 <__memset_chk>:
> 0: 48 83 ec 08 sub $0x8,%rsp
> 4: 48 39 d1 cmp %rdx,%rcx
> 7: 72 09 jb 12 <__memset_chk+0x12>
> 9: 48 83 c4 08 add $0x8,%rsp
> d: e9 00 00 00 00 jmpq 12 <__memset_chk+0x12>
> 12: e8 00 00 00 00 callq 17 <__memset_chk+0x17>
>
>
>
More information about the Libc-alpha
mailing list