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

linux: os2._process_start: skip non-ELF files when searching in PATH #4626

Closed
wants to merge 1 commit into from

Conversation

jkenda
Copy link

@jkenda jkenda commented Dec 25, 2024

os2.process_start was trying to execute bash scripts that were flagged executable so I added a check for the ELF magic.

@jasonKercher
Copy link
Contributor

I believe you want it to execute bash scripts in $PATH? It currently fails to because of the CLOEXEC flag on the descriptor causes ENOENT. So, for bash scripts we want to leak the file descriptor, and it currently does not.

I snuck a solution for this into #4600 and made it name based (maybe I should have made it separate). I had trouble getting execveat with that AT_EMPTY_PATH flag to work within a container. So, maybe the issue is more complex than just elf vs shebang? The name based approach just works in all cases and makes the file descriptor the kernel's problem.

@laytan
Copy link
Collaborator

laytan commented Dec 30, 2024

I merged @jasonKercher 's solution to this because it allows executing shebangs while this skips them, the posix implementation also works with shebangs so this brings that up to the same standard, people also expect that behavior.

@laytan laytan closed this Dec 30, 2024
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

Successfully merging this pull request may close these issues.

3 participants