This is the mail archive of the
mailing list for the glibc project.
[PING^2][PATCH] Refactor debug routines.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-alpha at sourceware dot org
- Date: Tue, 5 Nov 2013 14:57:14 +0100
- Subject: [PING^2][PATCH] Refactor debug routines.
- Authentication-results: sourceware.org; auth=none
- References: <20131022231556 dot GA5840 at domone dot podge> <20131030151153 dot GA15937 at domone dot podge>
On Wed, Oct 30, 2013 at 04:11:53PM +0100, OndÅej BÃlka wrote:
> 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>
Of course it doesn't work. We've performed a software upgrade.