1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
--- ./lttng-ust-2.9.0.orig/liblttng-ust-dl/lttng-ust-dl.c
+++ lttng-ust-2.9.0/liblttng-ust-dl/lttng-ust-dl.c
@@ -38,8 +38,6 @@
#include "ust_dl.h"
static void *(*__lttng_ust_plibc_dlopen)(const char *filename, int flags);
-static void *(*__lttng_ust_plibc_dlmopen)(Lmid_t nsid, const char *filename,
- int flags);
static int (*__lttng_ust_plibc_dlclose)(void *handle);
static
@@ -56,20 +54,6 @@
}
static
-void *_lttng_ust_dl_libc_dlmopen(Lmid_t nsid, const char *filename,
- int flags)
-{
- if (!__lttng_ust_plibc_dlmopen) {
- __lttng_ust_plibc_dlmopen = dlsym(RTLD_NEXT, "dlmopen");
- if (!__lttng_ust_plibc_dlmopen) {
- fprintf(stderr, "%s\n", dlerror());
- return NULL;
- }
- }
- return __lttng_ust_plibc_dlmopen(nsid, filename, flags);
-}
-
-static
int _lttng_ust_dl_libc_dlclose(void *handle)
{
if (!__lttng_ust_plibc_dlclose) {
@@ -143,67 +127,6 @@
return;
}
-static
-void lttng_ust_dl_dlmopen(void *so_base, Lmid_t nsid, const char *so_name,
- int flags, void *ip)
-{
- char resolved_path[PATH_MAX];
- struct lttng_ust_elf *elf;
- uint64_t memsz;
- uint8_t *build_id = NULL;
- size_t build_id_len;
- char *dbg_file = NULL;
- uint32_t crc;
- int has_build_id = 0, has_debug_link = 0;
- int ret;
-
- if (!realpath(so_name, resolved_path)) {
- ERR("could not resolve path '%s'", so_name);
- return;
- }
-
- elf = lttng_ust_elf_create(resolved_path);
- if (!elf) {
- ERR("could not acces file %s", resolved_path);
- return;
- }
-
- ret = lttng_ust_elf_get_memsz(elf, &memsz);
- if (ret) {
- goto end;
- }
- ret = lttng_ust_elf_get_build_id(
- elf, &build_id, &build_id_len, &has_build_id);
- if (ret) {
- goto end;
- }
- ret = lttng_ust_elf_get_debug_link(
- elf, &dbg_file, &crc, &has_debug_link);
- if (ret) {
- goto end;
- }
-
- tracepoint(lttng_ust_dl, dlmopen,
- ip, so_base, nsid, resolved_path, flags, memsz,
- has_build_id, has_debug_link);
-
- if (has_build_id) {
- tracepoint(lttng_ust_dl, build_id,
- ip, so_base, build_id, build_id_len);
- }
-
- if (has_debug_link) {
- tracepoint(lttng_ust_dl, debug_link,
- ip, so_base, dbg_file, crc);
- }
-
-end:
- free(dbg_file);
- free(build_id);
- lttng_ust_elf_destroy(elf);
- return;
-}
-
void *dlopen(const char *filename, int flags)
{
void *handle;
@@ -221,27 +144,6 @@
}
lttng_ust_dl_update(LTTNG_UST_CALLER_IP());
return handle;
-}
-
-void *dlmopen(Lmid_t nsid, const char *filename, int flags)
-{
- void *handle;
-
- handle = _lttng_ust_dl_libc_dlmopen(nsid, filename, flags);
- if (__tracepoint_ptrs_registered && handle) {
- struct link_map *p = NULL;
- int ret;
-
- ret = dlinfo(handle, RTLD_DI_LINKMAP, &p);
- if (ret != -1 && p != NULL && p->l_addr != 0) {
- lttng_ust_dl_dlmopen((void *) p->l_addr,
- nsid, p->l_name, flags,
- LTTNG_UST_CALLER_IP());
- }
- }
- lttng_ust_dl_update(LTTNG_UST_CALLER_IP());
- return handle;
-
}
int dlclose(void *handle)
--- ./lttng-ust-2.9.0.orig/liblttng-ust-dl/ust_dl.h
+++ lttng-ust-2.9.0/liblttng-ust-dl/ust_dl.h
@@ -51,22 +51,6 @@
)
)
-TRACEPOINT_EVENT(lttng_ust_dl, dlmopen,
- TP_ARGS(void *, ip, void *, baddr, Lmid_t, nsid,
- const char *, path, int, flags,
- uint64_t, memsz, uint8_t, has_build_id,
- uint8_t, has_debug_link),
- TP_FIELDS(
- ctf_integer_hex(void *, baddr, baddr)
- ctf_integer(uint64_t, memsz, memsz)
- ctf_integer(Lmid_t, nsid, nsid)
- ctf_integer_hex(int, flags, flags)
- ctf_string(path, path)
- ctf_integer(uint8_t, has_build_id, has_build_id)
- ctf_integer(uint8_t, has_debug_link, has_debug_link)
- )
-)
-
TRACEPOINT_EVENT(lttng_ust_dl, build_id,
TP_ARGS(
void *, ip,
|