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

@Wentao[master]: fix CentOS 7 execution permission over libnssfix_XXXX.so #200

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions staticx/hooks/glibc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from ..elf import open_elf, get_shobj_deps, patch_elf
from elftools.elf.gnuversions import GNUVerNeedSection
import logging
import os

LIBNSSFIX = 'libnssfix.so'

Expand All @@ -13,6 +14,8 @@ def process_glibc_prog(sx):
try:
nssfix = copy_asset_to_tempfile(LIBNSSFIX, debug=sx.debug,
prefix='libnssfix-', suffix='.so')
umask=os.umask(0o755)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: This is bad because it changes the umask of the currently-running process to 0o755.

os.chmod(nssfix.name, 0o755&~umask)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: There is already a make_executable function in staticx.utils.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: Your new code shouldn't be inside of the existing try/except KeyError block.

except KeyError:
raise InternalError("GLIBC binary detected but libnssfix.so not available")

Expand Down