-
Notifications
You must be signed in to change notification settings - Fork 327
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: support seccomp listener #438
Conversation
LGTM |
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
the goal is to use it with containers/conmon#190 It is just a PoC now, conmon doesn't look like the right place to maintain the handlers code. |
This is also important for running rootless containers without /etc/subuid: https://github.com/rootless-containers/subuidless |
I wonder if we can come up with a common interface that could be used as some sort of plugins. There will surely be more implementations for seccomp notifications. The API could be quite simple, just pass down a FD or have an exported function like I've some WIP, I'll publish it as soon as it is in a working PoC state |
👍 It would be great if we can propagate SIGCHLD events to the handler plugins as well (so that the plugin can clean-up process-associated data structure) |
Passing down a FD is unlikely to work with multiple plugins? |
yes I agree, I was thinking of a simple API like:
what do you think? |
if the plugin doesn't set |
SGTM, but let's s/^seccomp/^run_oci_seccomp/g or choose other prefix so as to avoid potential conflict with libseccomp.
What is conf?
This function should also take |
just a plugin specific string to pass down some configuration if necessary. Most plugins will probably just ignore it.
SGTM |
Should be a struct? |
it can be a struct, just how to make it generic so that multiple plugins can use it? |
We can just declare an empty struct and call it a day. |
what json would that be? The config.json? |
Probably it would look like this, but should be revisited later {
"runtimeRootPath": "/run/user/1001/crun",
"name": "foo",
"bundlePath": "/home/foo/oci-bundles/alpine"
} |
this could be part of the struct no? It is not going to change. If we pass down the config.json file as well and I think the path is enough, at least a plugin has some way to be configured via annotations. |
a0ec203
to
8168733
Compare
@AkihiroSuda pushed some new commits to add the plugin mechanism we discussed. This is a plugin example: |
This pull request introduces 1 alert when merging 8168733 into ec3df81 - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
* crun is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 2.1 of the License, or | ||
* (at your option) any later version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have the list of allowed and disallowed licenses for plugins?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not a lawyer, but LGPL allows being used with proprietary software as long as changes to the program itself are distributed. In this case only changes to libcrun matter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IANAL either, but as crun CLI is licensed under the terms of GPL2-or-later, I'm wondering that plugins might need to be GPL-compatible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative design is to implement the plugin infra on a standalone receiver binary with a more permissive license, rather than on crun itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea is to use the same plugins from conmon, since it is already a long running process.
Having them supported also in crun makes just easier to debug stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is a program and its plug-ins considered a single combined program?
...
If the main program dynamically links plug-ins, and they make function calls to each other and share data structures, we believe they form a single combined program, which must be treated as an extension of both the main program and the plug-ins.
https://www.gnu.org/licenses/gpl-faq.en.html#GPLPlugins
If I write a plug-in to use with a GPL-covered program, what requirements does that impose on the licenses I can use for distributing my plug-in?
...
If the main program and the plugins are a single combined program then this means you must license the plug-in under the GPL or a GPL-compatible free software license and distribute it with source code in a GPL-compliant way. A main program that is separate from its plug-ins makes no requirements for the plug-ins.
https://www.gnu.org/licenses/gpl-faq.en.html#GPLAndPlugins
If the plugin infra is directly implemented in the main crun binary, it is highly likely that the crun and the plugins are "a single combined program" and hence the plugins need to be GPL-compatible.
If the plugins need to be GPL-compatible, it is likely that the plugins cannot be used by runc, which is licensed under the terms of Apache License 2.0 (incompatible with GPL2), but IANAL.
cc @cyphar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MIT/BSD/et al or MPL-2.0 licensed plugins would be compatible with both Apache-2.0 and LGPL-2.1, and thus wouldn't cause any issues.
But I would further note that you linked the GPL FAQ -- the LGPL treats dynamically shared libraries differently to the GPL, and dynamic plugins (especially of the form used here) are functionally identical to shared libraries. For a more famous example, the Name Service Switch (which is supported by glibc -- an LGPL project) supports using dynamic plugins. Those plugins do not need to be LGPL-3.0 licensed. So I would argue that it is not the case that plugins would need to be LGPL licensed. Outlook has an MIT-licensed NSS plugin for Azure ActiveDirectory.
8168733
to
0c90558
Compare
This pull request introduces 1 alert when merging 0c90558 into ec3df81 - view on LGTM.com new alerts:
|
0c90558
to
5505e6a
Compare
Relevant discussion in OCI: https://hackmd.io/El8Dd2xrTlCaCG59ns5cwg?view#September-16-2020 |
thanks! I've left a comment there |
sorry for the delay. Released 0.15 now |
thanks! |
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
The initial version of subuidless adopted LGPL-2.1-or-later because it was expected to be going to be a shared object library that is called by GPL2-licensed crun. However, the current version of subuidless is implemented as a socket receiver process rather than a shared object library, and probably continue to being a socket receiver process so that it can be executed in the parent namespace. (Side topic: we need an infra to allow using multiple socket receivers) And yet, even if it was a shared object library, probably it does not need to be LGPL: containers/crun#438 So this commit changes the license to Apache-2.0. Signed-off-by: Akihiro Suda <[email protected]>
The initial version of subuidless adopted LGPL-2.1-or-later because it was expected to be going to be a shared object library that is called by GPL2-licensed crun. However, the current version of subuidless is implemented as a socket receiver process rather than a shared object library, and probably continue to being a socket receiver process so that it can be executed in the parent namespace. (Side topic: we need an infra to allow using multiple socket receivers) And yet, even if it was a shared object library, probably it does not need to be LGPL: containers/crun#438 So this commit changes the license to Apache-2.0 for consistency with other container software in the ecosystem. Signed-off-by: Akihiro Suda <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
add support for seccomp notify and add a basic support for emulating mknod and mknodat. The handler implementation is likely going to change, for now it is just a PoC to show how it would work. Requires: containers/crun#438 Requires: libseccomp-2.5 Signed-off-by: Giuseppe Scrivano <[email protected]>
Signed-off-by: Giuseppe Scrivano [email protected]