From: Christophe Saout <christophe@saout.de>
To: Denis Vlasenko <vda@ilport.com.ua>
Cc: Andrew Morton <akpm@osdl.org>, Jan Hubicka <hubicka@ucw.cz>,
Gerold Jury <gerold.ml@inode.at>,
jakub@redhat.com,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
gcc@gcc.gnu.org
Subject: [BUG mm] "fixed" i386 memcpy inlining buggy
Date: Tue, 05 Apr 2005 18:34:04 +0200 [thread overview]
Message-ID: <1112718844.22591.15.camel@leto.cs.pocnet.net> (raw)
In-Reply-To: <200504021526.53990.vda@ilport.com.ua>
[-- Attachment #1: Type: text/plain, Size: 1798 bytes --]
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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2005-04-05 16:34 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-29 14:37 memcpy(a,b,CONST) is not inlined by gcc 3.4.1 in Linux kernel Denis Vlasenko
2005-03-29 15:06 ` Richard Guenther
2005-03-29 15:08 ` Nathan Sidwell
2005-03-29 15:13 ` Jakub Jelinek
2005-03-29 15:42 ` Andrew Pinski
2005-03-30 2:27 ` Gerold Jury
2005-03-30 6:15 ` Denis Vlasenko
2005-04-01 21:43 ` Jan Hubicka
2005-04-02 12:18 ` Denis Vlasenko
2005-04-02 12:26 ` Denis Vlasenko
2005-04-05 16:34 ` Christophe Saout [this message]
2005-04-06 10:14 ` [BUG mm] "fixed" i386 memcpy inlining buggy Denis Vlasenko
2005-04-06 11:05 ` Dave Korn
2005-04-06 11:13 ` Dave Korn
2005-04-06 11:53 ` Dave Korn
2005-04-06 11:56 ` Dave Korn
2005-04-06 13:18 ` Richard B. Johnson
2005-04-06 14:16 ` Denis Vlasenko
2005-04-06 12:05 ` Christophe Saout
2005-04-06 12:36 ` Andrew Haley
2005-04-06 15:18 ` Paolo Bonzini
2005-04-06 16:11 ` Denis Vlasenko
2005-03-29 20:22 ` [PATCH] fix i386 memcpy Denis Vlasenko
2005-03-29 20:24 ` Denis Vlasenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1112718844.22591.15.camel@leto.cs.pocnet.net \
--to=christophe@saout.de \
--cc=akpm@osdl.org \
--cc=gcc@gcc.gnu.org \
--cc=gerold.ml@inode.at \
--cc=hubicka@ucw.cz \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vda@ilport.com.ua \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®