[Bug 1992939] Re: ltrace produces no debug output at all, workaround is compiling with "-fcf-protection=none"

Ravi Kant Sharma 1992939 at bugs.launchpad.net
Fri Jan 12 11:48:55 UTC 2024


** Description changed:

+ [ Impact ]
+ 
+  * ltrace on Intel executable on current Ubuntu produces no debug
+ output.
+ 
+  * The patch introduces handling of two PLTs on an Intel CET binary.
+ This requires enabling ARCH_HAVE_LTELF_DATA on x86.
+ 
+ [ Test Plan ]
+ 
+ I'm not sufficiently knowledgeable about this matter to be considered an
+ expert. I "trust" the patch and the bug reporter. I did sufficient
+ testing to make sure the patch fixes the issue, and it doesn't introduce
+ any obvious regression.
+ 
+  * instructions how to reproduce the bug
+  
+  ** run `ltrace ls` on any of the affected release. It will not produce any debug output.
+  ** run ltrace on a hello built using (gcc hello.c -o hello). It will not produce any debug output.
+  ** to see what is the expected output, compile hello.c with -fcf-protection=none. `gcc -fcf-protection=none -o hello hello.c`, then run `ltrace hello`
+  ** another way to see the expected output is to run ltrace on Ubuntu Bionic release. (CET was not enabled by default here in gcc)
+ 
+  * testing the fix
+  ** run the same commands with patched ltrace. It should output the debug symbols.
+  ** steps to build ltrace locally on noble/devel and test
+  *** clone the repo (git ubuntu clone ltrace ltrace-gu)
+  *** checkout the branch fix-devel-1992939
+  *** apply all patches (quilt push -a)
+  *** ./configure && make
+  *** ./ltrace <path to hello.out> (should produce debug output)
+  *** ./ltrace ls (should produce debug output)
+ 
+  * I also did the following regressions tests.
+  ** build a hello (gcc version Ubuntu 7.3.0-16ubuntu3) binary on bionic (mk-sbuild bionic and schroot) and run it with patched ltrace built on noble. it should produce debug output.
+  ** I did the same for Jammy and Focal.
+  ** Compile a hello binary with -fcf-protection=none and ran it with patched ltrace. it should produce debug output.
+ 
+ [ Where problems could occur ]
+ 
+  * There could be a problem if a user is depending on
+ ARCH_HAVE_LTELF_DATA for x86 being disabled. The chances are very low
+ though. It has been enabled upstream for since 2013.
+ 
+ [ Other Info ]
+  
+  * There is a workaround to see debug symbols. Compiling with -fcf-protection=none. See Original bug description for more.
+ 
+ [ Original bug description ]
+ 
  Hello,
  
  Running ltrace on any executable on current Ubuntu produces no debug output at all.
  I have verified the behavior shown below on kinetic and focal.
  Compiling with "-fcf-protection=none" seems to be a workaround.
  The breakage seems to be related to "Intel CET Support" and the following upstream patch seems relevant:
  https://gitlab.com/cespedes/ltrace/-/commit/ec563704ab5ef48bf308924de4ef021c4d0cd2af
  
  More information on how to reproduce follows:
  
  *** kinetic
  
  # cat /etc/os-release
  PRETTY_NAME="Ubuntu Kinetic Kudu (development branch)"
  NAME="Ubuntu"
  VERSION_ID="22.10"
  VERSION="22.10 (Kinetic Kudu)"
  VERSION_CODENAME=kinetic
  ID=ubuntu
  ID_LIKE=debian
  HOME_URL="https://www.ubuntu.com/"
  SUPPORT_URL="https://help.ubuntu.com/"
  BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
  PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
  UBUNTU_CODENAME=kinetic
  LOGO=ubuntu-logo
  
  # apt install ltrace
  Reading package lists... Done
  Building dependency tree... Done
  Reading state information... Done
  ltrace is already the newest version (0.7.3-6.1ubuntu6).
  0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  
  # ltrace ls -d .
  .
  +++ exited (status 0) +++
  
- 
  FAIL:
  
  $ gcc -o hello hello.c
  $ ltrace ./hello
  Hello, World!
  +++ exited (status 0) +++
  
  SUCCESS:
  
  $ gcc -fcf-protection=none -o hello hello.c
  $ ltrace ./hello
  puts("Hello, World!"Hello, World!
  )                                                                    = 14
  +++ exited (status 0) +++
  
  Thank you,
  Vangelis
  
  ProblemType: Bug
  DistroRelease: Ubuntu 22.10
  Package: ltrace 0.7.3-6.1ubuntu6
  Uname: Linux 5.4.72-microsoft-standard-WSL2 x86_64
  ApportVersion: 2.23.1-0ubuntu3
  Architecture: amd64
  CasperMD5CheckResult: unknown
  Date: Fri Oct 14 06:40:46 2022
  ProcEnviron:
-  TERM=xterm
-  PATH=(custom, no user)
+  TERM=xterm
+  PATH=(custom, no user)
  SourcePackage: ltrace
  UpgradeStatus: No upgrade log present (probably fresh install)

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

Title:
  ltrace produces no debug output at all, workaround is compiling with
  "-fcf-protection=none"

Status in ltrace package in Ubuntu:
  Triaged
Status in ltrace source package in Focal:
  New
Status in ltrace source package in Jammy:
  New
Status in ltrace source package in Lunar:
  New
Status in ltrace source package in Mantic:
  New
Status in ltrace source package in Noble:
  Triaged

Bug description:
  [ Impact ]

   * ltrace on Intel executable on current Ubuntu produces no debug
  output.

   * The patch introduces handling of two PLTs on an Intel CET binary.
  This requires enabling ARCH_HAVE_LTELF_DATA on x86.

  [ Test Plan ]

  I'm not sufficiently knowledgeable about this matter to be considered
  an expert. I "trust" the patch and the bug reporter. I did sufficient
  testing to make sure the patch fixes the issue, and it doesn't
  introduce any obvious regression.

   * instructions how to reproduce the bug
   
   ** run `ltrace ls` on any of the affected release. It will not produce any debug output.
   ** run ltrace on a hello built using (gcc hello.c -o hello). It will not produce any debug output.
   ** to see what is the expected output, compile hello.c with -fcf-protection=none. `gcc -fcf-protection=none -o hello hello.c`, then run `ltrace hello`
   ** another way to see the expected output is to run ltrace on Ubuntu Bionic release. (CET was not enabled by default here in gcc)

   * testing the fix
   ** run the same commands with patched ltrace. It should output the debug symbols.
   ** steps to build ltrace locally on noble/devel and test
   *** clone the repo (git ubuntu clone ltrace ltrace-gu)
   *** checkout the branch fix-devel-1992939
   *** apply all patches (quilt push -a)
   *** ./configure && make
   *** ./ltrace <path to hello.out> (should produce debug output)
   *** ./ltrace ls (should produce debug output)

   * I also did the following regressions tests.
   ** build a hello (gcc version Ubuntu 7.3.0-16ubuntu3) binary on bionic (mk-sbuild bionic and schroot) and run it with patched ltrace built on noble. it should produce debug output.
   ** I did the same for Jammy and Focal.
   ** Compile a hello binary with -fcf-protection=none and ran it with patched ltrace. it should produce debug output.

  [ Where problems could occur ]

   * There could be a problem if a user is depending on
  ARCH_HAVE_LTELF_DATA for x86 being disabled. The chances are very low
  though. It has been enabled upstream for since 2013.

  [ Other Info ]
   
   * There is a workaround to see debug symbols. Compiling with -fcf-protection=none. See Original bug description for more.

  [ Original bug description ]

  Hello,

  Running ltrace on any executable on current Ubuntu produces no debug output at all.
  I have verified the behavior shown below on kinetic and focal.
  Compiling with "-fcf-protection=none" seems to be a workaround.
  The breakage seems to be related to "Intel CET Support" and the following upstream patch seems relevant:
  https://gitlab.com/cespedes/ltrace/-/commit/ec563704ab5ef48bf308924de4ef021c4d0cd2af

  More information on how to reproduce follows:

  *** kinetic

  # cat /etc/os-release
  PRETTY_NAME="Ubuntu Kinetic Kudu (development branch)"
  NAME="Ubuntu"
  VERSION_ID="22.10"
  VERSION="22.10 (Kinetic Kudu)"
  VERSION_CODENAME=kinetic
  ID=ubuntu
  ID_LIKE=debian
  HOME_URL="https://www.ubuntu.com/"
  SUPPORT_URL="https://help.ubuntu.com/"
  BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
  PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
  UBUNTU_CODENAME=kinetic
  LOGO=ubuntu-logo

  # apt install ltrace
  Reading package lists... Done
  Building dependency tree... Done
  Reading state information... Done
  ltrace is already the newest version (0.7.3-6.1ubuntu6).
  0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

  # ltrace ls -d .
  .
  +++ exited (status 0) +++

  FAIL:

  $ gcc -o hello hello.c
  $ ltrace ./hello
  Hello, World!
  +++ exited (status 0) +++

  SUCCESS:

  $ gcc -fcf-protection=none -o hello hello.c
  $ ltrace ./hello
  puts("Hello, World!"Hello, World!
  )                                                                    = 14
  +++ exited (status 0) +++

  Thank you,
  Vangelis

  ProblemType: Bug
  DistroRelease: Ubuntu 22.10
  Package: ltrace 0.7.3-6.1ubuntu6
  Uname: Linux 5.4.72-microsoft-standard-WSL2 x86_64
  ApportVersion: 2.23.1-0ubuntu3
  Architecture: amd64
  CasperMD5CheckResult: unknown
  Date: Fri Oct 14 06:40:46 2022
  ProcEnviron:
   TERM=xterm
   PATH=(custom, no user)
  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/1992939/+subscriptions




More information about the foundations-bugs mailing list