Skip to content

Allow spc_t execstack and execmem (bsc#1268490)#472

Open
ca-hu wants to merge 1 commit into
containers:mainfrom
ca-hu:1268490-execstack
Open

Allow spc_t execstack and execmem (bsc#1268490)#472
ca-hu wants to merge 1 commit into
containers:mainfrom
ca-hu:1268490-execstack

Conversation

@ca-hu

@ca-hu ca-hu commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

This commit moved spc_t out of the container_domain: "Tighten controls on confined users"
2361047

The container_domain lists execmem and execstack explicitly:

allow container_domain self:process { getsession execstack execmem };

Now it is in unconfined_domain:
https://github.com/containers/container-selinux/blob/f786136f58c4e1b7568f30463a44b050d0d84325/container.te#L852C2-L852C27

execmem and execstack are allowed for unconfined_domain in fedora, but not openSUSE.
Since containers (especially java application containers) need those pretty often, lets allow that explicitly for spc_t again.

Summary by Sourcery

Enhancements:

  • Align spc_t SELinux policy with container needs by explicitly permitting execmem and execstack in the openSUSE policy variant.

@sourcery-ai

sourcery-ai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates SELinux policy so the spc_t domain, now part of unconfined_domain instead of container_domain, is explicitly granted execmem and execstack permissions again to restore needed behavior for containers (e.g., Java apps) on openSUSE.

File-Level Changes

Change Details Files
Explicitly allow execmem and execstack for the spc_t domain after its move from container_domain to unconfined_domain.
  • Add or adjust SELinux allow rules granting spc_t the execmem permission.
  • Add or adjust SELinux allow rules granting spc_t the execstack permission.
  • Align spc_t behavior with container_domain’s previous execmem/execstack allowances while remaining within unconfined_domain.
container.te

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

This commit moved spc_t out of the container_domain:
"Tighten controls on confined users"
containers@2361047

The container_domain lists execmem and execstack explicitly:
https://github.com/containers/container-selinux/blob/f786136f58c4e1b7568f30463a44b050d0d84325/container.te#L1127

Now it is in unconfined_domain:
https://github.com/containers/container-selinux/blob/f786136f58c4e1b7568f30463a44b050d0d84325/container.te#L852C2-L852C27

execmem and execstack are allowed for unconfined_domain in
fedora, but not openSUSE.
Since containers (especially java application containers) need those
pretty often, lets allow that explicitly for spc_t again.

Signed-off-by: Cathy Hu <cathy.hu@suse.com>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ca-hu ca-hu force-pushed the 1268490-execstack branch from 8fabff6 to 8322747 Compare June 23, 2026 12:58

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the SELinux policy in container.te to allow spc_t processes both execstack and execmem permissions. Feedback on this change highlights a security concern: enabling execstack significantly increases vulnerability to memory corruption exploits and is rarely necessary for modern applications. It is recommended to restrict the permission to execmem only, unless execstack is explicitly required.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread container.te
# spc local policy
#
allow spc_t { container_file_t container_var_lib_t container_ro_file_t container_runtime_tmpfs_t}:file entrypoint;
allow spc_t self:process { execstack execmem };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-high high

Allowing execstack (executable stack) poses a significant security risk as it makes memory corruption vulnerabilities (like buffer overflows) much easier to exploit. While execmem is commonly required by runtimes like Java for Just-In-Time (JIT) compilation, execstack is rarely needed by modern applications. To adhere to the principle of least privilege, consider allowing only execmem unless there is a verified requirement for execstack in spc_t containers.

allow spc_t self:process { execmem };

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think the AI did not read my commit message.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we do this as a boolean. I would allow execmem by default and have a container_can_execstack boolean. Then users can just toggle the boolean.

@packit-as-a-service

Copy link
Copy Markdown

Ephemeral COPR build failed. @containers/packit-build please check.

@packit-as-a-service

Copy link
Copy Markdown

Tests failed. @containers/packit-build please check.

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.

2 participants