From: Andrei Gherzan <[email protected]> This will fix clang-based builds.
Signed-off-by: Andrei Gherzan <[email protected]> --- ...efine-ActKillThread-equal-to-ActKill.patch | 90 +++++++++++++++++++ recipes-containers/podman/podman_git.bb | 1 + 2 files changed, 91 insertions(+) create mode 100644 recipes-containers/podman/podman/0002-Define-ActKillThread-equal-to-ActKill.patch diff --git a/recipes-containers/podman/podman/0002-Define-ActKillThread-equal-to-ActKill.patch b/recipes-containers/podman/podman/0002-Define-ActKillThread-equal-to-ActKill.patch new file mode 100644 index 0000000..8ed5503 --- /dev/null +++ b/recipes-containers/podman/podman/0002-Define-ActKillThread-equal-to-ActKill.patch @@ -0,0 +1,90 @@ +From f2aa0359bcc776239bda8a4eb84957b97ef55c35 Mon Sep 17 00:00:00 2001 +From: Tonis Tiigi <[email protected]> +Date: Fri, 28 Jan 2022 14:44:56 -0800 +Subject: [PATCH] Define ActKillThread equal to ActKill +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +These constants are equal in libseccomp but Go definitions +were defined separately. This resulted in dead code that +never executed due to identical case statements in switch. +Go can usually detect these error cases and refuses to build +but for some reason this detection doesn’t work with cgo+gcc. +Clang detects the equal constants correctly and therefore +libseccomp-golang builds with clang broke after ActKillThread +was added. + +In order to fix the clang build only removal of the +switch case is needed. But I assumed that the setter/getter +logic is supposed to work for ActKillThread as well +and only way to ensure that is to set them equal like they +are in C. + +Signed-off-by: Tonis Tiigi <[email protected]> +Signed-off-by: Sebastiaan van Stijn <[email protected]> +Acked-by: Tom Hromatka <[email protected]> +Signed-off-by: Paul Moore <[email protected]> +Signed-off-by: Andrei Gherzan <[email protected]> +Upstrea-status: Backport [https://github.com/seccomp/libseccomp-golang/commit/c35397d0ea8f285a0be78693bb2fd37b06952453] +--- + seccomp.go | 8 ++++---- + seccomp_internal.go | 4 ---- + 2 files changed, 4 insertions(+), 8 deletions(-) + +diff --git a/seccomp.go b/seccomp.go +index e9b92e2..32f6ab2 100644 +--- a/seccomp.go ++++ b/seccomp.go +@@ -214,14 +214,14 @@ const ( + // This action is only usable when libseccomp API level 3 or higher is + // supported. + ActLog ScmpAction = iota +- // ActKillThread kills the thread that violated the rule. It is the same as ActKill. +- // All other threads from the same thread group will continue to execute. +- ActKillThread ScmpAction = iota + // ActKillProcess kills the process that violated the rule. + // All threads in the thread group are also terminated. + // This action is only usable when libseccomp API level 3 or higher is + // supported. + ActKillProcess ScmpAction = iota ++ // ActKillThread kills the thread that violated the rule. It is the same as ActKill. ++ // All other threads from the same thread group will continue to execute. ++ ActKillThread = ActKill + ) + + const ( +@@ -394,7 +394,7 @@ func (a ScmpCompareOp) String() string { + // String returns a string representation of a seccomp match action + func (a ScmpAction) String() string { + switch a & 0xFFFF { +- case ActKill, ActKillThread: ++ case ActKillThread: + return "Action: Kill thread" + case ActKillProcess: + return "Action: Kill process" +diff --git a/seccomp_internal.go b/seccomp_internal.go +index 8dc7b29..8fc9914 100644 +--- a/seccomp_internal.go ++++ b/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: +@@ -638,8 +636,6 @@ func actionFromNative(a C.uint32_t) (ScmpAction, error) { + // Only use with sanitized actions, no error handling + func (a ScmpAction) toNative() C.uint32_t { + switch a & 0xFFFF { +- case ActKill: +- return C.C_ACT_KILL + case ActKillProcess: + return C.C_ACT_KILL_PROCESS + case ActKillThread: +-- +2.25.1 + diff --git a/recipes-containers/podman/podman_git.bb b/recipes-containers/podman/podman_git.bb index 02d8921..bdc9ea0 100644 --- a/recipes-containers/podman/podman_git.bb +++ b/recipes-containers/podman/podman_git.bb @@ -21,6 +21,7 @@ SRCREV = "717edd7b844dcd66468f5d991991d87e9fc14c12" SRC_URI = " \ git://github.com/containers/libpod.git;branch=v4.0;protocol=https \ file://0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch;patchdir=src/import \ + file://0002-Define-ActKillThread-equal-to-ActKill.patch;patchdir=src/import/vendor/github.com/seccomp/libseccomp-golang \ ${@bb.utils.contains('PACKAGECONFIG', 'rootless', 'file://00-podman-rootless.conf', '', d)} \ " -- 2.25.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#7487): https://lists.yoctoproject.org/g/meta-virtualization/message/7487 Mute This Topic: https://lists.yoctoproject.org/mt/92766890/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
