Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bz_internal_error exported #81

Open
nwalfield opened this issue May 3, 2022 · 1 comment
Open

bz_internal_error exported #81

nwalfield opened this issue May 3, 2022 · 1 comment

Comments

@nwalfield
Copy link

I develop rpm-sequoia, which is a Rust crate that implements rpm's OpenPGP API in terms of Sequoia PGP. (More details, unrelated to this issue, are described in this rpm issue).

rpm-sequoia should only export the rpm's PGP API. Unfortunately, a number of additional symbols are leaked by dependencies. Specifically, any symbols that have the #[no_mangle] attribute appear to be exported. bzip2-sys marks bz_internal_error like this, and thus it is exported by the library:

$ nm --defined-only --extern-only /tmp/rpm-sequoia/debug/librpm_sequoia.so | grep bz
0000000000361fa0 T bz_internal_error

In turns out that rpm-sequoia doesn't actually need compression support so I was able to workaround this issue by disabling that feature. But, this issue may trip up others.

@teythoon
Copy link

It also affects the Sequoia Octopus: https://gitlab.com/sequoia-pgp/sequoia-octopus-librnp/-/issues/68

$ cp $CARGO_TARGET_DIR/debug/libsequoia_octopus_librnp.so libsequoia_octopus_librnp.so
$ NEEDLESSLY_EXPORTED_SYMBOLS="$(readelf --dyn-syms libsequoia_octopus_librnp.so | grep -v UND | grep -v rnp_ | grep DEFAULT)"
$ echo "$NEEDLESSLY_EXPORTED_SYMBOLS"
   375: 0000000000f9e3a0   101 FUNC    GLOBAL DEFAULT   12 bz_internal_error
   433: 0000000001008d40   310 FUNC    GLOBAL DEFAULT   12 rust_eh_personality

(Excerpt from our CI build log: https://gitlab.com/sequoia-pgp/sequoia-octopus-librnp/-/jobs/3225827176#L432)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants