oxidecomputer / oxidecomputer/opte

Unexpected dynamic dependency on `libm.so.2` for opteadm debug variant

Open
#465 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
77
Forks
11
Avg merge
9d 20h
Merged PRs (30d)
8

Description

After including the debug variant in the opte package we've learned that opteadm compiled in debug mode includes a dependency on libm.so.2, leading to oxidecomputer/helios-omicron-brand#13. This is not present in the release variant of opteadm.

I did some digging and this behaviour is present from c0564a0 onwards. Specifically, calling cargo update from its predecessor (258a8b5) is sufficient. The only individual crate I've found with this dependency is num_enum_derive (the release-built crate has the same dependency):

kyle@farme:~/gits/opte$ elfdump -d target/debug/deps/libnum_enum_derive-610c1d435ea8a838.so

Dynamic Section:  .dynamic
     index  tag                value
       [0]  NEEDED            0x1c2307            libsocket.so.1
       [1]  NEEDED            0x1c2346            librt.so.1
       [2]  NEEDED            0x1c235a            libpthread.so.1
       [3]  NEEDED            0x1c2373            libumem.so.1
       [4]  NEEDED            0x1c2380            libgcc_s.so.1
       [5]  NEEDED            0x1c23a8            libm.so.2
       [6]  NEEDED            0x1c23b2            libc.so.1
       [7]  INIT              0x72ffc0
       [8]  FINI              0x72ffd0
       [9]  RUNPATH           0x1c2426            /usr/gcc/12/lib/amd64
      [10]  RPATH             0x1c2426            /usr/gcc/12/lib/amd64
      [11]  HASH              0xcef40
      [12]  STRTAB            0x157448
      [13]  STRSZ             0x1c263c
      [14]  SYMTAB            0x104318
      [15]  SYMENT            0x18
      [16]  SUNW_SYMTAB       0xeaa58
      [17]  SUNW_SYMSZ        0x6c9f0
      [18]  SUNW_SORTENT      0x4
      [19]  SUNW_SYMSORT      0x320b70
      [20]  SUNW_SYMSORTSZ    0x11dbc
      [21]  CHECKSUM          0x93b2
      [22]  VERNEED           0x319a88
      [23]  VERNEEDNUM        0x7
      [24]  RELACOUNT         0x128a
      [25]  FINI_ARRAY        0x7adaa8
      [26]  FINI_ARRAYSZ      0x8
      [27]  INIT_ARRAY        0x7adab0
      [28]  INIT_ARRAYSZ      0x8
      [29]  PLTRELSZ          0x42be8
      [30]  PLTREL            0x7
      [31]  JMPREL            0x357f68
      [32]  RELA              0x332930
      [33]  RELASZ            0x68220
      [34]  RELAENT           0x18
      [35]  SYMINFO           0xc11b8
      [36]  SYMINSZ           0xdd88
      [37]  SYMINENT          0x4
      [38]  FLAGS             0                   0
      [39]  FLAGS_1           0                   0
      [40]  SUNW_STRPAD       0x200
      [41]  SUNW_LDMACH       0x3e                EM_AMD64
      [42]  PLTGOT            0x797000
   [43-53]  NULL              0

This is currently used by:

kyle@farme:~/gits/opte$ cargo tree -i num_enum_derive
num_enum_derive v0.5.11 (proc-macro)
└── num_enum v0.5.11
    ├── dlpi v0.2.0 (https://github.com/oxidecomputer/dlpi-sys#1d587ea9)
    │   └── libnet v0.1.0 (https://github.com/oxidecomputer/netadm-sys#d44d9e08)
    │       ├── opte-ioctl v0.1.0 (/develop/gits/opte/lib/opte-ioctl)
    │       │   └── opteadm v0.2.0 (/develop/gits/opte/bin/opteadm)
    │       └── opteadm v0.2.0 (/develop/gits/opte/bin/opteadm)
    └── libnet v0.1.0 (https://github.com/oxidecomputer/netadm-sys#d44d9e08) (*)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the debug and release builds of opteadm and inspect their dynamic dependencies with elfdump. Trace the cargo dependency tree from opteadm and opte-ioctl through libnet, dlpi, num_enum, and num_enum_derive, focusing on the cargo update change from 258a8b5 to c0564a0. Done means the debug variant no longer introduces the unexpected libm.so.2 dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.