Skip to content

Commit 77bbc00

Browse files
Update DR and fix associated DR and recent-Linux issues (#2484)
Updates DR to bbd4ffadd. Fixes several issues with the latest DR and recent Linux platforms: + DWARF5 is now the gcc default but is not supported (#2485) so we add -gdwarf-4 to our test flags and the docs. + Adds Linux syscall entries for rseq and getrandom, seen on tiny apps now. + Fixes a bug in the size of kernel_sigset_t which was resulting in false positive uninitialized errors in rt_sigaction. + Updates drltrace code for droption now being in a namespace. + Adds --recursive to the git submodule commands to get minizip for the DR build. + Relaxes the drltrace tests to allow __IO_puts and __open.
1 parent d4b9a40 commit 77bbc00

20 files changed

+117
-59
lines changed

.github/workflows/ci-aarchxx.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
steps:
4646
- uses: actions/checkout@v2
4747
with:
48-
submodules: true
48+
submodules: recursive
4949

5050
# Cancel any prior runs for a PR (but do not cancel master branch runs).
5151
- uses: n1hility/cancel-previous-runs@v2
@@ -87,7 +87,7 @@ jobs:
8787
steps:
8888
- uses: actions/checkout@v2
8989
with:
90-
submodules: true
90+
submodules: recursive
9191

9292
# Cancel any prior runs for a PR (but do not cancel master branch runs).
9393
- uses: n1hility/cancel-previous-runs@v2

.github/workflows/ci-clang.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
steps:
4646
- uses: actions/checkout@v2
4747
with:
48-
submodules: true
48+
submodules: recursive
4949

5050
# Cancel any prior runs for a PR (but do not cancel master branch runs).
5151
- uses: n1hility/cancel-previous-runs@v2

.github/workflows/ci-docs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
steps:
5555
- uses: actions/checkout@v2
5656
with:
57-
submodules: true
57+
submodules: recursive
5858

5959
- name: Fetch Sources
6060
run: |

.github/workflows/ci-osx.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
steps:
4646
- uses: actions/checkout@v2
4747
with:
48-
submodules: true
48+
submodules: recursive
4949

5050
# Cancel any prior runs for a PR (but do not cancel master branch runs).
5151
- uses: n1hility/cancel-previous-runs@v2

.github/workflows/ci-package.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
steps:
5151
- uses: actions/checkout@v2
5252
with:
53-
submodules: true
53+
submodules: recursive
5454

5555
- name: Fetch Sources
5656
run: git fetch --no-tags --depth=1 origin master
@@ -121,7 +121,7 @@ jobs:
121121
steps:
122122
- uses: actions/checkout@v2
123123
with:
124-
submodules: true
124+
submodules: recursive
125125

126126
- name: Fetch Sources
127127
run: git fetch --no-tags --depth=1 origin master
@@ -170,7 +170,7 @@ jobs:
170170
steps:
171171
- uses: actions/checkout@v2
172172
with:
173-
submodules: true
173+
submodules: recursive
174174

175175
- name: Fetch Sources
176176
run: git fetch --no-tags --depth=1 origin master
@@ -246,7 +246,7 @@ jobs:
246246
# We need a checkout to run git log for the version.
247247
- uses: actions/checkout@v2
248248
with:
249-
submodules: true
249+
submodules: recursive
250250

251251
- name: Get Version
252252
id: version

.github/workflows/ci-windows.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
steps:
4646
- uses: actions/checkout@v2
4747
with:
48-
submodules: true
48+
submodules: recursive
4949

5050
# Cancel any prior runs for a PR (but do not cancel master branch runs).
5151
- uses: n1hility/cancel-previous-runs@v2
@@ -86,7 +86,7 @@ jobs:
8686
steps:
8787
- uses: actions/checkout@v2
8888
with:
89-
submodules: true
89+
submodules: recursive
9090

9191
# Cancel any prior runs for a PR (but do not cancel master branch runs).
9292
- uses: n1hility/cancel-previous-runs@v2
@@ -127,7 +127,7 @@ jobs:
127127
steps:
128128
- uses: actions/checkout@v2
129129
with:
130-
submodules: true
130+
submodules: recursive
131131

132132
# Cancel any prior runs for a PR (but do not cancel master branch runs).
133133
- uses: n1hility/cancel-previous-runs@v2

.github/workflows/ci-x86.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
steps:
4646
- uses: actions/checkout@v2
4747
with:
48-
submodules: true
48+
submodules: recursive
4949

5050
# Cancel any prior runs for a PR (but do not cancel master branch runs).
5151
- uses: n1hility/cancel-previous-runs@v2

CMakeLists.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# **********************************************************
2-
# Copyright (c) 2010-2022 Google, Inc. All rights reserved.
2+
# Copyright (c) 2010-2023 Google, Inc. All rights reserved.
33
# Copyright (c) 2009-2010 VMware, Inc. All rights reserved.
44
# **********************************************************
55

@@ -336,6 +336,11 @@ if (UNIX)
336336
"${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie -Wl,--export-dynamic")
337337
endif ()
338338
endif ()
339+
# TODO i#2485: Add DWARF-5 support.
340+
CHECK_C_COMPILER_FLAG("-gdwarf-5" have_dwarf5)
341+
if (have_dwarf5)
342+
set(EXTRA_FLAGS "${EXTRA_FLAGS} -gdwarf-4")
343+
endif ()
339344
# We use C++11.
340345
set(EXTRA_CXXFLAGS "-std=c++11")
341346
set(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}

drltrace/CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# **********************************************************
2-
# Copyright (c) 2010-2020 Google, Inc. All rights reserved.
2+
# Copyright (c) 2010-2023 Google, Inc. All rights reserved.
33
# Copyright (c) 2009-2010 VMware, Inc. All rights reserved.
44
# **********************************************************
55

@@ -194,11 +194,11 @@ else ()
194194
set(libcall_both_variants " arg 0: done \\(type=char\\*, size=0x([0-9a-f]+)\\)\n")
195195
set(libcall_args1_01 ${libcall_both_variants})
196196

197-
set(libcall_args2_0 " arg 0: /dev/null \\(type=char \\*\\*, size=0x([0-9a-f]+)\\)\n")
198-
set(libcall_args2_1 " arg 1: 0x([0-9a-f]+) \\(type=<unknown>\\*, size=0x([0-9a-f]+)\\)\n")
197+
set(libcall_args2_0 " arg 0: /dev/null \\(type=char\\*, size=0x([0-9a-f]+)\\)\n")
198+
set(libcall_args2_1 " arg 1: 0x([0-9a-f]+) \\(type=int, size=0x([0-9a-f]+)\\)\n")
199199

200-
set(libcall_name1 "~~([0-9a-f]+)~~ libc.so.6!puts\n")
201-
set(libcall_name2 "~~([0-9a-f]+)~~ libc.so.6!open\n")
200+
set(libcall_name1 "~~([0-9a-f]+)~~ libc.so.6!.*puts\n")
201+
set(libcall_name2 "~~([0-9a-f]+)~~ libc.so.6!.*open\n")
202202
endif(WIN32)
203203
set_tests_properties(drltrace_libcalls PROPERTIES PASS_REGULAR_EXPRESSION
204204
${libcall_name1}${libcall_args1_01}${libcall_args1_02}${libcall_ret})

drltrace/drltrace.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ***************************************************************************
2-
* Copyright (c) 2013-2019 Google, Inc. All rights reserved.
2+
* Copyright (c) 2013-2023 Google, Inc. All rights reserved.
33
* ***************************************************************************/
44

55
/*
@@ -59,6 +59,9 @@
5959
* the library entries.
6060
*/
6161

62+
using ::dynamorio::droption::droption_parser_t;
63+
using ::dynamorio::droption::DROPTION_SCOPE_CLIENT;
64+
6265
/* Where to write the trace */
6366
static file_t outf;
6467

drltrace/drltrace_frontend.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ***************************************************************************
2-
* Copyright (c) 2017-2019 Google, Inc. All rights reserved.
2+
* Copyright (c) 2017-2023 Google, Inc. All rights reserved.
33
* ***************************************************************************/
44

55
/*
@@ -46,6 +46,10 @@
4646
#include "utils.h"
4747
#include <string.h>
4848

49+
using ::dynamorio::droption::droption_parser_t;
50+
using ::dynamorio::droption::DROPTION_SCOPE_ALL;
51+
using ::dynamorio::droption::DROPTION_SCOPE_FRONTEND;
52+
4953
#define MAX_DR_CMDLINE (MAXIMUM_PATH*6)
5054

5155
#define DRLTRACE_ERROR(msg, ...) do { \

drltrace/drltrace_linux.config

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ***************************************************************************
2-
# Copyright (c) 2017 Google, Inc. All rights reserved.
2+
# Copyright (c) 2017-2023 Google, Inc. All rights reserved.
33
# ***************************************************************************
44
#
55
#
@@ -47,4 +47,6 @@ int|strcmp|char *|char *
4747
int|wcscmp|wchar *|wchar *
4848
int|printf|char *
4949
int|puts|char *
50-
50+
int|_IO_puts|char *
51+
int|open|char *|int
52+
int|__open|char *|int

drltrace/drltrace_options.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ***************************************************************************
2-
* Copyright (c) 2013-2019 Google, Inc. All rights reserved.
2+
* Copyright (c) 2013-2023 Google, Inc. All rights reserved.
33
* ***************************************************************************/
44

55
/*
@@ -33,6 +33,14 @@
3333
#include "droption.h"
3434
#include "drltrace_options.h"
3535

36+
using ::dynamorio::droption::DROPTION_FLAG_ACCUMULATE;
37+
using ::dynamorio::droption::DROPTION_FLAG_INTERNAL;
38+
using ::dynamorio::droption::DROPTION_FLAG_SWEEP;
39+
using ::dynamorio::droption::DROPTION_SCOPE_ALL;
40+
using ::dynamorio::droption::DROPTION_SCOPE_CLIENT;
41+
using ::dynamorio::droption::DROPTION_SCOPE_FRONTEND;
42+
using ::dynamorio::droption::droption_t;
43+
3644
/* Frontend scope is defined here because if logdir is a forbidden path we have to change
3745
* it and provide for our client manually.
3846
*/

drltrace/drltrace_options.h

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ***************************************************************************
2-
* Copyright (c) 2013-2019 Google, Inc. All rights reserved.
2+
* Copyright (c) 2013-2023 Google, Inc. All rights reserved.
33
* ***************************************************************************/
44

55
/*
@@ -32,20 +32,20 @@
3232

3333
#include "droption.h"
3434

35-
extern droption_t<std::string> op_logdir;
36-
extern droption_t<bool> op_only_from_app;
37-
extern droption_t<bool> op_follow_children;
38-
extern droption_t<bool> op_print_ret_addr;
39-
extern droption_t<unsigned int> op_unknown_args;
40-
extern droption_t<int> op_max_args;
41-
extern droption_t<bool> op_config_file_default;
42-
extern droption_t<std::string> op_config_file;
43-
extern droption_t<std::string> op_sysnum_file;
44-
extern droption_t<std::string> op_symcache_dir;
45-
extern droption_t<bool> op_ignore_underscore;
46-
extern droption_t<std::string> op_only_to_lib;
47-
extern droption_t<bool> op_help;
48-
extern droption_t<bool> op_version;
49-
extern droption_t<unsigned int> op_verbose;
50-
extern droption_t<bool> op_use_config;
51-
extern droption_t<std::string> op_ltracelib_ops;
35+
extern dynamorio::droption::droption_t<std::string> op_logdir;
36+
extern dynamorio::droption::droption_t<bool> op_only_from_app;
37+
extern dynamorio::droption::droption_t<bool> op_follow_children;
38+
extern dynamorio::droption::droption_t<bool> op_print_ret_addr;
39+
extern dynamorio::droption::droption_t<unsigned int> op_unknown_args;
40+
extern dynamorio::droption::droption_t<int> op_max_args;
41+
extern dynamorio::droption::droption_t<bool> op_config_file_default;
42+
extern dynamorio::droption::droption_t<std::string> op_config_file;
43+
extern dynamorio::droption::droption_t<std::string> op_sysnum_file;
44+
extern dynamorio::droption::droption_t<std::string> op_symcache_dir;
45+
extern dynamorio::droption::droption_t<bool> op_ignore_underscore;
46+
extern dynamorio::droption::droption_t<std::string> op_only_to_lib;
47+
extern dynamorio::droption::droption_t<bool> op_help;
48+
extern dynamorio::droption::droption_t<bool> op_version;
49+
extern dynamorio::droption::droption_t<unsigned int> op_verbose;
50+
extern dynamorio::droption::droption_t<bool> op_use_config;
51+
extern dynamorio::droption::droption_t<std::string> op_ltracelib_ops;

drmemory/docs/using.dox

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* **********************************************************
2-
* Copyright (c) 2011-2022 Google, Inc. All rights reserved.
2+
* Copyright (c) 2011-2023 Google, Inc. All rights reserved.
33
* Copyright (c) 2009-2010 VMware, Inc. All rights reserved.
44
* **********************************************************/
55

@@ -228,29 +228,31 @@ but should eliminate skipped frames.
228228
********************
229229
\section sec_prep_linux Linux
230230

231-
Dr. Memory currently only supports DWARF2 line information, not stabs.
232-
DWARF2 is the default for modern versions of \p gcc.
231+
Dr. Memory currently only supports DWARF2 through DWARF4 line information, not
232+
stabs nor DWARF5. DWARF4 can be requested from the compiler with the `-gdwarf-4`
233+
flag.
233234

234235
Here is a sample command line for compiling your application that combines
235236
all of the above recommendations:
236237

237238
\verbatim
238-
g++ -g -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp
239+
g++ -g -gdwarf-4 -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp
239240
\endverbatim
240241

241242
********************
242243
\section sec_prep_mac Mac
243244

244245
Ensure your compiler is able to build 32-bit applications.
245246

246-
Dr. Memory currently only supports DWARF2 line information, not stabs.
247-
DWARF2 is the default for modern versions of \p gcc as well as \p clang.
247+
Dr. Memory currently only supports DWARF2 through DWARF4 line information, not
248+
stabs nor DWARF5. DWARF4 can be requested from the compiler with the `-gdwarf-4`
249+
flag.
248250

249251
Here is a sample command line for compiling your application that combines
250252
all of the above recommendations:
251253

252254
\verbatim
253-
c++ -m32 -g -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp
255+
c++ -m32 -g -gdwarf-4 -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp
254256
\endverbatim
255257

256258
********************

drsyscall/linux_defines.h

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* **********************************************************
2-
* Copyright (c) 2011-2022 Google, Inc. All rights reserved.
2+
* Copyright (c) 2011-2023 Google, Inc. All rights reserved.
33
* Copyright (c) 2007-2010 VMware, Inc. All rights reserved.
44
* **********************************************************/
55

@@ -226,7 +226,18 @@ struct rlimit64 {
226226
* each (-> 8 bytes vs. 128 bytes)
227227
*/
228228
#define MAX_SIGNUM 64
229-
#define _NSIG_WORDS (MAX_SIGNUM / sizeof(unsigned long))
229+
/* size of long */
230+
#ifdef X64
231+
# define _NSIG_BPW 64
232+
#else
233+
# define _NSIG_BPW 32
234+
#endif
235+
#ifdef LINUX
236+
# define _NSIG_WORDS (MAX_SIGNUM / _NSIG_BPW)
237+
#else
238+
# define _NSIG_WORDS 1 /* avoid 0 */
239+
#endif
240+
230241
typedef struct _kernel_sigset_t {
231242
unsigned long sig[_NSIG_WORDS];
232243
} kernel_sigset_t;

drsyscall/table_linux.c

+25-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* **********************************************************
2-
* Copyright (c) 2010-2022 Google, Inc. All rights reserved.
2+
* Copyright (c) 2010-2023 Google, Inc. All rights reserved.
33
* Copyright (c) 2009-2010 VMware, Inc. All rights reserved.
44
* **********************************************************/
55

@@ -1100,7 +1100,14 @@ syscall_info_t syscall_info[] = {
11001100
{{PACKNUM(299,337,365,AARCH64_recvmmsg),0},"recvmmsg", UNKNOWN, RLONG, 0, },
11011101
{{PACKNUM(300,338,367,AARCH64_fanotify_init),0},"fanotify_init", UNKNOWN, RLONG, 0, },
11021102
{{PACKNUM(301,339,368,AARCH64_fanotify_mark),0},"fanotify_mark", UNKNOWN, RLONG, 0, },
1103-
{{PACKNUM(302,340,369,AARCH64_prlimit64),0},"prlimit64", UNKNOWN, RLONG, 0, },
1103+
{{PACKNUM(302,340,369,AARCH64_prlimit64),0},"prlimit64", OK, RLONG, 4,
1104+
{
1105+
{0, sizeof(pid_t), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT},
1106+
{1, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT},
1107+
{2, sizeof(struct rlimit), R},
1108+
{3, sizeof(struct rlimit), W},
1109+
}
1110+
},
11041111
{{PACKNUM(303,341,370,AARCH64_name_to_handle_at),0},"name_to_handle_at", UNKNOWN, RLONG, 0, },
11051112
{{PACKNUM(304,342,371,AARCH64_open_by_handle_at),0},"open_by_handle_at", UNKNOWN, RLONG, 0, },
11061113
{{PACKNUM(305,343,372,AARCH64_clock_adjtime),0},"clock_adjtime", UNKNOWN, RLONG, 0, },
@@ -1139,6 +1146,22 @@ syscall_info_t syscall_info[] = {
11391146
{2, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT},
11401147
}
11411148
},
1149+
/* TODO: Fill in the ones in between. */
1150+
{{PACKNUM(318,355,384,AARCH64_getrandom),0},"getrandom", OK, RLONG, 3,
1151+
{
1152+
{0, -1, W},
1153+
{1, sizeof(size_t), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT},
1154+
{2, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT},
1155+
}
1156+
},
1157+
{{PACKNUM(334,386,398,AARCH64_rseq),0},"rseq", OK, RLONG, 4,
1158+
{
1159+
{0, -1, R},
1160+
{1, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT},
1161+
{2, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT},
1162+
{3, sizeof(int), SYSARG_INLINED, DRSYS_TYPE_SIGNED_INT},
1163+
}
1164+
},
11421165

11431166
/**************************************************/
11441167
/* 64-bit only (some are on ARM too) */

dynamorio

Submodule dynamorio updated 616 files

0 commit comments

Comments
 (0)