Nerd For Tech
Published in

Nerd For Tech

How to build linpmem for Red Hat 7

Red Hat 7.9 originally released in 2013 with 10 years of Long Term Support uses GNU C library in version 2.17. Linpem binaries built on Debian and released in 2019 use symbols from glibc 2.25 and 2.27. This binary does not run on Red Hat 7.9

The good thing is that the vendor provides README.linux inside git repository https://github.com/Velocidex/c-aff4 and we can create a static binary on Ubuntu.

At first let’s align the codebase with up to date libraries (and disable cache which operates on &string[0] to write bytes and overwrites unintended memory regions— really scary):

Now we need to make a build script out of README.linux:

After we are done with .a files we can execute configure and then make:

We should end up with perfectly static executable:

We need to remove glob symbol version GBLIC_2.27:

Almost done. We need to disable orphaned version symbol 2.27 via hex editor hte with correct offset shown by readelf (1f28 + 70 + 6) of vna_flags in Elfxx_Vernaux:

Field vna_flags set to 0x2 means weak version (see: https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA.junk/symversion.html).

Hex editors are cool

Let’s run it:

It works!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store