Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compile on old cmake version and add PATH #346

Merged
merged 6 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:noble"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
10 changes: 6 additions & 4 deletions .github/workflows/test-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,19 @@ jobs:
run: |
make -C example -j
- name: Upload build results (without jit)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
Copy link
Contributor

Choose a reason for hiding this comment

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

In master branch it is still v2, I saw the errors, is v4 in actions? I think jobs are not able to find this

Copy link
Contributor

Choose a reason for hiding this comment

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

if: ${{!matrix.enable_jit}}
with:
name: runtime-package-no-jit-${{matrix.container.name}}
include-hidden-files: true
path: |
~/.bpftime
- name: Upload build results (with jit)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{matrix.enable_jit}}
with:
name: runtime-package-jit-${{matrix.container.name}}
include-hidden-files: true
path: |
~/.bpftime
build-and-test:
Expand Down Expand Up @@ -162,13 +164,13 @@ jobs:
steps:
- name: Download prebuilt runtime (with jit)
if: ${{matrix.enable_jit}}
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: runtime-package-jit-${{matrix.container.name}}
path: ~/.bpftime
- name: Download prebuilt runtime (without jit)
if: ${{!matrix.enable_jit}}
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: runtime-package-no-jit-${{matrix.container.name}}
path: ~/.bpftime
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ To get started, you can build and run a libbpf based eBPF program starts with `b

```console
make -C example/malloc # Build the eBPF program example
export PATH=$PATH:~/.bpftime/
bpftime load ./example/malloc/malloc
```

Expand Down
1 change: 0 additions & 1 deletion attach/base_attach_impl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ add_dependencies(bpftime_base_attach_impl spdlog::spdlog)

target_link_libraries(bpftime_base_attach_impl INTERFACE spdlog::spdlog)

set_property(TARGET bpftime_base_attach_impl PROPERTY CXX_STANDARD 20)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use C++ 20?

2 changes: 1 addition & 1 deletion attach/frida_uprobe_attach_impl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set(FRIDA_UPROBE_ATTACH_IMPL_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE S

target_include_directories(bpftime_frida_uprobe_attach_impl PRIVATE ${SPDLOG_INCLUDE} ${FRIDA_UPROBE_ATTACH_IMPL_INCLUDE} PUBLIC ${FRIDA_GUM_INSTALL_DIR} ${BASE_ATTACH_IMPL_INCLUDE})

target_link_libraries(bpftime_frida_uprobe_attach_impl PRIVATE ${FRIDA_GUM_INSTALL_DIR}/libfrida-gum.a PUBLIC bpftime_base_attach_impl spdlog::spdlog)
target_link_libraries(bpftime_frida_uprobe_attach_impl PRIVATE ${FRIDA_GUM_INSTALL_DIR}/libfrida-gum.a PUBLIC bpftime_base_attach_impl spdlog::spdlog dl)

set(TEST_SOURCES
test/test_uprobe_uretprobe.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include <optional>
#include <syscall_trace_attach_impl.hpp>

#ifdef __linux__
#include <asm/unistd.h> // For architecture-specific syscall numbers
#endif

namespace bpftime
{
namespace attach
Expand All @@ -16,8 +20,11 @@ int64_t syscall_trace_attach_impl::dispatch_syscall(int64_t sys_nr,
int64_t arg3, int64_t arg4,
int64_t arg5, int64_t arg6)
{
// Exit syscall may cause bugs since it's not return to userspace
#ifdef __linux__
if (sys_nr == __NR_exit_group || sys_nr == __NR_exit)
return orig_syscall(sys_nr, arg1, arg2, arg3, arg4, arg5, arg6);
#endif
SPDLOG_DEBUG("Syscall callback {} {} {} {} {} {} {}", sys_nr, arg1,
arg2, arg3, arg4, arg5, arg6);
// Indicate whether the return value is overridden
Expand Down
2 changes: 1 addition & 1 deletion benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ add_dependencies(simple-benchmark-with-embed-ebpf-calling bpftime_vm libbpf)
target_compile_definitions(simple-benchmark-with-embed-ebpf-calling
PRIVATE
)
target_link_libraries(simple-benchmark-with-embed-ebpf-calling bpftime_vm ${LIBBPF_LIBRARIES} elf z)
target_link_libraries(simple-benchmark-with-embed-ebpf-calling bpftime_vm ${LIBBPF_LIBRARIES} elf z dl)
target_include_directories(simple-benchmark-with-embed-ebpf-calling
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}../vm/include
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "libbpf/include/linux/filter.h"
#include <linux/bpf_common.h>
#include <linux/perf_event.h>
#include <asm/unistd.h>
#include <sys/ioctl.h>
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
Expand Down
1 change: 1 addition & 0 deletions runtime/src/bpf_map/userspace/prog_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "linux/bpf.h"
#include <bpf/libbpf.h>
#include <gnu/lib-names.h>
#include <asm/unistd.h>
#elif __APPLE__
#include "bpftime_epoll.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion vm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.16)
#
# Project details
#
Expand Down
Loading