This is the mail archive of the
mailing list for the glibc project.
[PING][PATCH] Refactor debug routines.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-alpha at sourceware dot org
- Date: Wed, 30 Oct 2013 16:11:53 +0100
- Subject: [PING][PATCH] Refactor debug routines.
- Authentication-results: sourceware.org; auth=none
- References: <20131022231556 dot GA5840 at domone dot podge>
On Wed, Oct 23, 2013 at 01:15:56AM +0200, OndÅej BÃlka wrote:
> 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
> 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>