Skip to content

New seccomp json format#24510

Merged
justincormack merged 1 commit intomoby:masterfrom
runcom:new-seccomp-format
Sep 2, 2016
Merged

New seccomp json format#24510
justincormack merged 1 commit intomoby:masterfrom
runcom:new-seccomp-format

Conversation

@runcom
Copy link
Member

@runcom runcom commented Jul 11, 2016

- What I did

Note that this change is fully backward compatible, people can still use the current seccomp profile json format

I've modified the json seccomp profile format to be more expressive and to allow conditionals with filters. Syscall names can now also be grouped together if they have same action,args,includes,excludes. includes are ORed while excludes are any of. Conditionals can be expressed on architectures and capabilities also. See following examples of new format:

{
    "archMap": [{
        "architecture": "SCMP_ARCH_X86_64",
        "subArchitectures": [
            "SCMP_ARCH_X86",
            "SCMP_ARCH_X32"
        ]
    }],
    "syscalls": [{
        "names": [
            "accept",
            "accept4",
            "access",
            "alarm",
            "alarm",
            "bind",
            "brk",
            "capget",
            "capset",
            "chdir",
            "chmod"
        ],
        "action": "SCMP_ACT_ALLOW",
        "args": [],
        "comment": "this is a comment!",
        "includes": {},
        "excludes": {}
    }, {
        "names": [
            "iopl",
            "ioperm"
        ],
        "action": "SCMP_ACT_ALLOW",
        "args": [],
        "comment": "",
        "includes": {
            "caps": [
                "CAP_SYS_RAWIO"
            ]
        },
        "excludes": {}
    }, {
        "names": [
            "clone"
        ],
        "action": "SCMP_ACT_ALLOW",
        "args": [{
            "index": 1,
            "value": 2080505856,
            "valueTwo": 0,
            "op": "SCMP_CMP_MASKED_EQ"
        }],
        "comment": "",
        "includes": {
            "arches": [
                "s390",
                "s390x"
            ]
        },
        "excludes": {
            "caps": [
                "CAP_SYS_ADMIN"
            ]
        }
    }]
}

- How I did it

vim

- How to verify it

You can run containers with --seccomp-profile=$DOCKERSRC/profiles/seccomp/default.json and tweak it to verify seccomp rules are ok when running containers.

- Description for the changelog

New seccomp json format

- A picture of a cute animal (not mandatory but encouraged)

Following from #24221, this is a proposal about defining a new and more expressive (even if more verbose) seccomp json profile.

/cc @justincormack @jfrazelle @rhatdan @mheon @thaJeztah @LK4D4

TODO:

the stuff I've removed from this list should be done in a follow up or re-writing #24221

NOTE: it's not as big as it seems, the actual files changed are just 7, the rest is syscall definitions and the json 😸

Signed-off-by: Antonio Murdaca runcom@redhat.com

@thaJeztah
Copy link
Member

thanks @runcom

@runcom
Copy link
Member Author

runcom commented Jul 11, 2016

failing tests are about the forward compatibility of the old profile - I'll fix them

@thaJeztah thaJeztah added the status/failing-ci Indicates that the PR in its current state fails the test suite label Jul 11, 2016
@runcom runcom force-pushed the new-seccomp-format branch from c72bff2 to 0cbc17d Compare July 11, 2016 21:00
@runcom runcom added status/failing-ci Indicates that the PR in its current state fails the test suite and removed status/failing-ci Indicates that the PR in its current state fails the test suite labels Jul 11, 2016
@runcom runcom force-pushed the new-seccomp-format branch from 0cbc17d to cd51dc4 Compare July 11, 2016 21:02
@runcom
Copy link
Member Author

runcom commented Jul 11, 2016

CI should be now failing only on vendor (except flakes of course)

(I don't remember what status/failing-ci is for, was it for flakes right? otherwise I can see if a PR has failing CI by just looking at the global Pull Requests page looking for a red cross)

@runcom runcom force-pushed the new-seccomp-format branch from cd51dc4 to ca801f5 Compare July 11, 2016 21:27
@runcom runcom changed the title New seccomp format New seccomp json format Jul 12, 2016
@runcom runcom removed the status/failing-ci Indicates that the PR in its current state fails the test suite label Jul 12, 2016
@justincormack
Copy link
Contributor

cc @jfrazelle as well

@runcom
Copy link
Member Author

runcom commented Jul 12, 2016

just a note, names are really arbitrary (includes, excludes are ugly to me) but didn't find any better, feel free to suggest others

@runcom
Copy link
Member Author

runcom commented Jul 12, 2016

/cc'ing @cyphar as well

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment here eg "s390 parameter ordering for clone is different" as we have comments!

@runcom runcom force-pushed the new-seccomp-format branch from 72bc4f3 to 431e4ae Compare August 21, 2016 13:20
@runcom
Copy link
Member Author

runcom commented Aug 27, 2016

ping @justincormack

@runcom
Copy link
Member Author

runcom commented Aug 31, 2016

@thaJeztah @justincormack @icecrime are there any plan to have this in 1.13?

@vdemeester vdemeester added this to the 1.13.0 milestone Aug 31, 2016
@justincormack
Copy link
Contributor

justincormack commented Aug 31, 2016

Yes definitely. I think its fine now. Was going to add a few more tests but
can do after merge.

LGTM.

@justincormack
Copy link
Contributor

engine-api change merged so you can fix vendoring

@runcom
Copy link
Member Author

runcom commented Aug 31, 2016

@justincormack doing it right now - though, talking to @vdemeester to create another PR because the vendoring changes a lot in docker/docker overall and probably needs its own PR

@justincormack
Copy link
Contributor

@runcom yes that makes sense

@runcom
Copy link
Member Author

runcom commented Aug 31, 2016

@justincormack @vdemeester removed the vendor commit and created #26200 - I'll rebase this one after that's merged.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
@runcom runcom force-pushed the new-seccomp-format branch from c7d16f0 to 5ff21ad Compare September 1, 2016 09:55
@runcom
Copy link
Member Author

runcom commented Sep 1, 2016

@justincormack @vdemeester rebased after #26200 merge

@justincormack
Copy link
Contributor

justincormack commented Sep 1, 2016

Needs some more LGTM cc @estesp @vdemeester

@vdemeester
Copy link
Member

LGTM 🐸

@justincormack
Copy link
Contributor

cc @cpuguy83

@justincormack
Copy link
Contributor

All green...

@justincormack justincormack merged commit 9d71cba into moby:master Sep 2, 2016
@runcom runcom deleted the new-seccomp-format branch September 2, 2016 08:23
@cyphar
Copy link
Contributor

cyphar commented Sep 3, 2016

🎉

@nodakai
Copy link

nodakai commented Jun 9, 2017

I spotted an incoherency in the expected JSON format:

    "archMap": [{
        "architecture": "SCMP_ARCH_X86_64",
        "subArchitectures": [
            "SCMP_ARCH_X86",
            "SCMP_ARCH_X32"
        ]
    }],
...
        "includes": {
            "arches": [
                "s390",
                "s390x"
            ]
        },

That is, includes/excludes.arches take strings a la ScmpArch.String() which don't follow the SCMP_ARCH_* style (e.g. amd64 vs. SCMP_ARCH_X86_64.)

@thaJeztah
Copy link
Member

@nodakai could you open a separate issue for discussing? (Also what you think it should looks like?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.