Using hardware performance counters for detecting control hijacking attacks