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

seccomp: honor seccomp flags #85

Merged
merged 2 commits into from
Sep 11, 2019

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Sep 9, 2019

now the OCI runtime specs support to specify seccomp flags to use with the seccomp(2) syscall.

The accepted options are:

  • SECCOMP_FILTER_FLAG_TSYNC
  • SECCOMP_FILTER_FLAG_SPEC_ALLOW
  • SECCOMP_FILTER_FLAG_LOG

If there is no selection for the flags to use (i.e. there is no seccomp->flags specified), a default configuration is used:

SECCOMP_FILTER_FLAG_LOG and SECCOMP_FILTER_FLAG_SPEC_ALLOW.

From the man page:

SECCOMP_FILTER_FLAG_LOG (since Linux 4.14)
All filter return actions except SECCOMP_RET_ALLOW should be logged.
An administrator may override this filter flag by preventing
specific actions from being logged via the
/proc/sys/kernel/seccomp/actions_logged file.

SECCOMP_FILTER_FLAG_SPEC_ALLOW (since Linux 4.17)
Disable Speculative Store Bypass mitigation.

Signed-off-by: Giuseppe Scrivano giuseppe@scrivano.org

@rhatdan
Copy link
Member

rhatdan commented Sep 9, 2019

Should we add a flag to allow these to be customized by the caller?

I would guess we don't need to worry about SECCOMP_FILTER_FLAG_SPEC_ALLOW since this can be handled by a syscall.

But SECCOMP_FILTER_FLAG_SPEC_ALLOW, do you see an admin as ever wanting this? Turning it off would not effect a system that already was doing the filtering correct?

@giuseppe
Copy link
Member Author

giuseppe commented Sep 9, 2019

I'd like to make it configurable, but I am not sure what would be the best way to pass down this information to the OCI runtime. Should we propose a change for the OCI specs?

@mheon
Copy link
Member

mheon commented Sep 9, 2019 via email

@giuseppe giuseppe changed the title seccomp: set FILTER_FLAG_LOG and FILTER_FLAG_SPEC_ALLOW [WIP] seccomp: set FILTER_FLAG_LOG and FILTER_FLAG_SPEC_ALLOW Sep 9, 2019
@giuseppe
Copy link
Member Author

giuseppe commented Sep 9, 2019

so let's do this correctly, I've opened a PR for the runtime-spec: opencontainers/runtime-spec#1018

I'll rework this patch to read the flags from the OCI configuration file once the PR for runtime-spec is accepted

@rhatdan
Copy link
Member

rhatdan commented Sep 9, 2019

Well I have no problem letting this patch be the default IE These fields are not set, so we log and do not turn on the security separation. Once we have support for the flags in OCI, then we use them if specified.

@mheon
Copy link
Member

mheon commented Sep 9, 2019

I think we should probably default TSYNC to on... Actually, does TSYNC even make sense here? As long as the same thread that sets up seccomp launches the container, every child in the container will inherit the full ruleset, and the only things affected are lingering crun threads.

@giuseppe
Copy link
Member Author

giuseppe commented Sep 9, 2019

I think we should probably default TSYNC to on... Actually, does TSYNC even make sense here? As long as the same thread that sets up seccomp launches the container, every child in the container will inherit the full ruleset, and the only things affected are lingering crun threads.

crun is using a single thread so it should not make any difference

Well I have no problem letting this patch be the default IE These fields are not set, so we log and do not turn on the security separation. Once we have support for the flags in OCI, then we use them if specified.

the only difference is that once the flags will be added to the OCI specs, we will be reverting back to not have them set by default. If that is fine, then we can merge this PR

@rhatdan
Copy link
Member

rhatdan commented Sep 9, 2019

Well I was thinking more the absense of flags was to turn them on, if there were flags, then we use those defaults.

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
now the OCI runtime specs support to specify seccomp flags to use with
the seccomp(2) syscall.

The accepted options are:

- SECCOMP_FILTER_FLAG_TSYNC
- SECCOMP_FILTER_FLAG_SPEC_ALLOW
- SECCOMP_FILTER_FLAG_LOG

If there is no selection for the flags to use (i.e. there is no
seccomp->flags specified), a default configuration is used:

SECCOMP_FILTER_FLAG_LOG and SECCOMP_FILTER_FLAG_SPEC_ALLOW.

From the man page:

SECCOMP_FILTER_FLAG_LOG (since Linux 4.14)
  All filter return actions except SECCOMP_RET_ALLOW should be logged.
  An administrator may override this filter flag by preventing
  specific actions from being logged via the
  /proc/sys/kernel/seccomp/actions_logged file.

SECCOMP_FILTER_FLAG_SPEC_ALLOW (since Linux 4.17)
  Disable Speculative Store Bypass mitigation.

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
@giuseppe giuseppe force-pushed the seccomp-enable-filter branch from 1937af9 to fefabff Compare September 11, 2019 06:43
@giuseppe giuseppe changed the title [WIP] seccomp: set FILTER_FLAG_LOG and FILTER_FLAG_SPEC_ALLOW seccomp: honor seccomp flags Sep 11, 2019
@giuseppe
Copy link
Member Author

the changes went into the OCI runtime specs. I've adapted the PR and the description to that.

I've changed it to use SECCOMP_FILTER_FLAG_LOG|SECCOMP_FILTER_FLAG_SPEC_ALLOW by default if the flags are not specified. It can be overriden with flags: [] in the OCI specs file that will force to use no flags.

Copy link
Member

@rhatdan rhatdan left a comment

Choose a reason for hiding this comment

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

LGTM

@rhatdan rhatdan merged commit 84f90aa into containers:master Sep 11, 2019
@rhatdan
Copy link
Member

rhatdan commented Sep 11, 2019

@vrothberg FYI

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