[GH-ISSUE #4875] shellcheck: cannot enable executable stack (mdwe) #2799

Closed
opened 2026-05-05 09:27:12 -06:00 by gitea-mirror · 6 comments
Owner

Originally created by @redxef on GitHub (Jan 21, 2022).
Original GitHub issue: https://github.com/netblue30/firejail/issues/4875

Description

Running shellcheck results in the following error when using firejail

$ /usr/local/bin/shellcheck
/usr/bin/shellcheck: error while loading shared libraries: libHSrts-ghc9.0.2.so: cannot enable executable stack as shared object requires: Operation not permitted

But succeeds when running directly

$ /usr/bin/shellcheck
No files specified.

<usage output, etc.>

shellcheck version: 0.8.0
firejail version: 0.9.66

Steps to Reproduce

Steps to reproduce the behavior

  1. Try to run shellcheck
  2. observe crash

Expected behavior

shellcheck should be able to run.

Actual behavior

Shellcheck aborts with the error message /usr/bin/shellcheck: error while loading shared libraries: libHSrts-ghc9.0.2.so: cannot enable executable stack as shared object requires: Operation not permitted

Behavior without a profile

What changed calling LC_ALL=C firejail --noprofile /path/to/program in a terminal?

The program runs as expected.

Additional context

Environment

  • Linux Distro: Arch Linux, up to date as of 2022-01-21 10:42:38+0100
  • Firejail version: 0.9.66
  • shellcheck version: 0.8.0

Checklist

  • The issues is caused by firejail (i.e. running the program by path (e.g. /usr/bin/vlc) "fixes" it).
  • I can reproduce the issue without custom modifications (e.g. globals.local).
  • The program has a profile. (If not, request one in https://github.com/netblue30/firejail/issues/1139)
  • The profile (and redirect profile if exists) hasn't already been fixed upstream.
  • I have performed a short search for similar issues (to avoid opening a duplicate).
    • I'm aware of browser-allow-drm yes/browser-disable-u2f no in firejail.config to allow DRM/U2F in browsers.
  • I used --profile=PROFILENAME to set the right profile. (Only relevant for AppImages)

Log

Output of LC_ALL=C firejail /path/to/program

/usr/bin/shellcheck: error while loading shared libraries: libHSrts-ghc9.0.2.so: cannot enable executable stack as shared object requires: Operation not permitted

Output of LC_ALL=C firejail --debug /path/to/program

Originally created by @redxef on GitHub (Jan 21, 2022). Original GitHub issue: https://github.com/netblue30/firejail/issues/4875 <!-- See the following links for help with formatting: https://guides.github.com/features/mastering-markdown/ https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax --> ### Description Running shellcheck results in the following error when using firejail ``` $ /usr/local/bin/shellcheck /usr/bin/shellcheck: error while loading shared libraries: libHSrts-ghc9.0.2.so: cannot enable executable stack as shared object requires: Operation not permitted ``` But succeeds when running directly ``` $ /usr/bin/shellcheck No files specified. <usage output, etc.> ``` _shellcheck version_: `0.8.0` _firejail version_: `0.9.66` ### Steps to Reproduce _Steps to reproduce the behavior_ 1. Try to run shellcheck 2. observe crash ### Expected behavior shellcheck should be able to run. ### Actual behavior Shellcheck aborts with the error message `/usr/bin/shellcheck: error while loading shared libraries: libHSrts-ghc9.0.2.so: cannot enable executable stack as shared object requires: Operation not permitted` ### Behavior without a profile _What changed calling `LC_ALL=C firejail --noprofile /path/to/program` in a terminal?_ The program runs as expected. ### Additional context ### Environment - _Linux Distro_: Arch Linux, up to date as of `2022-01-21 10:42:38+0100` - _Firejail version_: `0.9.66` - _shellcheck version_: `0.8.0` ### Checklist <!-- Note: Items are checked with an "x", like so: - [x] This is a checked item. --> - [x] The issues is caused by firejail (i.e. running the program by path (e.g. `/usr/bin/vlc`) "fixes" it). - [x] I can reproduce the issue without custom modifications (e.g. globals.local). - [x] The program has a profile. (If not, request one in `https://github.com/netblue30/firejail/issues/1139`) - [x] The profile (and redirect profile if exists) hasn't already been fixed [upstream](https://github.com/netblue30/firejail/tree/master/etc). - [x] I have performed a short search for similar issues (to avoid opening a duplicate). - [ ] I'm aware of `browser-allow-drm yes`/`browser-disable-u2f no` in `firejail.config` to allow DRM/U2F in browsers. - [ ] I used `--profile=PROFILENAME` to set the right profile. (Only relevant for AppImages) ### Log <details> <summary>Output of <code>LC_ALL=C firejail /path/to/program</code></summary> <p> ``` /usr/bin/shellcheck: error while loading shared libraries: libHSrts-ghc9.0.2.so: cannot enable executable stack as shared object requires: Operation not permitted ``` </p> </details> <details> <summary>Output of <code>LC_ALL=C firejail --debug /path/to/program</code></summary> <p> ``` ``` </p> </details>
Author
Owner

@rusty-snake commented on GitHub (Jan 21, 2022):

Does firejail --ignore=memory-deny-write-execute /usr/bin/shellcheck … work?

<!-- gh-comment-id:1018361057 --> @rusty-snake commented on GitHub (Jan 21, 2022): Does `firejail --ignore=memory-deny-write-execute /usr/bin/shellcheck …` work?
Author
Owner

@ghost commented on GitHub (Jan 22, 2022):

On Arch Linux I cannot reproduce BUT I use shellcheck-bin from AUR, which doesn't have the haskell dependencies. That version works as expected here, including with memory-deny-write-execute (a nice option to have in a sandbox). I'm assuming the referenced libHSrts-ghc9.0.2.so in your error is a haskell kib, correct?

There's not a trace of haskell in our repo currently. Maybe someone who has experience with it could create a allow-haskell.inc and its counterparts.

<!-- gh-comment-id:1018991364 --> @ghost commented on GitHub (Jan 22, 2022): On Arch Linux I cannot reproduce BUT I use [shellcheck-bin](https://aur.archlinux.org/packages/shellcheck-bin/) from AUR, which doesn't have the haskell dependencies. That version works as expected here, including with memory-deny-write-execute (a nice option to have in a sandbox). I'm assuming the referenced `libHSrts-ghc9.0.2.so` in your error is a haskell kib, correct? There's not a trace of haskell in our repo currently. Maybe someone who has experience with it could create a allow-haskell.inc and its counterparts.
Author
Owner

@redxef commented on GitHub (Jan 27, 2022):

firejail --ignore=memory-deny-write-execute /usr/bin/shellcheck solves the problem.

<!-- gh-comment-id:1023645745 --> @redxef commented on GitHub (Jan 27, 2022): `firejail --ignore=memory-deny-write-execute /usr/bin/shellcheck` solves the problem.
Author
Owner

@rusty-snake commented on GitHub (Jan 27, 2022):

Is there any seccomp related error?

5356609ae9/etc/templates/syscalls.txt (L92-L99)

Or anything else in you syslog?

If not, you have to comment the profile and uncomment it line for line.

<!-- gh-comment-id:1023649926 --> @rusty-snake commented on GitHub (Jan 27, 2022): Is there any seccomp related error? https://github.com/netblue30/firejail/blob/5356609ae972c55c699bb08acc6bb09fbb054216/etc/templates/syscalls.txt#L92-L99 Or anything else in you syslog? If not, you have to comment the profile and uncomment it line for line.
Author
Owner

@redxef commented on GitHub (Jan 27, 2022):

Seccomp reported mprotect, since the last option in the shellcheck config was memory-deny-write-execute I disabled this option which solved it. Switching seccomp to seccomp !mprotect didn't help though.

<!-- gh-comment-id:1023660843 --> @redxef commented on GitHub (Jan 27, 2022): Seccomp reported `mprotect`, since the last option in the shellcheck config was `memory-deny-write-execute` I disabled this option which solved it. Switching `seccomp` to `seccomp !mprotect` didn't help though.
Author
Owner

@MiltiadisKoutsokeras commented on GitHub (Feb 4, 2022):

Confirmed in Arch Linux, Firejail 0.9.66 and shellcheck 0.8.0. Workaround firejail --ignore=memory-deny-write-execute /usr/bin/shellcheck works.

<!-- gh-comment-id:1029934827 --> @MiltiadisKoutsokeras commented on GitHub (Feb 4, 2022): Confirmed in Arch Linux, Firejail 0.9.66 and shellcheck 0.8.0. Workaround `firejail --ignore=memory-deny-write-execute /usr/bin/shellcheck` works.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#2799
No description provided.