[Bug 1792306] [NEW] ltrace prints wrong operands in calloc calls

Yury Gribov tetra2005 at gmail.com
Thu Sep 13 07:09:48 UTC 2018


Public bug reported:

Ltrace in Ubuntu 18 prints meaningless value of first operand (nmemb) of
calloc call:

yugr at yugr-VirtualBox:~$ ltrace -e calloc ls
libc.so.6->calloc(140737455811080, 64)                                                                                        = 0x7ffffe0f6a0d

I would expect a much smaller value and indeed gdb reports completely
different numbers:

yugr at yugr-VirtualBox:~$ gdb ls
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ls...(no debugging symbols found)...done.
(gdb) b calloc
Breakpoint 1 at 0x3b00
(gdb) r
Starting program: /bin/ls 

Breakpoint 1, calloc (nmemb=nmemb at entry=1425, size=size at entry=1) at dl-minimal.c:92
92	dl-minimal.c: No such file or directory.
(gdb) c
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=1169, size=size at entry=1) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=1184, size=size at entry=1) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=1178, size=size at entry=1) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=1181, size=size at entry=1) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=1179, size=size at entry=1) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=1184, size=size at entry=1) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=8, size=size at entry=24) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=3, size=size at entry=24) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=11, size=size at entry=24) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=32, size=size at entry=24) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=8, size=size at entry=24) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=10, size=size at entry=24) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=6, size=size at entry=24) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=19, size=size at entry=24) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=1056, size=size at entry=1) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Breakpoint 1, calloc (nmemb=nmemb at entry=18, size=size at entry=16) at dl-minimal.c:92
92	in dl-minimal.c
(gdb) 
Continuing.

Additional info:

yugr at yugr-VirtualBox:~$ lsb_release -rd
Description:	Ubuntu 18.04.1 LTS
Release:	18.04

yugr at yugr-VirtualBox:~$ apt-cache policy ltrace
ltrace:
  Installed: 0.7.3-6ubuntu1
  Candidate: 0.7.3-6ubuntu1
  Version table:
 *** 0.7.3-6ubuntu1 500
        500 http://gb.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: ltrace 0.7.3-6ubuntu1
ProcVersionSignature: Ubuntu 4.15.0-33.36-generic 4.15.18
Uname: Linux 4.15.0-33-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.2
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Thu Sep 13 07:58:16 2018
InstallationDate: Installed on 2018-09-01 (11 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
SourcePackage: ltrace
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: ltrace (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug bionic

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ltrace in Ubuntu.
https://bugs.launchpad.net/bugs/1792306

Title:
  ltrace prints wrong operands in calloc calls

Status in ltrace package in Ubuntu:
  New

Bug description:
  Ltrace in Ubuntu 18 prints meaningless value of first operand (nmemb)
  of calloc call:

  yugr at yugr-VirtualBox:~$ ltrace -e calloc ls
  libc.so.6->calloc(140737455811080, 64)                                                                                        = 0x7ffffe0f6a0d

  I would expect a much smaller value and indeed gdb reports completely
  different numbers:

  yugr at yugr-VirtualBox:~$ gdb ls
  GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
  Copyright (C) 2018 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
  and "show warranty" for details.
  This GDB was configured as "x86_64-linux-gnu".
  Type "show configuration" for configuration details.
  For bug reporting instructions, please see:
  <http://www.gnu.org/software/gdb/bugs/>.
  Find the GDB manual and other documentation resources online at:
  <http://www.gnu.org/software/gdb/documentation/>.
  For help, type "help".
  Type "apropos word" to search for commands related to "word"...
  Reading symbols from ls...(no debugging symbols found)...done.
  (gdb) b calloc
  Breakpoint 1 at 0x3b00
  (gdb) r
  Starting program: /bin/ls 

  Breakpoint 1, calloc (nmemb=nmemb at entry=1425, size=size at entry=1) at dl-minimal.c:92
  92	dl-minimal.c: No such file or directory.
  (gdb) c
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=1169, size=size at entry=1) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=1184, size=size at entry=1) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=1178, size=size at entry=1) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=1181, size=size at entry=1) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=1179, size=size at entry=1) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=1184, size=size at entry=1) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=8, size=size at entry=24) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=3, size=size at entry=24) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=11, size=size at entry=24) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=32, size=size at entry=24) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=8, size=size at entry=24) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=10, size=size at entry=24) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=6, size=size at entry=24) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=19, size=size at entry=24) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=1056, size=size at entry=1) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Breakpoint 1, calloc (nmemb=nmemb at entry=18, size=size at entry=16) at dl-minimal.c:92
  92	in dl-minimal.c
  (gdb) 
  Continuing.

  Additional info:

  yugr at yugr-VirtualBox:~$ lsb_release -rd
  Description:	Ubuntu 18.04.1 LTS
  Release:	18.04

  yugr at yugr-VirtualBox:~$ apt-cache policy ltrace
  ltrace:
    Installed: 0.7.3-6ubuntu1
    Candidate: 0.7.3-6ubuntu1
    Version table:
   *** 0.7.3-6ubuntu1 500
          500 http://gb.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
          100 /var/lib/dpkg/status

  ProblemType: Bug
  DistroRelease: Ubuntu 18.04
  Package: ltrace 0.7.3-6ubuntu1
  ProcVersionSignature: Ubuntu 4.15.0-33.36-generic 4.15.18
  Uname: Linux 4.15.0-33-generic x86_64
  ApportVersion: 2.20.9-0ubuntu7.2
  Architecture: amd64
  CurrentDesktop: ubuntu:GNOME
  Date: Thu Sep 13 07:58:16 2018
  InstallationDate: Installed on 2018-09-01 (11 days ago)
  InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
  SourcePackage: ltrace
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ltrace/+bug/1792306/+subscriptions



More information about the foundations-bugs mailing list