Compare commits

...

No commits in common. "c8-stream-4.0" and "c8-stream-3.0" have entirely different histories.

5 changed files with 23 additions and 84 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/v1.2.5.tar.gz
SOURCES/v1.2.0.tar.gz

View File

@ -1 +1 @@
d73e189532884c786d0074ad92a30cf11c209395 SOURCES/v1.2.5.tar.gz
87e5a6bd76c56b81e779438c531f31f14a6c9b7e SOURCES/v1.2.0.tar.gz

View File

@ -1,60 +0,0 @@
From 245cc45ad45f8024c602696f58ae163d0dc745d5 Mon Sep 17 00:00:00 2001
From: Dominique Martinet <asmadeus@codewreck.org>
Date: Tue, 11 Oct 2022 22:39:28 +0900
Subject: [PATCH] update gobpf: fix compatibility with bcc v0.25.0
bcc v0.25.0 broke compatibility with bcc_func_load and requires updating
the gobpf wrapper.
Fixes: #100
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
---
go.mod | 2 +-
go.sum | 4 +--
vendor/github.com/iovisor/gobpf/bcc/module.go | 25 ++++++++++++++++++-
vendor/modules.txt | 2 +-
4 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/vendor/github.com/iovisor/gobpf/bcc/module.go b/vendor/github.com/iovisor/gobpf/bcc/module.go
index 98a1c93..67d43eb 100644
--- a/vendor/github.com/iovisor/gobpf/bcc/module.go
+++ b/vendor/github.com/iovisor/gobpf/bcc/module.go
@@ -31,6 +31,29 @@ import (
#cgo LDFLAGS: -lbcc
#include <bcc/bcc_common.h>
#include <bcc/libbpf.h>
+#include <bcc/bcc_version.h>
+
+#ifndef LIBBCC_VERSION_GEQ
+#define LIBBCC_VERSION_GEQ(a, b, c) 0
+#endif
+
+int bcc_func_load_wrapper(void *program, int prog_type, const char *name,
+ const struct bpf_insn *insns, int prog_len,
+ const char *license, unsigned kern_version,
+ int log_level, char *log_buf, unsigned log_buf_size,
+ const char *dev_name, int attach_type){
+
+#if LIBBCC_VERSION_GEQ(0, 25, 0)
+ return bcc_func_load(program, prog_type, name, insns, prog_len, license,
+ kern_version, log_level, log_buf, log_buf_size,
+ dev_name, attach_type);
+#else
+ return bcc_func_load(program, prog_type, name, insns, prog_len, license,
+ kern_version, log_level, log_buf, log_buf_size,
+ dev_name);
+#endif
+}
+
*/
import "C"
@@ -227,7 +250,7 @@ func (bpf *Module) load(name string, progType int, logLevel, logSize uint) (int,
logBuf = make([]byte, logSize)
logBufP = (*C.char)(unsafe.Pointer(&logBuf[0]))
}
- fd, err := C.bcc_func_load(bpf.p, C.int(uint32(progType)), nameCS, start, size, license, version, C.int(logLevel), logBufP, C.uint(len(logBuf)), nil)
+ fd, err := C.bcc_func_load_wrapper(bpf.p, C.int(uint32(progType)), nameCS, start, size, license, version, C.int(logLevel), logBufP, C.uint(len(logBuf)), nil, C.int(-1))
if fd < 0 {
return -1, fmt.Errorf("error loading BPF program: %v", err)
}

12
SOURCES/build-fix.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up oci-seccomp-bpf-hook-1.2.0/vendor/github.com/iovisor/gobpf/bcc/module.go.orig oci-seccomp-bpf-hook-1.2.0/vendor/github.com/iovisor/gobpf/bcc/module.go
--- oci-seccomp-bpf-hook-1.2.0/vendor/github.com/iovisor/gobpf/bcc/module.go.orig 2021-05-21 14:15:44.936127448 +0200
+++ oci-seccomp-bpf-hook-1.2.0/vendor/github.com/iovisor/gobpf/bcc/module.go 2021-05-21 14:16:03.459454988 +0200
@@ -258,7 +258,7 @@ func (bpf *Module) attachProbe(evName st
func (bpf *Module) attachUProbe(evName string, attachType uint32, path string, addr uint64, fd, pid int) error {
evNameCS := C.CString(evName)
binaryPathCS := C.CString(path)
- res, err := C.bpf_attach_uprobe(C.int(fd), attachType, evNameCS, binaryPathCS, (C.uint64_t)(addr), (C.pid_t)(pid))
+ res, err := C.bpf_attach_uprobe(C.int(fd), attachType, evNameCS, binaryPathCS, (C.uint64_t)(addr), (C.pid_t)(pid), 0)
C.free(unsafe.Pointer(evNameCS))
C.free(unsafe.Pointer(binaryPathCS))

View File

@ -25,13 +25,13 @@ go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl
ExclusiveArch: %{go_arches}
Name: oci-seccomp-bpf-hook
Version: 1.2.5
Release: 2%{?dist}
Version: 1.2.0
Release: 3%{?dist}
Summary: OCI Hook to generate seccomp json files based on EBF syscalls used by container
License: ASL 2.0
URL: %{git0}
Source0: %{git0}/archive/v%{version}.tar.gz
Patch0: https://github.com/containers/oci-seccomp-bpf-hook/commit/245cc45ad45f8024c602696f58ae163d0dc745d5.patch
Patch0: build-fix.patch
BuildRequires: golang
BuildRequires: go-md2man
BuildRequires: glib2-devel
@ -41,7 +41,7 @@ BuildRequires: git
BuildRequires: gpgme-devel
BuildRequires: libseccomp-devel
BuildRequires: make
Conflicts: crun < 0.17
Requires: crun >= 0.17
Enhances: podman
Enhances: cri-o
@ -109,28 +109,15 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
%{_mandir}/man1/%{name}.1*
%changelog
* Mon Feb 06 2023 Jindrich Novy <jnovy@redhat.com> - 1.2.5-2
- fix compatibility with the new bcc
- Related: #2123641
* Wed Mar 16 2022 Jindrich Novy <jnovy@redhat.com> - 1.2.5-1
- update to https://github.com/containers/oci-seccomp-bpf-hook/releases/tag/v1.2.5
- Related: #2061390
* Wed May 26 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.3-3
- change runc dependency to conflict
* Fri May 21 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.0-3
- actually apply the build fix patch
- Related: #1934415
* Wed May 19 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.3-2
- remove unneeded patch
* Fri May 21 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.0-2
- resolve build issue
- Related: #1934415
* Wed May 19 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.3-1
- update to https://github.com/containers/oci-seccomp-bpf-hook/releases/tag/v1.2.3
- fix build
- Related: #1934415
* Mon Feb 22 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.0-2
* Mon Feb 22 2021 Jindrich Novy <jnovy@redhat.com> - 1.2.0-1
- revert back to 1.2.0 - build issues
- Related: #1883490