From 4d69b5f1e082d9409ae8bf56ed21fd8f7249c8ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Mon, 12 Feb 2024 20:54:26 +0000 Subject: [PATCH 1/3] ci: Add manylinux job To match the build environment used for building release binaries. --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37e8503d34..0a85a90eb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,11 +85,13 @@ jobs: ./configure --build=linux-x86 --host=linux-x86 ${{ env.GUM_OPTIONS }} make - name: Upload Gum devkit + if: ${{ !startsWith(matrix.id, 'linux-') }} uses: actions/upload-artifact@v4 with: name: gum-devkit-${{ matrix.id }} path: build/gum/devkit/ - name: Upload GumJS devkit + if: ${{ !startsWith(matrix.id, 'linux-') }} uses: actions/upload-artifact@v4 with: name: gumjs-devkit-${{ matrix.id }} @@ -121,16 +123,48 @@ jobs: ./configure ${{ matrix.opts }} ${{ env.GUM_OPTIONS }} make - name: Upload Gum devkit + if: ${{ !startsWith(matrix.id, 'linux-') }} uses: actions/upload-artifact@v4 with: name: gum-devkit-${{ matrix.id }} path: build/gum/devkit/ - name: Upload GumJS devkit + if: ${{ !startsWith(matrix.id, 'linux-') }} uses: actions/upload-artifact@v4 with: name: gumjs-devkit-${{ matrix.id }} path: build/bindings/gumjs/devkit/ + manylinux: + strategy: + matrix: + arch: [x86, x86_64, x86_64-musl, armhf, arm64, arm64-musl, mips, mipsel, mips64, mips64el] + fail-fast: false + runs-on: ubuntu-latest + container: ghcr.io/frida/x-tools-linux-${{ matrix.arch }}:latest + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Build + run: | + ./configure --host=$XTOOLS_HOST ${{ env.GUM_OPTIONS }} + make + - name: Upload Gum devkit + uses: actions/upload-artifact@v4 + with: + name: gum-devkit-linux-${{ matrix.arch }} + path: build/gum/devkit/ + - name: Upload GumJS devkit + uses: actions/upload-artifact@v4 + with: + name: gumjs-devkit-linux-${{ matrix.arch }} + path: build/bindings/gumjs/devkit/ + - name: Test + if: matrix.arch == 'x86' || matrix.arch == 'x86_64' + run: make test + mobile: strategy: matrix: From 63e6571203bffa9b87c42c52951fe151b237bebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Mon, 12 Feb 2024 22:06:43 +0000 Subject: [PATCH 2/3] tests: Skip thread name tests if libc is too old --- meson.build | 18 ++++++++++++------ tests/core/process.c | 12 ++++++++---- tests/gumjs/script.c | 16 ++++++++++------ 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/meson.build b/meson.build index 110aff56c8..73765901b6 100644 --- a/meson.build +++ b/meson.build @@ -465,12 +465,18 @@ if ffi_dep.found() and (ffi_dep.type_name() == 'internal' or cc.has_function('ff cdata.set('HAVE_FRIDA_LIBFFI', 1) endif -if cc.has_function('pthread_attr_getstack', - args: ['-D_GNU_SOURCE'], - dependencies: [threads_dep], - prefix: '#include ') - cdata.set('HAVE_PTHREAD_ATTR_GETSTACK', 1) -endif +pthread_functions = [ + 'pthread_attr_getstack', + 'pthread_setname_np', +] +foreach f : pthread_functions + if cc.has_function(f, + args: ['-D_GNU_SOURCE'], + dependencies: [threads_dep], + prefix: '#include ') + cdata.set('HAVE_' + f.to_upper(), 1) + endif +endforeach if host_os_family == 'windows' extra_deps += cc.find_library('psapi') diff --git a/tests/core/process.c b/tests/core/process.c index 8fa67d813e..b46db3bf20 100644 --- a/tests/core/process.c +++ b/tests/core/process.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2023 Ole André Vadla Ravnås + * Copyright (C) 2008-2024 Ole André Vadla Ravnås * Copyright (C) 2008 Christian Berentsen * Copyright (C) 2015 Asger Hautop Drewsen * Copyright (C) 2023 Grant Douglas @@ -154,8 +154,8 @@ static gboolean thread_found_cb (const GumThreadDetails * details, gpointer user_data); static gboolean thread_check_cb (const GumThreadDetails * details, gpointer user_data); -static gboolean thread_collect_if_matching_id (const GumThreadDetails * details, - gpointer user_data); +G_GNUC_UNUSED static gboolean thread_collect_if_matching_id ( + const GumThreadDetails * details, gpointer user_data); static gboolean module_found_cb (const GumModuleDetails * details, gpointer user_data); static gboolean import_found_cb (const GumImportDetails * details, @@ -240,6 +240,9 @@ TESTCASE (process_threads_exclude_cloaked) TESTCASE (process_threads_should_include_name) { +#if defined (HAVE_LINUX) && !defined (HAVE_PTHREAD_SETNAME_NP) + g_print (" "); +#else volatile gboolean done = FALSE; GThread * thread; GumThreadDetails d = { 0, }; @@ -256,6 +259,7 @@ TESTCASE (process_threads_should_include_name) g_thread_join (thread); g_free ((gpointer) d.name); +#endif } static gboolean @@ -1146,7 +1150,7 @@ sleeping_dummy (gpointer data) * to GLib potentially having been prebuilt against an old libc. Therefore we * set the name manually using pthreads. */ -#ifdef HAVE_LINUX +#if defined (HAVE_LINUX) && defined (HAVE_PTHREAD_SETNAME_NP) pthread_setname_np (pthread_self (), sync_data->name); #endif diff --git a/tests/gumjs/script.c b/tests/gumjs/script.c index a1bcbdd6fa..d4060b0289 100644 --- a/tests/gumjs/script.c +++ b/tests/gumjs/script.c @@ -568,7 +568,7 @@ static gpointer run_stalked_through_target_function (gpointer data); #endif static gpointer sleeping_dummy (gpointer data); -static gpointer named_sleeper (gpointer data); +G_GNUC_UNUSED static gpointer named_sleeper (gpointer data); static gpointer invoke_target_function_int_worker (gpointer data); static gpointer invoke_target_function_trigger (gpointer data); @@ -5052,21 +5052,24 @@ sleeping_dummy (gpointer data) TESTCASE (process_threads_have_names) { +#if defined (HAVE_LINUX) && !defined (HAVE_PTHREAD_SETNAME_NP) + g_print (" "); +#else GumNamedSleeperContext ctx; GThread * thread; -#ifdef HAVE_LINUX +# ifdef HAVE_LINUX if (!check_exception_handling_testable ()) return; -#endif +# endif -#ifdef HAVE_MIPS +# ifdef HAVE_MIPS if (!g_test_slow ()) { g_print (" "); return; } -#endif +# endif ctx.controller_messages = g_async_queue_new (); ctx.sleeper_messages = g_async_queue_new (); @@ -5085,6 +5088,7 @@ TESTCASE (process_threads_have_names) g_async_queue_unref (ctx.sleeper_messages); g_async_queue_unref (ctx.controller_messages); +#endif } static gpointer @@ -5097,7 +5101,7 @@ named_sleeper (gpointer data) * to GLib potentially having been prebuilt against an old libc. Therefore we * set the name manually using pthreads. */ -#ifdef HAVE_LINUX +#if defined (HAVE_LINUX) && defined (HAVE_PTHREAD_SETNAME_NP) pthread_setname_np (pthread_self (), "named-sleeper"); #endif From 44c4784ce8b7fae6f13e0933f9854475e16af7a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Mon, 12 Feb 2024 22:21:38 +0000 Subject: [PATCH 3/3] submodules: Bump releng --- releng | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releng b/releng index 15f999bce4..441d32997c 160000 --- a/releng +++ b/releng @@ -1 +1 @@ -Subproject commit 15f999bce49093a4f77d06c8116d7661d70c7c9b +Subproject commit 441d32997cba5e73610dd80a7063fb635877ca8f