| From b9a43f90b5ef62eff36b307d20409d54bfb10be6 Mon Sep 17 00:00:00 2001 |
| From: Robert Kolchmeyer <rkolchmeyer@google.com> |
| Date: Thu, 27 Jan 2022 17:29:21 -0800 |
| Subject: [PATCH 2/3] Fix libseccomp-golang build error. |
| |
| Recent libseccomp versions replaced SCMP_ACT_KILL with |
| SCMP_ACT_KILL_THREAD, but kept SCMP_ACT_KILL around for backwards |
| compatibility. These libseccomp versions make SCMP_ACT_KILL and |
| SCMP_ACT_KILL_THREAD the exact same value (which is 0). |
| |
| libseccomp-golang has a switch statement that has different branches for |
| SCMP_ACT_KILL and SCMP_ACT_KILL_THREAD. Go disallows two switch branches |
| with the exact same entrance condition, so this doesn't compile. I have |
| no idea how this is intended to compile, and why it seems to work for |
| everyone else. |
| |
| Since SCMP_ACT_KILL_THREAD is supposed to replace SCMP_ACT_KILL, we can |
| take that to be the correct branch here, and remove the SCMP_ACT_KILL |
| branch. |
| --- |
| vendor/github.com/seccomp/libseccomp-golang/seccomp_internal.go | 2 -- |
| 1 file changed, 2 deletions(-) |
| |
| diff --git a/vendor/github.com/seccomp/libseccomp-golang/seccomp_internal.go b/vendor/github.com/seccomp/libseccomp-golang/seccomp_internal.go |
| index 8dc7b296..7e4d93cc 100644 |
| --- a/vendor/github.com/seccomp/libseccomp-golang/seccomp_internal.go |
| +++ b/vendor/github.com/seccomp/libseccomp-golang/seccomp_internal.go |
| @@ -612,8 +612,6 @@ func (a ScmpCompareOp) toNative() C.int { |
| func actionFromNative(a C.uint32_t) (ScmpAction, error) { |
| aTmp := a & 0xFFFF |
| switch a & 0xFFFF0000 { |
| - case C.C_ACT_KILL: |
| - return ActKill, nil |
| case C.C_ACT_KILL_PROCESS: |
| return ActKillProcess, nil |
| case C.C_ACT_KILL_THREAD: |
| -- |
| 2.35.0.rc2.247.g8bbb082509-goog |
| |