[devel] mutt1.5-3:1.5.18-alt3: i586 rebuild failed [1]

Alexey I. Froloff =?iso-8859-1?q?raorn_=CE=C1_altlinux=2Eru?=
Вс Ноя 9 16:04:11 MSK 2008


* 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 at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.altlinux.org/pipermail/devel/attachments/20081109/5e2d55f8/attachment.bin>


Подробная информация о списке рассылки Devel