Hi Denis, the new i386 memcpy macro is a ticking timebomb. I've been debugging a new mISDN crash, just to find out that a memcpy was not inlined correctly. Andrew, you should drop the fix-i386-memcpy.patch (or have it fixed). This source code: mISDN_pid_t pid; [...] memcpy(&st->mgr->pid, &pid, sizeof(mISDN_pid_t)); was compiled as: lea 0xffffffa4(%ebp),%esi <---- %esi is loaded ( add $0x10,%ebx ) ( mov %ebx,%eax ) something else ( call 1613 <test_stack_protocol+0x83> ) %esi preserved mov 0xffffffa0(%ebp),%edx mov 0x74(%edx),%edi <---- %edi is loaded add $0x20,%edi offset in structure added ! mov $0x14,%esi !!!!!! <---- %esi overwritten! mov %esi,%ecx <---- %ecx loaded repz movsl %ds:(%esi),%es:(%edi) Apparently the compiled decided that the value 0x14 could be reused afterwards (which it does for an inlined memset of the same size some instructions below) and clobbers %esi. Looking at the macro: __asm__ __volatile__( "" : "=&D" (edi), "=&S" (esi) : "0" ((long) to),"1" ((long) from) : "memory" ); } if (n >= 5*4) { /* large block: use rep prefix */ int ecx; __asm__ __volatile__( "rep ; movsl" : "=&c" (ecx) it seems obvious that the compiled assumes it can reuse %esi and %edi for something else between the two __asm__ sections. These should probably be merged.
Attachment:
signature.asc
Description: This is a digitally signed message part
- Follow-Ups:
- Re: [BUG mm] "fixed" i386 memcpy inlining buggy
- From: Denis Vlasenko <[email protected]>
- Re: [BUG mm] "fixed" i386 memcpy inlining buggy
- From: Denis Vlasenko <[email protected]>
- Re: [BUG mm] "fixed" i386 memcpy inlining buggy
- References:
- Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel
- From: Jan Hubicka <[email protected]>
- Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel
- From: Denis Vlasenko <[email protected]>
- Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel
- From: Denis Vlasenko <[email protected]>
- Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel
- Prev by Date: RFC: turn kmalloc+memset(,0,) into kcalloc
- Next by Date: RE: /proc on 2.4.21 & 2.6 kernels....
- Previous by thread: Re: memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel
- Next by thread: Re: [BUG mm] "fixed" i386 memcpy inlining buggy
- Index(es):