Skip to content

Commit 7b919a5

Browse files
rantalaacmel
authored andcommitted
perf bench: Clear struct sigaction before sigaction() syscall
Avoid garbage in sigaction structs used in sigaction() syscalls. Valgrind is complaining about it. Signed-off-by: Tommi Rantala <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Changbin Du <[email protected]> Cc: Darren Hart <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent f649bd9 commit 7b919a5

File tree

7 files changed

+7
-0
lines changed

7 files changed

+7
-0
lines changed

tools/perf/bench/epoll-ctl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ int bench_epoll_ctl(int argc, const char **argv)
312312
exit(EXIT_FAILURE);
313313
}
314314

315+
memset(&act, 0, sizeof(act));
315316
sigfillset(&act.sa_mask);
316317
act.sa_sigaction = toggle_done;
317318
sigaction(SIGINT, &act, NULL);

tools/perf/bench/epoll-wait.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ int bench_epoll_wait(int argc, const char **argv)
426426
exit(EXIT_FAILURE);
427427
}
428428

429+
memset(&act, 0, sizeof(act));
429430
sigfillset(&act.sa_mask);
430431
act.sa_sigaction = toggle_done;
431432
sigaction(SIGINT, &act, NULL);

tools/perf/bench/futex-hash.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ int bench_futex_hash(int argc, const char **argv)
137137
if (!cpu)
138138
goto errmem;
139139

140+
memset(&act, 0, sizeof(act));
140141
sigfillset(&act.sa_mask);
141142
act.sa_sigaction = toggle_done;
142143
sigaction(SIGINT, &act, NULL);

tools/perf/bench/futex-lock-pi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ int bench_futex_lock_pi(int argc, const char **argv)
160160
if (!cpu)
161161
err(EXIT_FAILURE, "calloc");
162162

163+
memset(&act, 0, sizeof(act));
163164
sigfillset(&act.sa_mask);
164165
act.sa_sigaction = toggle_done;
165166
sigaction(SIGINT, &act, NULL);

tools/perf/bench/futex-requeue.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ int bench_futex_requeue(int argc, const char **argv)
128128
if (!cpu)
129129
err(EXIT_FAILURE, "cpu_map__new");
130130

131+
memset(&act, 0, sizeof(act));
131132
sigfillset(&act.sa_mask);
132133
act.sa_sigaction = toggle_done;
133134
sigaction(SIGINT, &act, NULL);

tools/perf/bench/futex-wake-parallel.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ int bench_futex_wake_parallel(int argc, const char **argv)
234234
exit(EXIT_FAILURE);
235235
}
236236

237+
memset(&act, 0, sizeof(act));
237238
sigfillset(&act.sa_mask);
238239
act.sa_sigaction = toggle_done;
239240
sigaction(SIGINT, &act, NULL);

tools/perf/bench/futex-wake.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ int bench_futex_wake(int argc, const char **argv)
136136
if (!cpu)
137137
err(EXIT_FAILURE, "calloc");
138138

139+
memset(&act, 0, sizeof(act));
139140
sigfillset(&act.sa_mask);
140141
act.sa_sigaction = toggle_done;
141142
sigaction(SIGINT, &act, NULL);

0 commit comments

Comments
 (0)