Failed to map segment from shared object

By | May 12, 2016

Recently, I was working with an AMD Geode LX800 with Debian 7.2 installed on it. I had a small CF and was running out of space, so I used an USB stick where I copied the binary to test (a Qt5 app) and when executing it as a normal user and as root I was getting the following error:

my_app: error while loading shared libraries: my_lib.so.5 :Failed to map segment from shared object: Operation not permitted...

I play around with file ownership (chown) and access permissions (chmod), but nothing changed.

Later I realized that the problem was that the USB stick was mounted with the noexec flag.
Mounting it without this flag allows the shared library to be properly loaded.

Searching around I found that this issue can happen under other similar scenarios like network mounted drives that contain shared libraries that were mounted with the noexec option or simply the /tmp partition that is normally mounted in memory but without execution permissions.

Leave a Reply

Your email address will not be published. Required fields are marked *