projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a HT to lookup sessions by id
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
syscall.c
diff --git
a/src/bin/lttng-sessiond/syscall.c
b/src/bin/lttng-sessiond/syscall.c
index ee7578051e2a12d3322cb6e3d9fd4ae2946da1a7..7b9227b86912f8a80628167fdc2908df2eb6ccf4 100644
(file)
--- a/
src/bin/lttng-sessiond/syscall.c
+++ b/
src/bin/lttng-sessiond/syscall.c
@@
-15,7
+15,7
@@
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _
GNU
_SOURCE
+#define _
LGPL
_SOURCE
#include <common/bitfield.h>
#include <common/common.h>
#include <common/kernel-ctl/kernel-ctl.h>
#include <common/bitfield.h>
#include <common/common.h>
#include <common/kernel-ctl/kernel-ctl.h>
@@
-35,7
+35,7
@@
static size_t syscall_table_nb_entry;
* Populate the system call table using the kernel tracer.
*
* Return 0 on success and the syscall table is allocated. On error, a negative
* Populate the system call table using the kernel tracer.
*
* Return 0 on success and the syscall table is allocated. On error, a negative
- * value is returned
and the syscall table is set to NULL
.
+ * value is returned.
*/
int syscall_init_table(void)
{
*/
int syscall_init_table(void)
{
@@
-72,7
+72,7
@@
int syscall_init_table(void)
}
while (fscanf(fp,
}
while (fscanf(fp,
- "syscall { index = %
l
u; \
+ "syscall { index = %
z
u; \
name = %" XSTR(SYSCALL_NAME_LEN) "[^;]; \
bitness = %u; };\n",
&index, name, &bitness) == 3) {
name = %" XSTR(SYSCALL_NAME_LEN) "[^;]; \
bitness = %u; };\n",
&index, name, &bitness) == 3) {
@@
-82,6
+82,14
@@
int syscall_init_table(void)
/* Double memory size. */
new_nbmem = max(index, nbmem << 1);
/* Double memory size. */
new_nbmem = max(index, nbmem << 1);
+ if (new_nbmem < nbmem) {
+ /* Overflow, stop everything, something went really wrong. */
+ ERR("Syscall listing memory size overflow. Stopping");
+ free(syscall_table);
+ syscall_table = NULL;
+ ret = -EINVAL;
+ goto error;
+ }
DBG("Reallocating syscall table from %zu to %zu entries", nbmem,
new_nbmem);
DBG("Reallocating syscall table from %zu to %zu entries", nbmem,
new_nbmem);
@@
-396,11
+404,15
@@
ssize_t syscall_list_channel(struct ltt_kernel_channel *kchan,
events = new_events;
}
events = new_events;
}
+ rcu_read_lock();
ksyscall = lookup_syscall(syscalls_ht, syscall_table[i].name);
if (ksyscall) {
update_event_syscall_bitness(events, i, ksyscall->index);
ksyscall = lookup_syscall(syscalls_ht, syscall_table[i].name);
if (ksyscall) {
update_event_syscall_bitness(events, i, ksyscall->index);
+ rcu_read_unlock();
continue;
}
continue;
}
+ ksyscall = NULL;
+ rcu_read_unlock();
ret = add_syscall_to_ht(syscalls_ht, i, count);
if (ret < 0) {
ret = add_syscall_to_ht(syscalls_ht, i, count);
if (ret < 0) {
@@
-411,7
+423,7
@@
ssize_t syscall_list_channel(struct ltt_kernel_channel *kchan,
strncpy(events[count].name, syscall_table[i].name,
sizeof(events[count].name));
events[count].enabled = 1;
strncpy(events[count].name, syscall_table[i].name,
sizeof(events[count].name));
events[count].enabled = 1;
- events[count].type = LTTNG_
KERNEL
_SYSCALL;
+ events[count].type = LTTNG_
EVENT
_SYSCALL;
count++;
}
count++;
}
@@
-420,7
+432,10
@@
ssize_t syscall_list_channel(struct ltt_kernel_channel *kchan,
return count;
error:
return count;
error:
+ rcu_read_lock();
destroy_syscall_ht(syscalls_ht);
destroy_syscall_ht(syscalls_ht);
+ rcu_read_unlock();
+
free(events);
return ret;
}
free(events);
return ret;
}
This page took
0.025589 seconds
and
4
git commands to generate.