-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
OCI Runtime Spec v1.0.2 supports specifying three seccomp flags: SECCOMP_FILTER_FLAG_TSYNC
, SECCOMP_FILTER_FLAG_LOG
, and SECCOMP_FILTER_FLAG_SPEC_ALLOW
(opencontainers/runtime-spec@d1ef109).
However, these flags are currently unimplemented by runc (but implemented by crun).
Notably we should support SECCOMP_FILTER_FLAG_SPEC_ALLOW
(Disable Speculative Store Bypass mitigation, since Linux 4.17).
The mitigation is enabled by default when a seccomp profile is specified and has serious performance impact on bytecode interpreters including Ruby and Python.
http://mamememo.blogspot.com/2020/05/cpu-intensive-rubypython-code-runs.html
On the host:
$ ruby -ve 't = Time.now; i=0;while i<100_000_000;i+=1;end; puts "#{ Time.now - t } sec"' ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux] 1.321703922 secOn a Docker container:
$ docker run -it --rm ruby:2.7 ruby -ve 't = Time.now; i=0;while i<100_000_000;i+=1;end; puts "#{ Time.now - t } sec"' ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux] 2.452876383 secIf you specify an option
"--security-opt seccomp=unconfined"
fordocker run
command, it runs as fast as the host.$ docker run --security-opt seccomp=unconfined -it --rm ruby:2.7 ruby -ve 't = Time.now; i=0;while i<100_000_000;i+=1;end; puts "#{ Time.now - t } sec"' ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux] 1.333669449 sec