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

patchelf breaks strongswan libraries #1480

Closed
tomaszrostanskithales opened this issue Dec 30, 2022 · 2 comments
Closed

patchelf breaks strongswan libraries #1480

tomaszrostanskithales opened this issue Dec 30, 2022 · 2 comments

Comments

@tomaszrostanskithales
Copy link

tomaszrostanskithales commented Dec 30, 2022

System (please complete the following information):

  • OS: OpenWRT 23.04
  • Kernel version (if applicable): 5.15
  • strongSwan version(s): 5.9.8
  • Tested/confirmed with the latest version: yes

Describe the bug
When building OpenWRT image the patchelf is executed to fix RPATHs, which ends up with appending XXX to the library making the library not usable:
$ swanctl --load-all
swanctl: symbol lookup error: /usr/lib/ipsec/libstrongswan.so.0: undefined symbol: XXX

To Reproduce
Steps to reproduce the behavior:

  1. Build the OpenWRT 22.03 with strongswan enabled
  2. Use: objdump -s -j .dynstr libstrongswan.so.0 on packaged library
  3. The output will end with:
    ...
    56b8 35002f75 73722f6c 69622f69 70736563 5./usr/lib/ipsec
    56c8 00585858 58585858 58585858 58585858 .XXXXXXXXXXXXXXX
    56d8 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    56e8 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    56f8 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    5708 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    5718 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    5728 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    5738 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    5748 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    5758 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    5768 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    5778 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    5788 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    5798 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    57a8 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    57b8 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    57c8 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
    57d8 58585858 58585858 58585858 585800 XXXXXXXXXXXXXX.

Expected behavior
A proper library patching

Additional context
The problem reported to patchelf project:
NixOS/patchelf#315
Unfortunately not fixed.

They stated that the problem may be caused by the use of global variable named "lib":
https://github.com/strongswan/strongswan/blob/master/src/libstrongswan/library.h#L285
which has the same name as the basename of the directory where the library is installed

I patched strongswan to rename "lib" variable to "swlibrary" but the result is the same. So I think the patchelf guys assumption could be wrong.

@tobiasbrunner
Copy link
Member

Yes, that's a known issue that should be fixed in patchelf.

They stated that the problem may be caused by the use of global variable named "lib"
which has the same name as the basename of the directory where the library is installed

Yes, you can find my detailed analysis in the issue you referenced.

I patched strongswan to rename "lib" variable to "swlibrary" but the result is the same.

What do you mean "the same"? Are you sure you're not mixing binaries from different builds?

@tobiasbrunner
Copy link
Member

This has apparently been fixed.

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