From: "Alexey I. Froloff" <raorn@altlinux.ru>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] mutt1.5-3:1.5.18-alt3: i586 rebuild failed [1]
Date: Sun, 9 Nov 2008 16:04:11 +0300
Message-ID: <20081109130411.GR27961@altlinux.org> (raw)
In-Reply-To: <20081109120907.GB16160@wo.int.altlinux.org>
[-- Attachment #1: Type: text/plain, Size: 5581 bytes --]
* Dmitry V. Levin <ldv@> [081109 15:10]:
> Я пока не улавливаю суть происходящего с mutt_md5.
Код (md5_process_bytes):
/* Move remaining bytes in internal buffer. */
if (len > 0)
{
size_t left_over = ctx->buflen;
memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
left_over += len;
if (left_over >= 64)
{
md5_process_block (ctx->buffer, 64, ctx);
left_over -= 64;
memcpy (ctx->buffer, &ctx->buffer[16], left_over);
}
ctx->buflen = left_over;
}
Соответственно затык происходит на первом memcpy.
(gdb) run
Starting program: /home/raorn/src/gitsnaps/packages/mutt1.5/work/mutt-1.5.18/mutt_md5
foobar
Breakpoint 1, md5_process_bytes (buffer=0xbfd62df4, len=7, ctx=0xbfd63e3c) at md5.c:223
223 if (ctx->buflen != 0)
(gdb) nexti
220 {
(gdb)
0x080497ac 220 {
(gdb)
0x080497af 220 {
(gdb)
0x080497b2 220 {
(gdb)
223 if (ctx->buflen != 0)
(gdb)
0x080497b8 223 if (ctx->buflen != 0)
(gdb)
0x080497ba 223 if (ctx->buflen != 0)
(gdb)
247 if (len >= 64)
(gdb)
0x080497bf 247 if (len >= 64)
(gdb)
269 if (len > 0)
(gdb)
0x080497c3 269 if (len > 0)
(gdb)
271 size_t left_over = ctx->buflen;
(gdb)
52 return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
(gdb)
271 size_t left_over = ctx->buflen;
(gdb)
52 return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
(gdb)
0x080497e5 52 return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
(gdb)
0x080497e9 52 return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
(gdb)
274 left_over += len;
(gdb)
52 return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
(gdb)
0x080497f2 52 return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
(gdb)
^C
Program received signal SIGINT, Interrupt.
memcpy (__dest=0xbfd62df4, __src=0x7, __len=3218488892) at /usr/include/bits/string3.h:52
52 return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
Здесь __dest == buffer, __src == len, __len == ctx, т.е. то
самое, что передали в md5_process_bytes.
Результат (неполный) disasssemble:
0x080497a0 <md5_process_bytes+0>: push %ebp
0x080497a1 <md5_process_bytes+1>: mov %esp,%ebp
0x080497a3 <md5_process_bytes+3>: sub $0x28,%esp
0x080497a6 <md5_process_bytes+6>: mov 0x10(%ebp),%eax
0x080497a9 <md5_process_bytes+9>: mov %esi,0xfffffff8(%ebp)
0x080497ac <md5_process_bytes+12>: mov 0xc(%ebp),%esi
0x080497af <md5_process_bytes+15>: mov %ebx,0xfffffff4(%ebp)
0x080497b2 <md5_process_bytes+18>: mov %edi,0xfffffffc(%ebp)
0x080497b5 <md5_process_bytes+21>: mov 0x18(%eax),%edi
0x080497b8 <md5_process_bytes+24>: test %edi,%edi
0x080497ba <md5_process_bytes+26>: jne 0x8049830 <md5_process_bytes+144>
0x080497bc <md5_process_bytes+28>: cmp $0x3f,%esi
0x080497bf <md5_process_bytes+31>: ja 0x8049808 <md5_process_bytes+104>
0x080497c1 <md5_process_bytes+33>: test %esi,%esi
0x080497c3 <md5_process_bytes+35>: jne 0x80497d8 <md5_process_bytes+56>
0x080497c5 <md5_process_bytes+37>: mov 0xfffffff4(%ebp),%ebx
0x080497c8 <md5_process_bytes+40>: mov 0xfffffff8(%ebp),%esi
0x080497cb <md5_process_bytes+43>: mov 0xfffffffc(%ebp),%edi
0x080497ce <md5_process_bytes+46>: mov %ebp,%esp
0x080497d0 <md5_process_bytes+48>: pop %ebp
0x080497d1 <md5_process_bytes+49>: ret
0x080497d2 <md5_process_bytes+50>: lea 0x0(%esi),%esi
0x080497d8 <md5_process_bytes+56>: mov 0x10(%ebp),%eax
0x080497db <md5_process_bytes+59>: mov 0x8(%ebp),%edx
0x080497de <md5_process_bytes+62>: mov 0x18(%eax),%ebx
0x080497e1 <md5_process_bytes+65>: mov %esi,0x8(%esp)
0x080497e5 <md5_process_bytes+69>: mov %edx,0x4(%esp)
0x080497e9 <md5_process_bytes+73>: lea 0x1c(%eax,%ebx,1),%eax
0x080497ed <md5_process_bytes+77>: add %ebx,%esi
0x080497ef <md5_process_bytes+79>: mov %eax,(%esp)
0x080497f2 <md5_process_bytes+82>: call 0x8049650 <memcpy>
0x080497f7 <md5_process_bytes+87>: cmp $0x3f,%esi
А вот во что компилится вышеприведённый кусок кода без -O2:
0x08048a40 <md5_process_bytes+378>: mov 0x10(%ebp),%eax
0x08048a43 <md5_process_bytes+381>: mov 0x18(%eax),%eax
0x08048a46 <md5_process_bytes+384>: mov %eax,0xfffffff0(%ebp)
0x08048a49 <md5_process_bytes+387>: mov 0x10(%ebp),%eax
0x08048a4c <md5_process_bytes+390>: add $0x1c,%eax
0x08048a4f <md5_process_bytes+393>: mov %eax,%edx
0x08048a51 <md5_process_bytes+395>: add 0xfffffff0(%ebp),%edx
0x08048a54 <md5_process_bytes+398>: mov 0xc(%ebp),%eax
0x08048a57 <md5_process_bytes+401>: mov %eax,0x8(%esp)
0x08048a5b <md5_process_bytes+405>: mov 0x8(%ebp),%eax
0x08048a5e <md5_process_bytes+408>: mov %eax,0x4(%esp)
0x08048a62 <md5_process_bytes+412>: mov %edx,(%esp)
0x08048a65 <md5_process_bytes+415>: call 0x80483fc <memcpy@plt>
0x08048a6a <md5_process_bytes+420>: mov 0xc(%ebp),%eax
0x08048a6d <md5_process_bytes+423>: add %eax,0xfffffff0(%ebp)
0x08048a70 <md5_process_bytes+426>: cmpl $0x3f,0xfffffff0(%ebp)
Куда копать? (ц)
--
Regards,
Sir Raorn.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2008-11-09 13:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-08 20:31 ` Alexey I. Froloff
2008-11-08 20:41 ` Dmitry V. Levin
2008-11-08 22:26 ` Alexey I. Froloff
2008-11-08 22:33 ` Dmitry V. Levin
2008-11-09 11:31 ` Alexey I. Froloff
2008-11-09 12:09 ` Dmitry V. Levin
2008-11-09 13:04 ` Alexey I. Froloff [this message]
2008-11-09 13:38 ` Dmitry V. Levin
2008-11-09 13:54 ` Alexey I. Froloff
2008-11-09 21:15 ` Dmitry V. Levin
2008-11-09 22:27 ` Alexey I. Froloff
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=20081109130411.GR27961@altlinux.org \
--to=raorn@altlinux.ru \
--cc=devel@lists.altlinux.org \
/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
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git