// SPDX-License-Identifier: GPL-2.0 /* * Inspired by breakpoint overflow test done by * Vince Weaver <vincent.weaver@maine.edu> for perf_event_tests * (git://github.com/deater/perf_event_tests)
*/
/* * Powerpc needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select * 'int-ll64.h' and avoid compile warnings when printing __u64 with %llu.
*/ #define __SANE_USERSPACE_TYPES__
if (overflows > 10) { /* * This should be executed only once during * this test, if we are here for the 10th * time, consider this the recursive issue. * * We can get out of here by disable events, * so no new SIGIO is delivered.
*/
ioctl(fd1, PERF_EVENT_IOC_DISABLE, 0);
ioctl(fd2, PERF_EVENT_IOC_DISABLE, 0);
ioctl(fd3, PERF_EVENT_IOC_DISABLE, 0);
}
}
staticint __event(bool is_x, void *addr, int sig)
{ struct perf_event_attr pe; int fd;
if (sigaction(SIGIO, &sa, NULL) < 0) {
pr_debug("failed setting up signal handler\n"); return TEST_FAIL;
}
sa.sa_sigaction = (void *) sig_handler_2; if (sigaction(SIGUSR1, &sa, NULL) < 0) {
pr_debug("failed setting up signal handler 2\n"); return TEST_FAIL;
}
/* * We create following events: * * fd1 - breakpoint event on __test_function with SIGIO * signal configured. We should get signal * notification each time the breakpoint is hit * * fd2 - breakpoint event on sig_handler with SIGUSR1 * configured. We should get SIGUSR1 each time when * breakpoint is hit * * fd3 - watchpoint event on __test_function with SIGIO * configured. * * Following processing should happen: * Exec: Action: Result: * incq (%rdi) - fd1 event breakpoint hit -> count1 == 1 * - SIGIO is delivered * sig_handler - fd2 event breakpoint hit -> count2 == 1 * - SIGUSR1 is delivered * sig_handler_2 -> overflows_2 == 1 (nested signal) * sys_rt_sigreturn - return from sig_handler_2 * overflows++ -> overflows = 1 * sys_rt_sigreturn - return from sig_handler * incq (%rdi) - fd3 event watchpoint hit -> count3 == 1 (wp and bp in one insn) * - SIGIO is delivered * sig_handler - fd2 event breakpoint hit -> count2 == 2 * - SIGUSR1 is delivered * sig_handler_2 -> overflows_2 == 2 (nested signal) * sys_rt_sigreturn - return from sig_handler_2 * overflows++ -> overflows = 2 * sys_rt_sigreturn - return from sig_handler * the_var++ - fd3 event watchpoint hit -> count3 == 2 (standalone watchpoint) * - SIGIO is delivered * sig_handler - fd2 event breakpoint hit -> count2 == 3 * - SIGUSR1 is delivered * sig_handler_2 -> overflows_2 == 3 (nested signal) * sys_rt_sigreturn - return from sig_handler_2 * overflows++ -> overflows == 3 * sys_rt_sigreturn - return from sig_handler * * The test case check following error conditions: * - we get stuck in signal handler because of debug * exception being triggered recursively due to * the wrong RF EFLAG management * * - we never trigger the sig_handler breakpoint due * to the wrong RF EFLAG management *
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.