diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5089c38295..5ad3c7ba0e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -108,14 +108,19 @@ jobs: build-sysdig-others: name: build-sysdig-${{ matrix.os }}-${{ matrix.arch }} + timeout-minutes: 45 strategy: matrix: - os: [windows-latest, macos-15-intel, macos-14] + os: [windows-latest, windows-11-arm, macos-15-intel, macos-14] include: - os: windows-latest artifact_name: win artifact_ext: exe arch: x86_64 + - os: windows-11-arm + artifact_name: win + artifact_ext: exe + arch: arm64 - os: macos-15-intel artifact_name: osx artifact_ext: dmg @@ -129,12 +134,17 @@ jobs: - name: Checkout Sysdig uses: actions/checkout@v4 - name: Install NSIS - if: matrix.os == 'windows-latest' + if: startsWith(matrix.os, 'windows') run: | choco install nsis -y - name: Build + # Disable MSBuild node reuse: on the windows-11-arm runner a leftover + # MSBuild node deadlocks the nested try_compile of the container plugin + # configure step, hanging the whole build. + env: + MSBUILDDISABLENODEREUSE: 1 run: | - cmake -Wno-dev -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -S . -B build + cmake -Wno-dev "-DCMAKE_POLICY_VERSION_MINIMUM=3.5" -S . -B build cmake --build build --target package --config Release - name: Upload Artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/release-draft.yaml b/.github/workflows/release-draft.yaml index 37a539a0e0..09e37ceddc 100644 --- a/.github/workflows/release-draft.yaml +++ b/.github/workflows/release-draft.yaml @@ -103,14 +103,19 @@ jobs: build-release-others: name: build-release-others + timeout-minutes: 45 strategy: matrix: - os: [windows-latest, macos-15-intel, macos-14] + os: [windows-latest, windows-11-arm, macos-15-intel, macos-14] include: - os: windows-latest artifact_name: win artifact_ext: exe arch: x86_64 + - os: windows-11-arm + artifact_name: win + artifact_ext: exe + arch: arm64 - os: macos-15-intel artifact_name: osx artifact_ext: dmg @@ -124,12 +129,17 @@ jobs: - name: Checkout Sysdig uses: actions/checkout@v4 - name: Install NSIS - if: matrix.os == 'windows-latest' + if: startsWith(matrix.os, 'windows') run: | choco install nsis -y - name: Build + # Disable MSBuild node reuse: on the windows-11-arm runner a leftover + # MSBuild node deadlocks the nested try_compile of the container plugin + # configure step, hanging the whole build. + env: + MSBUILDDISABLENODEREUSE: 1 run: | - cmake -Wno-dev -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DBUILD_DRIVER=OFF -DSYSDIG_VERSION="${{ env.BUILD_VERSION }}" -S . -B build + cmake -Wno-dev "-DCMAKE_POLICY_VERSION_MINIMUM=3.5" -DBUILD_DRIVER=OFF -DSYSDIG_VERSION="${{ env.BUILD_VERSION }}" -S . -B build cmake --build build --target package --config Release - name: Upload Artifacts uses: actions/upload-artifact@v4 diff --git a/cmake/modules/container_plugin.cmake b/cmake/modules/container_plugin.cmake index 790f7f4bbb..3d39c7b7fe 100644 --- a/cmake/modules/container_plugin.cmake +++ b/cmake/modules/container_plugin.cmake @@ -79,8 +79,13 @@ else() SOURCE_SUBDIR plugins/container BUILD_IN_SOURCE 1 BUILD_BYPRODUCTS "${CONTAINER_LIBRARY}" + # USE_NEON=OFF: the plugin pulls in RE-flex, whose SIMD detection uses + # check_cxx_source_runs() for NEON. On Windows arm64 the NEON test + # compiles and then *runs* a scratch executable, which hangs the build + # on the windows-11-arm runner. Disabling NEON skips that run-test + # (scalar fallback) and is a no-op on Windows x86_64. CONFIGURE_COMMAND - ${CMAKE_COMMAND} . -DENABLE_ASYNC=OFF -G "${CMAKE_GENERATOR}" + ${CMAKE_COMMAND} . -DENABLE_ASYNC=OFF -DUSE_NEON=OFF -G "${CMAKE_GENERATOR}" BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} INSTALL_COMMAND "" ) diff --git a/cmake/modules/luajit.cmake b/cmake/modules/luajit.cmake index 3359e45e68..1bf4ac91be 100644 --- a/cmake/modules/luajit.cmake +++ b/cmake/modules/luajit.cmake @@ -72,8 +72,8 @@ else() elseif(APPLE) ExternalProject_Add(luajit PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix" - URL "https://github.com/LuaJIT/LuaJIT/archive/8635cbabf3094c4d8bd00578c7d812bea87bb2d3.tar.gz" - URL_HASH "SHA256=835035b244c3dc3d3d19bdd5ac623af90b84207e6330fb78f9fa51d6e200d760" + URL "https://github.com/LuaJIT/LuaJIT/archive/8e6520a7aecd0517e792b359afbbfd7274791f5f.tar.gz" + URL_HASH "SHA256=9c4c370559352e0622231d5a1f28e95ff56e2dce6308238e6588b0943aac5e63" CONFIGURE_COMMAND "" BUILD_COMMAND make MACOSX_DEPLOYMENT_TARGET=10.14 BUILD_IN_SOURCE 1 @@ -83,7 +83,7 @@ else() ExternalProject_Add(luajit PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix" GIT_REPOSITORY "https://github.com/LuaJIT/LuaJIT" - GIT_TAG "f3c856915b4ce7ccd24341e8ac73e8a9fd934171" + GIT_TAG "8e6520a7aecd0517e792b359afbbfd7274791f5f" CONFIGURE_COMMAND "" BUILD_COMMAND make BUILD_IN_SOURCE 1 @@ -97,12 +97,26 @@ else() COMPONENT "libs-deps" FILES_MATCHING PATTERN "*.h") else() + # msvcbuild.bat selects its DynASM target from %VSCMD_ARG_TGT_ARCH%, + # which a VS dev prompt sets but which is absent inside CMake's MSBuild + # custom build step. Without it the script defaults to the x64 source + # (vm_x64.dasc) regardless of the real compiler, so on arm64 the + # generated buildvm_arch.h references CCallState.nfpr (an x64-only + # field) and the arm64 build fails with C2039. Pass the actual VS + # target platform through so the DynASM source matches the compiler. + if(CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") + set(LUAJIT_MSVC_TGT_ARCH "arm64") + elseif(CMAKE_VS_PLATFORM_NAME STREQUAL "Win32") + set(LUAJIT_MSVC_TGT_ARCH "x86") + else() + set(LUAJIT_MSVC_TGT_ARCH "x64") + endif() ExternalProject_Add(luajit PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix" GIT_REPOSITORY "https://github.com/LuaJIT/LuaJIT" - GIT_TAG "f3c856915b4ce7ccd24341e8ac73e8a9fd934171" + GIT_TAG "8e6520a7aecd0517e792b359afbbfd7274791f5f" CONFIGURE_COMMAND "" - BUILD_COMMAND msvcbuild.bat static + BUILD_COMMAND cmd /c "set VSCMD_ARG_TGT_ARCH=${LUAJIT_MSVC_TGT_ARCH}&& msvcbuild.bat static" BUILD_BYPRODUCTS ${LUAJIT_LIB} BINARY_DIR "${LUAJIT_SRC}" INSTALL_COMMAND "") diff --git a/userspace/sysdig/CMakeLists.txt b/userspace/sysdig/CMakeLists.txt index 4acbb0300c..a534bd84ad 100644 --- a/userspace/sysdig/CMakeLists.txt +++ b/userspace/sysdig/CMakeLists.txt @@ -164,17 +164,17 @@ else() add_custom_command(TARGET sysdig POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_directory "${PROJECT_SOURCE_DIR}/userspace/sysdig/chisels" - "${PROJECT_BINARY_DIR}/$(Configuration)/chisels") + "${PROJECT_BINARY_DIR}/$/chisels") add_custom_command(TARGET sysdig POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_if_different $ - "${PROJECT_BINARY_DIR}/$(Configuration)/sysdig.exe") + "${PROJECT_BINARY_DIR}/$/sysdig.exe") add_custom_command(TARGET csysdig POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_if_different $ - "${PROJECT_BINARY_DIR}/$(Configuration)/csysdig.exe") + "${PROJECT_BINARY_DIR}/$/csysdig.exe") install(TARGETS sysdig DESTINATION programs diff --git a/userspace/sysdig/sysdig.cpp b/userspace/sysdig/sysdig.cpp index 8c87d32723..7d6265ebd1 100644 --- a/userspace/sysdig/sysdig.cpp +++ b/userspace/sysdig/sysdig.cpp @@ -976,6 +976,23 @@ std::string escape_output_format(const std::string& s) return ss.str(); } +// +// Find the ':' separating a plugin/input name from its trailing +// config/params (e.g. "name:config"). On Windows, a leading drive-letter +// colon ("C:\path") must not be mistaken for that separator. +// +static size_t find_name_config_separator(const std::string& s) +{ + size_t start = 0; +#ifdef _WIN32 + if(s.size() >= 2 && s[1] == ':') + { + start = 2; + } +#endif + return s.find(':', start); +} + // // ARGUMENT PARSING AND PROGRAM SETUP // @@ -1230,7 +1247,7 @@ sysdig_init_res sysdig_init(int argc, char **argv) case 'H': { std::string pluginname = optarg; - size_t cpos = pluginname.find(':'); + size_t cpos = find_name_config_separator(pluginname); std::string pgname = pluginname; std::string pginitconf; // Extract init config from string if present @@ -1252,7 +1269,7 @@ sysdig_init_res sysdig_init(int argc, char **argv) break; } - size_t cpos = inputname.find(':'); + size_t cpos = find_name_config_separator(inputname); std::string pgname = inputname; std::string pgpars; // Extract open params from string if present @@ -1976,8 +1993,15 @@ sysdig_init_res sysdig_init(int argc, char **argv) handle_end_of_file(NULL, opener.options.print_progress, reset_colors); res.m_res = EXIT_FAILURE; } + catch(const std::exception& e) + { + std::cerr << e.what() << std::endl; + handle_end_of_file(NULL, opener.options.print_progress, reset_colors); + res.m_res = EXIT_FAILURE; + } catch(...) { + std::cerr << "unknown exception" << std::endl; handle_end_of_file(NULL, opener.options.print_progress, reset_colors); res.m_res = EXIT_FAILURE; } diff --git a/userspace/sysdig/utils/plugin_utils.cpp b/userspace/sysdig/utils/plugin_utils.cpp index e419e73a8c..f7502fbbbf 100644 --- a/userspace/sysdig/utils/plugin_utils.cpp +++ b/userspace/sysdig/utils/plugin_utils.cpp @@ -279,15 +279,36 @@ void plugin_utils::load_plugin(sinsp *inspector, const std::string& name) } } - // If it is a path, register it - if (name.find('/') != std::string::npos) + // If it is a path, register it. + if (name.find('/') != std::string::npos +#ifdef _WIN32 + // On Windows, also accept backslash separators and drive-letter + // paths like "C:\path\plugin.dll". + || name.find('\\') != std::string::npos + || (name.size() >= 2 && name[1] == ':') +#endif + ) { + // Load the plugin to get its canonical name, then check if an existing + // entry (e.g., from read_plugins_from_dirs) already represents it. + // If so, update that entry rather than creating a duplicate. + std::string canonical_name = inspector->register_plugin(name)->name(); + for (auto &existing : m_plugins) + { + if (existing.names.find(canonical_name) != existing.names.end()) + { + existing.used = true; + existing.libpath = name; + existing.names.insert(name); + return; + } + } plugin_entry p; p.used = true; p.inited = false; p.libpath = name; p.names.insert(name); - p.names.insert(p.get_plugin(inspector)->name()); + p.names.insert(canonical_name); m_plugins.push_back(p); return; }