Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 44570ea

Browse files
eulohkvanhees
authored andcommitted
Set lockmem limit before checking BPF helper functions
In dtrace_init(), we set the locked-memory limit, either to the user-specified value (if any) or to unlimited (by default). We also check to make sure that certain BPF helper functions are available, falling over to alternatives or indicating they are not available in case of problems. It is possible, however, that the limit is too low when dtrace starts, causing problems with the helper-function tests before dtrace_init() even has a chance to reset the limit. Switch the order to set the limit before checking the helper functions. A test is added. The underlying problem, however, depends on kernel version, how locked memory is handled, the behavior of fallback functions, and so on. So the test could easily pass on some systems even if the fix is not employed. Signed-off-by: Eugene Loh <eugene.loh@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
1 parent 29c01a5 commit 44570ea

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

‎libdtrace/dt_open.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,13 +1213,6 @@ dtrace_init(dtrace_hdl_t *dtp)
12131213
return dt_set_errno(dtp, EDT_CTF);
12141214
}
12151215

1216-
/*
1217-
* Initialize the BPF library handling.
1218-
*/
1219-
dt_bpf_init(dtp);
1220-
dt_btf_get_module_ids(dtp);
1221-
dt_dlib_init(dtp);
1222-
12231216
/*
12241217
* Set the locked-memory limit.
12251218
*/
@@ -1228,6 +1221,13 @@ dtrace_init(dtrace_hdl_t *dtp)
12281221
rl.rlim_cur = rl.rlim_max = lockmem;
12291222
setrlimit(RLIMIT_MEMLOCK, &rl);
12301223

1224+
/*
1225+
* Initialize the BPF library handling.
1226+
*/
1227+
dt_bpf_init(dtp);
1228+
dt_btf_get_module_ids(dtp);
1229+
dt_dlib_init(dtp);
1230+
12311231
/*
12321232
* Initialize consume handling.
12331233
*/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
|Delay in ns needed in delay env|
2+
-- @@stderr --
3+
Delay in ns needed in delay env var.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
#
3+
# Oracle Linux DTrace.
4+
# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
5+
# Licensed under the Universal Permissive License v 1.0 as shown at
6+
# http://oss.oracle.com/licenses/upl.
7+
8+
dtrace=1ドル
9+
10+
# Check that dtrace runs by default even if ulimit -l is very low.
11+
ulimit -l 1
12+
13+
$dtrace $dt_flags -c test/triggers/delaydie -qn '
14+
syscall::write:entry
15+
/pid == $target/
16+
{
17+
printf("|%s|", copyinstr(arg1, 32));
18+
}'
19+
20+
exit $?

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /