From 154e2f442b9a02763ba5c3c6f0c886a6688cb9da Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: May 18 2021 04:12:05 +0000 Subject: import bpftrace-0.12.1-1.el8 --- diff --git a/.bpftrace.metadata b/.bpftrace.metadata index 86fabde..c60183b 100644 --- a/.bpftrace.metadata +++ b/.bpftrace.metadata @@ -1 +1 @@ -6bb8d682de04ffd47d565eb2542bc7c7d7b5da84 SOURCES/bpftrace-0.11.1.tar.gz +9cc3a1b5d4efd1649753cdb374102440c6625b57 SOURCES/bpftrace-0.12.1.tar.gz diff --git a/.gitignore b/.gitignore index 7ac4fc0..7746f0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/bpftrace-0.11.1.tar.gz +SOURCES/bpftrace-0.12.1.tar.gz diff --git a/SOURCES/bpftrace-0.11.1-Fix-clear-when-called-on-an-array.patch b/SOURCES/bpftrace-0.11.1-Fix-clear-when-called-on-an-array.patch deleted file mode 100644 index 491f7c1..0000000 --- a/SOURCES/bpftrace-0.11.1-Fix-clear-when-called-on-an-array.patch +++ /dev/null @@ -1,49 +0,0 @@ -From ed9caea4efcffdd9f37c67b272324a87abfd20c8 Mon Sep 17 00:00:00 2001 -From: Jerome Marchand -Date: Thu, 5 Nov 2020 15:17:14 +0100 -Subject: [PATCH] Fix clear() when called on an array - -Fixes the following error: -Error looking up elem: -1 -terminate called after throwing an instance of 'std::runtime_error' - what(): Could not clear map with ident "@", err=-1 -Aborted (core dumped) ---- - src/bpftrace.cpp | 5 +++++ - src/imap.h | 4 ++++ - 2 files changed, 9 insertions(+) - -diff --git a/src/bpftrace.cpp b/src/bpftrace.cpp -index 23b65a5..fe2fb66 100644 ---- a/src/bpftrace.cpp -+++ b/src/bpftrace.cpp -@@ -1147,6 +1147,11 @@ int BPFtrace::print_maps() - int BPFtrace::clear_map(IMap &map) - { - std::vector old_key; -+ if (map.is_array_type()) -+ { -+ return zero_map(map); -+ } -+ - try - { - if (map.type_.IsHistTy() || map.type_.IsLhistTy() || -diff --git a/src/imap.h b/src/imap.h -index 27d0d74..ca9f424 100644 ---- a/src/imap.h -+++ b/src/imap.h -@@ -27,6 +27,10 @@ class IMap - return map_type_ == BPF_MAP_TYPE_PERCPU_HASH || - map_type_ == BPF_MAP_TYPE_PERCPU_ARRAY; - } -+ bool is_array_type() -+ { -+ return map_type_ == BPF_MAP_TYPE_PERCPU_ARRAY; -+ } - - // unique id of this map. Used by (bpf) runtime to reference - // this map --- -2.25.4 - diff --git a/SOURCES/bpftrace-0.11.1-RHEL-8-aarch64-fixes-statsnoop-and-opensnoop.patch b/SOURCES/bpftrace-0.11.1-RHEL-8-aarch64-fixes-statsnoop-and-opensnoop.patch deleted file mode 100644 index 3c1599f..0000000 --- a/SOURCES/bpftrace-0.11.1-RHEL-8-aarch64-fixes-statsnoop-and-opensnoop.patch +++ /dev/null @@ -1,64 +0,0 @@ -From e9ebda9b3d14831df5e1c5174d21f322e084d074 Mon Sep 17 00:00:00 2001 -From: Jerome Marchand -Date: Thu, 11 Jun 2020 14:56:36 +0200 -Subject: [PATCH] RHEL-8: aarch64: fixes statsnoop and opensnoop - -On aarch64 the open syscall has been dropped. Only openat remains, -wich is called by libc open() function. - -The state of *stat* syscalls, is a mess. They are several generations -of the system calls, and not all arches provides all of them. For -instance, new(l)stat are missing from aarch64. - -The only way I can think of fixing thess is RHEL-8 only arch specific -patches. ---- - tools/opensnoop.bt | 2 -- - tools/statsnoop.bt | 8 ++------ - 2 files changed, 2 insertions(+), 8 deletions(-) - -diff --git a/tools/opensnoop.bt b/tools/opensnoop.bt -index a7de802..d99db93 100755 ---- a/tools/opensnoop.bt -+++ b/tools/opensnoop.bt -@@ -21,13 +21,11 @@ BEGIN - printf("%-6s %-16s %4s %3s %s\n", "PID", "COMM", "FD", "ERR", "PATH"); - } - --tracepoint:syscalls:sys_enter_open, - tracepoint:syscalls:sys_enter_openat - { - @filename[tid] = args->filename; - } - --tracepoint:syscalls:sys_exit_open, - tracepoint:syscalls:sys_exit_openat - /@filename[tid]/ - { -diff --git a/tools/statsnoop.bt b/tools/statsnoop.bt -index b2d529e..f612ea9 100755 ---- a/tools/statsnoop.bt -+++ b/tools/statsnoop.bt -@@ -30,17 +30,13 @@ tracepoint:syscalls:sys_enter_statfs - @filename[tid] = args->pathname; - } - --tracepoint:syscalls:sys_enter_statx, --tracepoint:syscalls:sys_enter_newstat, --tracepoint:syscalls:sys_enter_newlstat -+tracepoint:syscalls:sys_enter_statx - { - @filename[tid] = args->filename; - } - - tracepoint:syscalls:sys_exit_statfs, --tracepoint:syscalls:sys_exit_statx, --tracepoint:syscalls:sys_exit_newstat, --tracepoint:syscalls:sys_exit_newlstat -+tracepoint:syscalls:sys_exit_statx - /@filename[tid]/ - { - $ret = args->ret; --- -2.25.4 - diff --git a/SOURCES/bpftrace-0.11.1-RHEL-8-fixes.patch b/SOURCES/bpftrace-0.11.1-RHEL-8-fixes.patch deleted file mode 100644 index df3586e..0000000 --- a/SOURCES/bpftrace-0.11.1-RHEL-8-fixes.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 30cd8a899ec375ca0e46db51fa48ee80c5463470 Mon Sep 17 00:00:00 2001 -From: Jerome Marchand -Date: Tue, 11 Jun 2019 16:41:59 +0200 -Subject: [PATCH] RHEL 8 fixes - -Fixes the following RHEL 8 specific issues: - - library path in gethostlatency and threadsnoop ---- - tools/gethostlatency.bt | 12 ++++++------ - tools/threadsnoop.bt | 2 +- - 2 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/tools/gethostlatency.bt b/tools/gethostlatency.bt -index a1ac1b2..ade1005 100755 ---- a/tools/gethostlatency.bt -+++ b/tools/gethostlatency.bt -@@ -26,17 +26,17 @@ BEGIN - "HOST"); - } - --uprobe:/lib/x86_64-linux-gnu/libc.so.6:getaddrinfo, --uprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname, --uprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname2 -+uprobe:/lib64/libc.so.6:getaddrinfo, -+uprobe:/lib64/libc.so.6:gethostbyname, -+uprobe:/lib64/libc.so.6:gethostbyname2 - { - @start[tid] = nsecs; - @name[tid] = arg0; - } - --uretprobe:/lib/x86_64-linux-gnu/libc.so.6:getaddrinfo, --uretprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname, --uretprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname2 -+uretprobe:/lib64/libc.so.6:getaddrinfo, -+uretprobe:/lib64/libc.so.6:gethostbyname, -+uretprobe:/lib64/libc.so.6:gethostbyname2 - /@start[tid]/ - { - $latms = (nsecs - @start[tid]) / 1000000; -diff --git a/tools/threadsnoop.bt b/tools/threadsnoop.bt -index e4d3875..c56b1ac 100755 ---- a/tools/threadsnoop.bt -+++ b/tools/threadsnoop.bt -@@ -18,7 +18,7 @@ BEGIN - printf("%-10s %-6s %-16s %s\n", "TIME(ms)", "PID", "COMM", "FUNC"); - } - --uprobe:/lib/x86_64-linux-gnu/libpthread.so.0:pthread_create -+uprobe:/usr/lib64/libpthread.so:pthread_create - { - printf("%-10u %-6d %-16s %s\n", elapsed / 1000000, pid, comm, - usym(arg2)); --- -2.25.4 - diff --git a/SOURCES/bpftrace-0.11.1-irbuilderbpf.cpp-bpforc.h-Fix-compilation-with-LLVM-.patch b/SOURCES/bpftrace-0.11.1-irbuilderbpf.cpp-bpforc.h-Fix-compilation-with-LLVM-.patch deleted file mode 100644 index 43b02fa..0000000 --- a/SOURCES/bpftrace-0.11.1-irbuilderbpf.cpp-bpforc.h-Fix-compilation-with-LLVM-.patch +++ /dev/null @@ -1,282 +0,0 @@ -From 0768e5f58d39ebb60c18813ea77953be00ce5830 Mon Sep 17 00:00:00 2001 -From: Ovidiu Panait -Date: Thu, 6 Aug 2020 10:34:23 +0300 -Subject: [PATCH] irbuilderbpf.cpp, bpforc.h: Fix compilation with LLVM 11 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fixes: #1384 - -Fix the following build errors when compiling with LLVM 11: - - #1 ----- -/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h:118:35: error: no match for call to ‘(bpftrace::BpfOrc::BpfOrc(llvm::TargetMachine*)::) (llvm::StringRef)’ - 118 | if (JITSymbol Sym = FindSymbol(*S)) { - | ~~~~~~~~~~^~~~ -/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h:118:35: note: candidate: ‘llvm::JITSymbol (*)(const string&)’ {aka ‘llvm::JITSymbol (*)(const std::__cxx11::basic_string&)’} -/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h:118:35: note: candidate expects 2 arguments, 2 provided -In file included from /work/src/github.com/iovisor/bpftrace/src/ast/codegen_llvm.cpp:5: -/work/src/github.com/iovisor/bpftrace/src/bpforc.h:99:13: note: candidate: ‘bpftrace::BpfOrc::BpfOrc(llvm::TargetMachine*)::’ - 99 | [](const std::string &Name __attribute__((unused))) -> JITSymbol { - | ^ -/work/src/github.com/iovisor/bpftrace/src/bpforc.h:99:13: note: no known conversion for argument 1 from ‘llvm::StringRef’ to ‘const string&’ {aka ‘const std::__cxx11::basic_string&’} -In file included from /llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h:23, - - #2 ----- -| /src/ast/irbuilderbpf.cpp: In member function 'llvm::CallInst* bpftrace::ast::IRBuilderBPF::createMapLookup(int, llvm::AllocaInst*)': -| /src/ast/irbuilderbpf.cpp:230:65: error: no matching function for call to 'bpftrace::ast::IRBuilderBPF::CreateCall(llvm::Constant*&, , const char [12])' -| 230 | return CreateCall(lookup_func, { map_ptr, key }, "lookup_elem"); -| | ^ -| In file included from /src/ast/irbuilderbpf.h:9, -| from /src/ast/async_event_types.h:3, -| from /src/ast/irbuilderbpf.cpp:5: -| /usr/include/llvm/IR/IRBuilder.h:2324:13: note: candidate: 'llvm::CallInst* llvm::IRBuilderBase::CreateCall(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef, const llvm::Twine&, llvm::MDNode*)' -| 2324 | CallInst *CreateCall(FunctionType *FTy, Value *Callee, -| | ^~~~~~~~~~ -| /usr/include/llvm/IR/IRBuilder.h:2324:38: note: no known conversion for argument 1 from 'llvm::Constant*' to 'llvm::FunctionType*' -| 2324 | CallInst *CreateCall(FunctionType *FTy, Value *Callee, -| | ~~~~~~~~~~~~~~^~~ - -The CreateCall part is based on the llvm 11 fix from bcc: -https://github.com/iovisor/bcc/commit/45e63f2b316cdce2d8cc925f6f14a8726ade9ff6 - -Signed-off-by: Ovidiu Panait ---- - src/ast/irbuilderbpf.cpp | 55 ++++++++++++++++++++++++++-------------- - src/ast/irbuilderbpf.h | 1 + - src/bpforc.h | 6 +++++ - 3 files changed, 43 insertions(+), 19 deletions(-) - -diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp -index 8ae055e..4498e0f 100644 ---- a/src/ast/irbuilderbpf.cpp -+++ b/src/ast/irbuilderbpf.cpp -@@ -201,10 +201,25 @@ llvm::Type *IRBuilderBPF::GetType(const SizedType &stype) - return ty; - } - -+CallInst *IRBuilderBPF::createCall(Value *callee, -+ ArrayRef args, -+ const Twine &Name) -+{ -+#if LLVM_VERSION_MAJOR >= 11 -+ auto *calleePtrType = cast(callee->getType()); -+ auto *calleeType = cast(calleePtrType->getElementType()); -+ return CreateCall(calleeType, callee, args, Name); -+#else -+ return CreateCall(callee, args, Name); -+#endif -+} -+ - CallInst *IRBuilderBPF::CreateBpfPseudoCall(int mapfd) - { - Function *pseudo_func = module_.getFunction("llvm.bpf.pseudo"); -- return CreateCall(pseudo_func, {getInt64(BPF_PSEUDO_MAP_FD), getInt64(mapfd)}, "pseudo"); -+ return createCall(pseudo_func, -+ { getInt64(BPF_PSEUDO_MAP_FD), getInt64(mapfd) }, -+ "pseudo"); - } - - CallInst *IRBuilderBPF::CreateBpfPseudoCall(Map &map) -@@ -227,7 +242,7 @@ CallInst *IRBuilderBPF::createMapLookup(int mapfd, AllocaInst *key) - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_map_lookup_elem), - lookup_func_ptr_type); -- return CreateCall(lookup_func, { map_ptr, key }, "lookup_elem"); -+ return createCall(lookup_func, { map_ptr, key }, "lookup_elem"); - } - - CallInst *IRBuilderBPF::CreateGetJoinMap(Value *ctx, const location &loc) -@@ -325,7 +340,7 @@ void IRBuilderBPF::CreateMapUpdateElem(Value *ctx, - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_map_update_elem), - update_func_ptr_type); -- CallInst *call = CreateCall(update_func, -+ CallInst *call = createCall(update_func, - { map_ptr, key, val, flags }, - "update_elem"); - CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_map_update_elem, loc); -@@ -349,7 +364,7 @@ void IRBuilderBPF::CreateMapDeleteElem(Value *ctx, - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_map_delete_elem), - delete_func_ptr_type); -- CallInst *call = CreateCall(delete_func, { map_ptr, key }, "delete_elem"); -+ CallInst *call = createCall(delete_func, { map_ptr, key }, "delete_elem"); - CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_map_delete_elem, loc); - } - -@@ -378,7 +393,7 @@ void IRBuilderBPF::CreateProbeRead(Value *ctx, - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_probe_read), - proberead_func_ptr_type); -- CallInst *call = CreateCall(proberead_func, { dst, size, src }, "probe_read"); -+ CallInst *call = createCall(proberead_func, { dst, size, src }, "probe_read"); - CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_probe_read, loc); - } - -@@ -413,7 +428,7 @@ CallInst *IRBuilderBPF::CreateProbeReadStr(Value *ctx, - { - assert(ctx && ctx->getType() == getInt8PtrTy()); - Constant *fn = createProbeReadStrFn(dst->getType(), src->getType()); -- CallInst *call = CreateCall(fn, -+ CallInst *call = createCall(fn, - { dst, getInt32(size), src }, - "probe_read_str"); - CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_probe_read_str, loc); -@@ -434,7 +449,7 @@ CallInst *IRBuilderBPF::CreateProbeReadStr(Value *ctx, - auto *size_i32 = CreateIntCast(size, getInt32Ty(), false); - - Constant *fn = createProbeReadStrFn(dst->getType(), src->getType()); -- CallInst *call = CreateCall(fn, { dst, size_i32, src }, "probe_read_str"); -+ CallInst *call = createCall(fn, { dst, size_i32, src }, "probe_read_str"); - CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_probe_read_str, loc); - return call; - } -@@ -717,7 +732,7 @@ CallInst *IRBuilderBPF::CreateGetNs() - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_ktime_get_ns), - gettime_func_ptr_type); -- return CreateCall(gettime_func, {}, "get_ns"); -+ return createCall(gettime_func, {}, "get_ns"); - } - - CallInst *IRBuilderBPF::CreateGetPidTgid() -@@ -730,7 +745,7 @@ CallInst *IRBuilderBPF::CreateGetPidTgid() - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_get_current_pid_tgid), - getpidtgid_func_ptr_type); -- return CreateCall(getpidtgid_func, {}, "get_pid_tgid"); -+ return createCall(getpidtgid_func, {}, "get_pid_tgid"); - } - - CallInst *IRBuilderBPF::CreateGetCurrentCgroupId() -@@ -744,7 +759,7 @@ CallInst *IRBuilderBPF::CreateGetCurrentCgroupId() - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_get_current_cgroup_id), - getcgroupid_func_ptr_type); -- return CreateCall(getcgroupid_func, {}, "get_cgroup_id"); -+ return createCall(getcgroupid_func, {}, "get_cgroup_id"); - } - - CallInst *IRBuilderBPF::CreateGetUidGid() -@@ -757,7 +772,7 @@ CallInst *IRBuilderBPF::CreateGetUidGid() - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_get_current_uid_gid), - getuidgid_func_ptr_type); -- return CreateCall(getuidgid_func, {}, "get_uid_gid"); -+ return createCall(getuidgid_func, {}, "get_uid_gid"); - } - - CallInst *IRBuilderBPF::CreateGetCpuId() -@@ -770,7 +785,7 @@ CallInst *IRBuilderBPF::CreateGetCpuId() - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_get_smp_processor_id), - getcpuid_func_ptr_type); -- return CreateCall(getcpuid_func, {}, "get_cpu_id"); -+ return createCall(getcpuid_func, {}, "get_cpu_id"); - } - - CallInst *IRBuilderBPF::CreateGetCurrentTask() -@@ -783,7 +798,7 @@ CallInst *IRBuilderBPF::CreateGetCurrentTask() - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_get_current_task), - getcurtask_func_ptr_type); -- return CreateCall(getcurtask_func, {}, "get_cur_task"); -+ return createCall(getcurtask_func, {}, "get_cur_task"); - } - - CallInst *IRBuilderBPF::CreateGetRandom() -@@ -796,7 +811,7 @@ CallInst *IRBuilderBPF::CreateGetRandom() - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_get_prandom_u32), - getrandom_func_ptr_type); -- return CreateCall(getrandom_func, {}, "get_random"); -+ return createCall(getrandom_func, {}, "get_random"); - } - - CallInst *IRBuilderBPF::CreateGetStackId(Value *ctx, -@@ -826,7 +841,7 @@ CallInst *IRBuilderBPF::CreateGetStackId(Value *ctx, - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_get_stackid), - getstackid_func_ptr_type); -- CallInst *call = CreateCall(getstackid_func, -+ CallInst *call = createCall(getstackid_func, - { ctx, map_ptr, flags_val }, - "get_stackid"); - CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_get_stackid, loc); -@@ -852,7 +867,7 @@ void IRBuilderBPF::CreateGetCurrentComm(Value *ctx, - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_get_current_comm), - getcomm_func_ptr_type); -- CallInst *call = CreateCall(getcomm_func, -+ CallInst *call = createCall(getcomm_func, - { buf, getInt64(size) }, - "get_comm"); - CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_get_current_comm, loc); -@@ -883,7 +898,9 @@ void IRBuilderBPF::CreatePerfEventOutput(Value *ctx, Value *data, size_t size) - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_perf_event_output), - perfoutput_func_ptr_type); -- CreateCall(perfoutput_func, {ctx, map_ptr, flags_val, data, size_val}, "perf_event_output"); -+ createCall(perfoutput_func, -+ { ctx, map_ptr, flags_val, data, size_val }, -+ "perf_event_output"); - } - - void IRBuilderBPF::CreateSignal(Value *ctx, Value *sig, const location &loc) -@@ -899,7 +916,7 @@ void IRBuilderBPF::CreateSignal(Value *ctx, Value *sig, const location &loc) - Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_send_signal), - signal_func_ptr_type); -- CallInst *call = CreateCall(signal_func, { sig }, "signal"); -+ CallInst *call = createCall(signal_func, { sig }, "signal"); - CreateHelperErrorCond(ctx, call, libbpf::BPF_FUNC_send_signal, loc); - } - -@@ -913,7 +930,7 @@ void IRBuilderBPF::CreateOverrideReturn(Value *ctx, Value *rc) - Constant *override_func = ConstantExpr::getCast(Instruction::IntToPtr, - getInt64(libbpf::BPF_FUNC_override_return), - override_func_ptr_type); -- CreateCall(override_func, { ctx, rc }, "override"); -+ createCall(override_func, { ctx, rc }, "override"); - } - - Value *IRBuilderBPF::CreatKFuncArg(Value *ctx, -diff --git a/src/ast/irbuilderbpf.h b/src/ast/irbuilderbpf.h -index d4361a8..3111507 100644 ---- a/src/ast/irbuilderbpf.h -+++ b/src/ast/irbuilderbpf.h -@@ -80,6 +80,7 @@ class IRBuilderBPF : public IRBuilder<> - CallInst *CreateGetRandom(); - CallInst *CreateGetStackId(Value *ctx, bool ustack, StackType stack_type, const location& loc); - CallInst *CreateGetJoinMap(Value *ctx, const location& loc); -+ CallInst *createCall(Value *callee, ArrayRef args, const Twine &Name); - void CreateGetCurrentComm(Value *ctx, AllocaInst *buf, size_t size, const location& loc); - void CreatePerfEventOutput(Value *ctx, Value *data, size_t size); - void CreateSignal(Value *ctx, Value *sig, const location &loc); -diff --git a/src/bpforc.h b/src/bpforc.h -index a42e031..295f703 100644 ---- a/src/bpforc.h -+++ b/src/bpforc.h -@@ -96,9 +96,15 @@ class BpfOrc - : TM(TM_), - Resolver(createLegacyLookupResolver( - ES, -+#if LLVM_VERSION_MAJOR >= 11 -+ [](llvm::StringRef Name __attribute__((unused))) -> JITSymbol { -+ return nullptr; -+ }, -+#else - [](const std::string &Name __attribute__((unused))) -> JITSymbol { - return nullptr; - }, -+#endif - [](Error Err) { cantFail(std::move(Err), "lookup failed"); })), - #if LLVM_VERSION_MAJOR > 8 - ObjectLayer(AcknowledgeORCv1Deprecation, --- -2.25.4 - diff --git a/SOURCES/bpftrace-0.12.1-RHEL-8-aarch64-fixes-statsnoop-and-opensnoop.patch b/SOURCES/bpftrace-0.12.1-RHEL-8-aarch64-fixes-statsnoop-and-opensnoop.patch new file mode 100644 index 0000000..54ed64a --- /dev/null +++ b/SOURCES/bpftrace-0.12.1-RHEL-8-aarch64-fixes-statsnoop-and-opensnoop.patch @@ -0,0 +1,64 @@ +From 69f6d7ff04f43451eea2fb028a84a76331bbf6ea Mon Sep 17 00:00:00 2001 +From: Jerome Marchand +Date: Thu, 11 Jun 2020 14:56:36 +0200 +Subject: [PATCH] RHEL-8: aarch64: fixes statsnoop and opensnoop + +On aarch64 the open syscall has been dropped. Only openat remains, +wich is called by libc open() function. + +The state of *stat* syscalls, is a mess. They are several generations +of the system calls, and not all arches provides all of them. For +instance, new(l)stat are missing from aarch64. + +The only way I can think of fixing thess is RHEL-8 only arch specific +patches. +--- + tools/opensnoop.bt | 2 -- + tools/statsnoop.bt | 8 ++------ + 2 files changed, 2 insertions(+), 8 deletions(-) + +diff --git a/tools/opensnoop.bt b/tools/opensnoop.bt +index a7de8026..d99db93e 100755 +--- a/tools/opensnoop.bt ++++ b/tools/opensnoop.bt +@@ -21,13 +21,11 @@ BEGIN + printf("%-6s %-16s %4s %3s %s\n", "PID", "COMM", "FD", "ERR", "PATH"); + } + +-tracepoint:syscalls:sys_enter_open, + tracepoint:syscalls:sys_enter_openat + { + @filename[tid] = args->filename; + } + +-tracepoint:syscalls:sys_exit_open, + tracepoint:syscalls:sys_exit_openat + /@filename[tid]/ + { +diff --git a/tools/statsnoop.bt b/tools/statsnoop.bt +index b2d529e2..f612ea94 100755 +--- a/tools/statsnoop.bt ++++ b/tools/statsnoop.bt +@@ -30,17 +30,13 @@ tracepoint:syscalls:sys_enter_statfs + @filename[tid] = args->pathname; + } + +-tracepoint:syscalls:sys_enter_statx, +-tracepoint:syscalls:sys_enter_newstat, +-tracepoint:syscalls:sys_enter_newlstat ++tracepoint:syscalls:sys_enter_statx + { + @filename[tid] = args->filename; + } + + tracepoint:syscalls:sys_exit_statfs, +-tracepoint:syscalls:sys_exit_statx, +-tracepoint:syscalls:sys_exit_newstat, +-tracepoint:syscalls:sys_exit_newlstat ++tracepoint:syscalls:sys_exit_statx + /@filename[tid]/ + { + $ret = args->ret; +-- +2.30.2 + diff --git a/SOURCES/bpftrace-0.12.1-RHEL-8-fixes.patch b/SOURCES/bpftrace-0.12.1-RHEL-8-fixes.patch new file mode 100644 index 0000000..b2689ae --- /dev/null +++ b/SOURCES/bpftrace-0.12.1-RHEL-8-fixes.patch @@ -0,0 +1,56 @@ +From 3a7f0bf4f506014644cf935332346e3c227123c9 Mon Sep 17 00:00:00 2001 +From: Jerome Marchand +Date: Tue, 11 Jun 2019 16:41:59 +0200 +Subject: [PATCH] RHEL 8 fixes + +Fixes the following RHEL 8 specific issues: + - library path in gethostlatency and threadsnoop +--- + tools/gethostlatency.bt | 12 ++++++------ + tools/threadsnoop.bt | 2 +- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/tools/gethostlatency.bt b/tools/gethostlatency.bt +index 9f4ec31e..dd389c6f 100755 +--- a/tools/gethostlatency.bt ++++ b/tools/gethostlatency.bt +@@ -26,17 +26,17 @@ BEGIN + "HOST"); + } + +-uprobe:/lib/x86_64-linux-gnu/libc.so.6:getaddrinfo, +-uprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname, +-uprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname2 ++uprobe:/lib64/libc.so.6:getaddrinfo, ++uprobe:/lib64/libc.so.6:gethostbyname, ++uprobe:/lib64/libc.so.6:gethostbyname2 + { + @start[tid] = nsecs; + @name[tid] = arg0; + } + +-uretprobe:/lib/x86_64-linux-gnu/libc.so.6:getaddrinfo, +-uretprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname, +-uretprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname2 ++uretprobe:/lib64/libc.so.6:getaddrinfo, ++uretprobe:/lib64/libc.so.6:gethostbyname, ++uretprobe:/lib64/libc.so.6:gethostbyname2 + /@start[tid]/ + { + $latms = (nsecs - @start[tid]) / 1e6; +diff --git a/tools/threadsnoop.bt b/tools/threadsnoop.bt +index 3824bc6d..bdc6e4df 100755 +--- a/tools/threadsnoop.bt ++++ b/tools/threadsnoop.bt +@@ -18,7 +18,7 @@ BEGIN + printf("%-10s %-6s %-16s %s\n", "TIME(ms)", "PID", "COMM", "FUNC"); + } + +-uprobe:/lib/x86_64-linux-gnu/libpthread.so.0:pthread_create ++uprobe:/usr/lib64/libpthread.so:pthread_create + { + printf("%-10u %-6d %-16s %s\n", elapsed / 1e6, pid, comm, + usym(arg2)); +-- +2.30.2 + diff --git a/SPECS/bpftrace.spec b/SPECS/bpftrace.spec index 05b3772..15d63f1 100644 --- a/SPECS/bpftrace.spec +++ b/SPECS/bpftrace.spec @@ -1,16 +1,14 @@ %bcond_without llvm_static Name: bpftrace -Version: 0.11.1 -Release: 3%{?dist} +Version: 0.12.1 +Release: 1%{?dist} Summary: High-level tracing language for Linux eBPF License: ASL 2.0 URL: https://github.com/iovisor/bpftrace Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz Patch0: %{name}-%{version}-RHEL-8-fixes.patch -Patch1: %{name}-%{version}-irbuilderbpf.cpp-bpforc.h-Fix-compilation-with-LLVM-.patch -Patch2: %{name}-%{version}-Fix-clear-when-called-on-an-array.patch # WARNING: because of the arch-specific patch, no autosetup is used # Remember to patch accordingly Patch10: %{name}-%{version}-RHEL-8-aarch64-fixes-statsnoop-and-opensnoop.patch @@ -36,6 +34,9 @@ BuildRequires: binutils-devel BuildRequires: llvm-static %endif +# We don't need kernel-devel to use bpftrace, but some tools need it +Recommends: kernel-devel + %description BPFtrace is a high-level tracing language for Linux enhanced Berkeley Packet Filter (eBPF) available in recent Linux kernels (4.x). BPFtrace uses LLVM as a @@ -50,8 +51,6 @@ and predecessor tracers such as DTrace and SystemTap %setup %patch0 -p1 -%patch1 -p1 -%patch2 -p1 %ifarch aarch64 %patch10 -p1 @@ -61,8 +60,7 @@ and predecessor tracers such as DTrace and SystemTap %cmake . \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DBUILD_TESTING:BOOL=OFF \ - -DBUILD_SHARED_LIBS:BOOL=OFF \ - -DLIBBCC_LIBRARIES:PATH=%{_libdir}/libbcc-no-libbpf.so + -DBUILD_SHARED_LIBS:BOOL=OFF %make_build @@ -79,11 +77,6 @@ and predecessor tracers such as DTrace and SystemTap find %{buildroot}%{_datadir}/%{name}/tools -type f -exec \ sed -i -e '1s=^#!/usr/bin/env %{name}\([0-9.]\+\)\?$=#!%{_bindir}/%{name}=' {} \; -# Move man pages to the right location -#mkdir -p %{buildroot}%{_mandir} -#mv %{buildroot}%{_prefix}/man/* %{buildroot}%{_mandir}/ - - %files %doc README.md CONTRIBUTING-TOOLS.md %doc docs/reference_guide.md docs/tutorial_one_liners.md