diff --git a/.github/workflows/ci-aarchxx.yml b/.github/workflows/ci-aarchxx.yml index bbff3d5b..2c5d396b 100644 --- a/.github/workflows/ci-aarchxx.yml +++ b/.github/workflows/ci-aarchxx.yml @@ -45,7 +45,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive # Cancel any prior runs for a PR (but do not cancel master branch runs). - uses: n1hility/cancel-previous-runs@v2 @@ -87,7 +87,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive # Cancel any prior runs for a PR (but do not cancel master branch runs). - uses: n1hility/cancel-previous-runs@v2 diff --git a/.github/workflows/ci-clang.yml b/.github/workflows/ci-clang.yml index 8068cd7b..0c6cb0ff 100644 --- a/.github/workflows/ci-clang.yml +++ b/.github/workflows/ci-clang.yml @@ -45,7 +45,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive # Cancel any prior runs for a PR (but do not cancel master branch runs). - uses: n1hility/cancel-previous-runs@v2 diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml index 9e0593ed..9bc82c9b 100644 --- a/.github/workflows/ci-docs.yml +++ b/.github/workflows/ci-docs.yml @@ -54,7 +54,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive - name: Fetch Sources run: | diff --git a/.github/workflows/ci-osx.yml b/.github/workflows/ci-osx.yml index 50c65d9d..332fb8af 100644 --- a/.github/workflows/ci-osx.yml +++ b/.github/workflows/ci-osx.yml @@ -45,7 +45,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive # Cancel any prior runs for a PR (but do not cancel master branch runs). - uses: n1hility/cancel-previous-runs@v2 diff --git a/.github/workflows/ci-package.yml b/.github/workflows/ci-package.yml index 538b1b34..b17559cf 100644 --- a/.github/workflows/ci-package.yml +++ b/.github/workflows/ci-package.yml @@ -50,7 +50,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive - name: Fetch Sources run: git fetch --no-tags --depth=1 origin master @@ -121,7 +121,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive - name: Fetch Sources run: git fetch --no-tags --depth=1 origin master @@ -170,7 +170,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive - name: Fetch Sources run: git fetch --no-tags --depth=1 origin master @@ -246,7 +246,7 @@ jobs: # We need a checkout to run git log for the version. - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive - name: Get Version id: version diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index e6e09aaa..bf89c781 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -45,7 +45,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive # Cancel any prior runs for a PR (but do not cancel master branch runs). - uses: n1hility/cancel-previous-runs@v2 @@ -86,7 +86,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive # Cancel any prior runs for a PR (but do not cancel master branch runs). - uses: n1hility/cancel-previous-runs@v2 @@ -127,7 +127,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive # Cancel any prior runs for a PR (but do not cancel master branch runs). - uses: n1hility/cancel-previous-runs@v2 diff --git a/.github/workflows/ci-x86.yml b/.github/workflows/ci-x86.yml index 06ab05c7..b047fa4d 100644 --- a/.github/workflows/ci-x86.yml +++ b/.github/workflows/ci-x86.yml @@ -45,7 +45,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true + submodules: recursive # Cancel any prior runs for a PR (but do not cancel master branch runs). - uses: n1hility/cancel-previous-runs@v2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 71d5d4d0..504d1eb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # ********************************************************** -# Copyright (c) 2010-2022 Google, Inc. All rights reserved. +# Copyright (c) 2010-2023 Google, Inc. All rights reserved. # Copyright (c) 2009-2010 VMware, Inc. All rights reserved. # ********************************************************** @@ -336,6 +336,11 @@ if (UNIX) "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie -Wl,--export-dynamic") endif () endif () + # TODO i#2485: Add DWARF-5 support. + CHECK_C_COMPILER_FLAG("-gdwarf-5" have_dwarf5) + if (have_dwarf5) + set(EXTRA_FLAGS "${EXTRA_FLAGS} -gdwarf-4") + endif () # We use C++11. set(EXTRA_CXXFLAGS "-std=c++11") set(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER} diff --git a/drltrace/CMakeLists.txt b/drltrace/CMakeLists.txt index 41df5494..793d9fc9 100644 --- a/drltrace/CMakeLists.txt +++ b/drltrace/CMakeLists.txt @@ -1,5 +1,5 @@ # ********************************************************** -# Copyright (c) 2010-2020 Google, Inc. All rights reserved. +# Copyright (c) 2010-2023 Google, Inc. All rights reserved. # Copyright (c) 2009-2010 VMware, Inc. All rights reserved. # ********************************************************** @@ -194,11 +194,11 @@ else () set(libcall_both_variants " arg 0: done \\(type=char\\*, size=0x([0-9a-f]+)\\)\n") set(libcall_args1_01 ${libcall_both_variants}) - set(libcall_args2_0 " arg 0: /dev/null \\(type=char \\*\\*, size=0x([0-9a-f]+)\\)\n") - set(libcall_args2_1 " arg 1: 0x([0-9a-f]+) \\(type=\\*, size=0x([0-9a-f]+)\\)\n") + set(libcall_args2_0 " arg 0: /dev/null \\(type=char\\*, size=0x([0-9a-f]+)\\)\n") + set(libcall_args2_1 " arg 1: 0x([0-9a-f]+) \\(type=int, size=0x([0-9a-f]+)\\)\n") - set(libcall_name1 "~~([0-9a-f]+)~~ libc.so.6!puts\n") - set(libcall_name2 "~~([0-9a-f]+)~~ libc.so.6!open\n") + set(libcall_name1 "~~([0-9a-f]+)~~ libc.so.6!.*puts\n") + set(libcall_name2 "~~([0-9a-f]+)~~ libc.so.6!.*open\n") endif(WIN32) set_tests_properties(drltrace_libcalls PROPERTIES PASS_REGULAR_EXPRESSION ${libcall_name1}${libcall_args1_01}${libcall_args1_02}${libcall_ret}) diff --git a/drltrace/drltrace.cpp b/drltrace/drltrace.cpp index 3c920d9f..a8f015d4 100644 --- a/drltrace/drltrace.cpp +++ b/drltrace/drltrace.cpp @@ -1,5 +1,5 @@ /* *************************************************************************** - * Copyright (c) 2013-2019 Google, Inc. All rights reserved. + * Copyright (c) 2013-2023 Google, Inc. All rights reserved. * ***************************************************************************/ /* @@ -59,6 +59,9 @@ * the library entries. */ +using ::dynamorio::droption::droption_parser_t; +using ::dynamorio::droption::DROPTION_SCOPE_CLIENT; + /* Where to write the trace */ static file_t outf; diff --git a/drltrace/drltrace_frontend.cpp b/drltrace/drltrace_frontend.cpp index 9b098a41..689b638f 100644 --- a/drltrace/drltrace_frontend.cpp +++ b/drltrace/drltrace_frontend.cpp @@ -1,5 +1,5 @@ /* *************************************************************************** - * Copyright (c) 2017-2019 Google, Inc. All rights reserved. + * Copyright (c) 2017-2023 Google, Inc. All rights reserved. * ***************************************************************************/ /* @@ -46,6 +46,10 @@ #include "utils.h" #include +using ::dynamorio::droption::droption_parser_t; +using ::dynamorio::droption::DROPTION_SCOPE_ALL; +using ::dynamorio::droption::DROPTION_SCOPE_FRONTEND; + #define MAX_DR_CMDLINE (MAXIMUM_PATH*6) #define DRLTRACE_ERROR(msg, ...) do { \ diff --git a/drltrace/drltrace_linux.config b/drltrace/drltrace_linux.config index eba109bc..5481ce73 100644 --- a/drltrace/drltrace_linux.config +++ b/drltrace/drltrace_linux.config @@ -1,5 +1,5 @@ # *************************************************************************** -# Copyright (c) 2017 Google, Inc. All rights reserved. +# Copyright (c) 2017-2023 Google, Inc. All rights reserved. # *************************************************************************** # # @@ -47,4 +47,6 @@ int|strcmp|char *|char * int|wcscmp|wchar *|wchar * int|printf|char * int|puts|char * - +int|_IO_puts|char * +int|open|char *|int +int|__open|char *|int diff --git a/drltrace/drltrace_options.cpp b/drltrace/drltrace_options.cpp index bd7d42b6..c4575a95 100644 --- a/drltrace/drltrace_options.cpp +++ b/drltrace/drltrace_options.cpp @@ -1,5 +1,5 @@ /* *************************************************************************** - * Copyright (c) 2013-2019 Google, Inc. All rights reserved. + * Copyright (c) 2013-2023 Google, Inc. All rights reserved. * ***************************************************************************/ /* @@ -33,6 +33,14 @@ #include "droption.h" #include "drltrace_options.h" +using ::dynamorio::droption::DROPTION_FLAG_ACCUMULATE; +using ::dynamorio::droption::DROPTION_FLAG_INTERNAL; +using ::dynamorio::droption::DROPTION_FLAG_SWEEP; +using ::dynamorio::droption::DROPTION_SCOPE_ALL; +using ::dynamorio::droption::DROPTION_SCOPE_CLIENT; +using ::dynamorio::droption::DROPTION_SCOPE_FRONTEND; +using ::dynamorio::droption::droption_t; + /* Frontend scope is defined here because if logdir is a forbidden path we have to change * it and provide for our client manually. */ diff --git a/drltrace/drltrace_options.h b/drltrace/drltrace_options.h index 1857f153..e2971c2f 100644 --- a/drltrace/drltrace_options.h +++ b/drltrace/drltrace_options.h @@ -1,5 +1,5 @@ /* *************************************************************************** - * Copyright (c) 2013-2019 Google, Inc. All rights reserved. + * Copyright (c) 2013-2023 Google, Inc. All rights reserved. * ***************************************************************************/ /* @@ -32,20 +32,20 @@ #include "droption.h" -extern droption_t op_logdir; -extern droption_t op_only_from_app; -extern droption_t op_follow_children; -extern droption_t op_print_ret_addr; -extern droption_t op_unknown_args; -extern droption_t op_max_args; -extern droption_t op_config_file_default; -extern droption_t op_config_file; -extern droption_t op_sysnum_file; -extern droption_t op_symcache_dir; -extern droption_t op_ignore_underscore; -extern droption_t op_only_to_lib; -extern droption_t op_help; -extern droption_t op_version; -extern droption_t op_verbose; -extern droption_t op_use_config; -extern droption_t op_ltracelib_ops; +extern dynamorio::droption::droption_t op_logdir; +extern dynamorio::droption::droption_t op_only_from_app; +extern dynamorio::droption::droption_t op_follow_children; +extern dynamorio::droption::droption_t op_print_ret_addr; +extern dynamorio::droption::droption_t op_unknown_args; +extern dynamorio::droption::droption_t op_max_args; +extern dynamorio::droption::droption_t op_config_file_default; +extern dynamorio::droption::droption_t op_config_file; +extern dynamorio::droption::droption_t op_sysnum_file; +extern dynamorio::droption::droption_t op_symcache_dir; +extern dynamorio::droption::droption_t op_ignore_underscore; +extern dynamorio::droption::droption_t op_only_to_lib; +extern dynamorio::droption::droption_t op_help; +extern dynamorio::droption::droption_t op_version; +extern dynamorio::droption::droption_t op_verbose; +extern dynamorio::droption::droption_t op_use_config; +extern dynamorio::droption::droption_t op_ltracelib_ops; diff --git a/drmemory/docs/using.dox b/drmemory/docs/using.dox index cf9403c5..53751b6f 100644 --- a/drmemory/docs/using.dox +++ b/drmemory/docs/using.dox @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2022 Google, Inc. All rights reserved. + * Copyright (c) 2011-2023 Google, Inc. All rights reserved. * Copyright (c) 2009-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -228,14 +228,15 @@ but should eliminate skipped frames. ******************** \section sec_prep_linux Linux -Dr. Memory currently only supports DWARF2 line information, not stabs. -DWARF2 is the default for modern versions of \p gcc. +Dr. Memory currently only supports DWARF2 through DWARF4 line information, not +stabs nor DWARF5. DWARF4 can be requested from the compiler with the `-gdwarf-4` +flag. Here is a sample command line for compiling your application that combines all of the above recommendations: \verbatim -g++ -g -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp +g++ -g -gdwarf-4 -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp \endverbatim ******************** @@ -243,14 +244,15 @@ g++ -g -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp Ensure your compiler is able to build 32-bit applications. -Dr. Memory currently only supports DWARF2 line information, not stabs. -DWARF2 is the default for modern versions of \p gcc as well as \p clang. +Dr. Memory currently only supports DWARF2 through DWARF4 line information, not +stabs nor DWARF5. DWARF4 can be requested from the compiler with the `-gdwarf-4` +flag. Here is a sample command line for compiling your application that combines all of the above recommendations: \verbatim -c++ -m32 -g -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp +c++ -m32 -g -gdwarf-4 -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp \endverbatim ******************** diff --git a/drsyscall/linux_defines.h b/drsyscall/linux_defines.h index 45bbf35b..fd7e4c55 100644 --- a/drsyscall/linux_defines.h +++ b/drsyscall/linux_defines.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2022 Google, Inc. All rights reserved. + * Copyright (c) 2011-2023 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -226,7 +226,18 @@ struct rlimit64 { * each (-> 8 bytes vs. 128 bytes) */ #define MAX_SIGNUM 64 -#define _NSIG_WORDS (MAX_SIGNUM / sizeof(unsigned long)) +/* size of long */ +#ifdef X64 +# define _NSIG_BPW 64 +#else +# define _NSIG_BPW 32 +#endif +#ifdef LINUX +# define _NSIG_WORDS (MAX_SIGNUM / _NSIG_BPW) +#else +# define _NSIG_WORDS 1 /* avoid 0 */ +#endif + typedef struct _kernel_sigset_t { unsigned long sig[_NSIG_WORDS]; } kernel_sigset_t; diff --git a/drsyscall/table_linux.c b/drsyscall/table_linux.c index a014dbff..1ff3d0c1 100644 --- a/drsyscall/table_linux.c +++ b/drsyscall/table_linux.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2022 Google, Inc. All rights reserved. + * Copyright (c) 2010-2023 Google, Inc. All rights reserved. * Copyright (c) 2009-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -1100,7 +1100,14 @@ syscall_info_t syscall_info[] = { {{PACKNUM(299,337,365,AARCH64_recvmmsg),0},"recvmmsg", UNKNOWN, RLONG, 0, }, {{PACKNUM(300,338,367,AARCH64_fanotify_init),0},"fanotify_init", UNKNOWN, RLONG, 0, }, {{PACKNUM(301,339,368,AARCH64_fanotify_mark),0},"fanotify_mark", UNKNOWN, RLONG, 0, }, - {{PACKNUM(302,340,369,AARCH64_prlimit64),0},"prlimit64", UNKNOWN, RLONG, 0, }, + {{PACKNUM(302,340,369,AARCH64_prlimit64),0},"prlimit64", OK, RLONG, 4, + { + {0, sizeof(pid_t), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT}, + {1, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT}, + {2, sizeof(struct rlimit), R}, + {3, sizeof(struct rlimit), W}, + } + }, {{PACKNUM(303,341,370,AARCH64_name_to_handle_at),0},"name_to_handle_at", UNKNOWN, RLONG, 0, }, {{PACKNUM(304,342,371,AARCH64_open_by_handle_at),0},"open_by_handle_at", UNKNOWN, RLONG, 0, }, {{PACKNUM(305,343,372,AARCH64_clock_adjtime),0},"clock_adjtime", UNKNOWN, RLONG, 0, }, @@ -1139,6 +1146,22 @@ syscall_info_t syscall_info[] = { {2, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT}, } }, + /* TODO: Fill in the ones in between. */ + {{PACKNUM(318,355,384,AARCH64_getrandom),0},"getrandom", OK, RLONG, 3, + { + {0, -1, W}, + {1, sizeof(size_t), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT}, + {2, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT}, + } + }, + {{PACKNUM(334,386,398,AARCH64_rseq),0},"rseq", OK, RLONG, 4, + { + {0, -1, R}, + {1, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT}, + {2, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT}, + {3, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT}, + } + }, /**************************************************/ /* 64-bit only (some are on ARM too) */ diff --git a/make/git/devsetup.sh b/make/git/devsetup.sh index 2f38b12a..537fdbd0 100755 --- a/make/git/devsetup.sh +++ b/make/git/devsetup.sh @@ -1,7 +1,7 @@ #!/bin/sh # ********************************************************** -# Copyright (c) 2014-2017 Google, Inc. All rights reserved. +# Copyright (c) 2014-2023 Google, Inc. All rights reserved. # ********************************************************** # Dr. Memory: the memory debugger @@ -24,7 +24,7 @@ # immediately after cloning. # Set up submodules -git submodule update --init +git submodule update --init --recursive # Convert CRLF to LF on commit but not checkout: git config core.autocrlf input diff --git a/make/git/git_pullall.sh b/make/git/git_pullall.sh index ee2a31fc..7f430bab 100755 --- a/make/git/git_pullall.sh +++ b/make/git/git_pullall.sh @@ -1,7 +1,7 @@ #!/bin/bash # ********************************************************** -# Copyright (c) 2017 Google, Inc. All rights reserved. +# Copyright (c) 2017-2023 Google, Inc. All rights reserved. # ********************************************************** # Redistribution and use in source and binary forms, with or without @@ -41,11 +41,11 @@ has_remote=$(git ls-remote origin ${branch}) if test -z "${has_remote}"; then echo "No remote: updating with rebase from master." git pull --rebase --prune - git submodule update --init + git submodule update --init --recursive else echo "First, updating with rebase from remote ${branch}." git pull --rebase origin ${branch} echo -e "\nNow, merging changes from master." git pull --no-rebase --prune - git submodule update --init + git submodule update --init --recursive fi