Python signal.SIGILL Examples
The following are 29
code examples of signal.SIGILL().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
signal
, or try the search function
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: test_signal.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def test_issue9324(self): # Updated for issue #10003, adding SIGBREAK handler = lambda x, y: None checked = set() for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM): # Set and then reset a handler for signals that work on windows. # Issue #18396, only for signals without a C-level handler. if signal.getsignal(sig) is not None: signal.signal(sig, signal.signal(sig, handler)) checked.add(sig) # Issue #18396: Ensure the above loop at least tested *something* self.assertTrue(checked) with self.assertRaises(ValueError): signal.signal(-1, handler) with self.assertRaises(ValueError): signal.signal(7, handler)
Example #2
Source File: _signals_windows.py From py_daemoniker with The Unlicense | 6 votes |
def _default_handler(signum, *args): ''' The default signal handler. Don't register with built-in signal.signal! This needs to be used on the subprocess await death workaround. ''' # All valid cpython windows signals sigs = { signal.SIGABRT: SIGABRT, # signal.SIGFPE: 'fpe', # Don't catch this # signal.SIGSEGV: 'segv', # Don't catch this # signal.SIGILL: 'illegal', # Don't catch this signal.SIGINT: SIGINT, signal.SIGTERM: SIGTERM, # Note that signal.CTRL_C_EVENT and signal.CTRL_BREAK_EVENT are # converted to SIGINT in _await_signal } try: exc = sigs[signum] except KeyError: exc = DaemonikerSignal _sketch_raise_in_main(exc)
Example #3
Source File: test_signal.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_issue9324(self): # Updated for issue #10003, adding SIGBREAK handler = lambda x, y: None checked = set() for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM): # Set and then reset a handler for signals that work on windows. # Issue #18396, only for signals without a C-level handler. if signal.getsignal(sig) is not None: signal.signal(sig, signal.signal(sig, handler)) checked.add(sig) # Issue #18396: Ensure the above loop at least tested *something* self.assertTrue(checked) with self.assertRaises(ValueError): signal.signal(-1, handler) with self.assertRaises(ValueError): signal.signal(7, handler)
Example #4
Source File: test_signal.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_issue9324(self): # Updated for issue #10003, adding SIGBREAK handler = lambda x, y: None checked = set() for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM): # Set and then reset a handler for signals that work on windows. # Issue #18396, only for signals without a C-level handler. if signal.getsignal(sig) is not None: signal.signal(sig, signal.signal(sig, handler)) checked.add(sig) # Issue #18396: Ensure the above loop at least tested *something* self.assertTrue(checked) with self.assertRaises(ValueError): signal.signal(-1, handler) with self.assertRaises(ValueError): signal.signal(7, handler)
Example #5
Source File: multiprocess.py From Computable with MIT License | 6 votes |
def startProcess(self, iworker, testQueue, resultQueue, shouldStop, result): currentaddr = Value('c',bytes_('')) currentstart = Value('d',time.time()) keyboardCaught = Event() p = Process(target=runner, args=(iworker, testQueue, resultQueue, currentaddr, currentstart, keyboardCaught, shouldStop, self.loaderClass, result.__class__, pickle.dumps(self.config))) p.currentaddr = currentaddr p.currentstart = currentstart p.keyboardCaught = keyboardCaught old = signal.signal(signal.SIGILL, signalhandler) p.start() signal.signal(signal.SIGILL, old) return p
Example #6
Source File: multiprocess.py From locality-sensitive-hashing with MIT License | 6 votes |
def startProcess(self, iworker, testQueue, resultQueue, shouldStop, result): currentaddr = Value('c',bytes_('')) currentstart = Value('d',time.time()) keyboardCaught = Event() p = Process(target=runner, args=(iworker, testQueue, resultQueue, currentaddr, currentstart, keyboardCaught, shouldStop, self.loaderClass, result.__class__, pickle.dumps(self.config))) p.currentaddr = currentaddr p.currentstart = currentstart p.keyboardCaught = keyboardCaught old = signal.signal(signal.SIGILL, signalhandler) p.start() signal.signal(signal.SIGILL, old) return p
Example #7
Source File: test_signal.py From android_universal with MIT License | 6 votes |
def test_issue9324(self): # Updated for issue #10003, adding SIGBREAK handler = lambda x, y: None checked = set() for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM): # Set and then reset a handler for signals that work on windows. # Issue #18396, only for signals without a C-level handler. if signal.getsignal(sig) is not None: signal.signal(sig, signal.signal(sig, handler)) checked.add(sig) # Issue #18396: Ensure the above loop at least tested *something* self.assertTrue(checked) with self.assertRaises(ValueError): signal.signal(-1, handler) with self.assertRaises(ValueError): signal.signal(7, handler)
Example #8
Source File: test_faulthandler.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_sigill(self): self.check_fatal_error(""" import _testcapi import faulthandler import signal faulthandler.enable() _testcapi.raise_signal(signal.SIGILL) """, 6, 'Illegal instruction')
Example #9
Source File: test_faulthandler.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_read_null(self): self.check_fatal_error(""" import faulthandler faulthandler.enable() faulthandler._read_null() """, 3, # Issue #12700: Read NULL raises SIGILL on Mac OS X Lion '(?:Segmentation fault|Bus error|Illegal instruction)')
Example #10
Source File: custom_runner.py From pov_fuzzing with BSD 2-Clause "Simplified" License | 5 votes |
def _run_trace(self, stdout_file=None): """ accumulate a basic block trace using qemu """ timeout = 0.05 if len(self.binaries) > 1: timeout = 0.25 args = ["timeout", "-k", str(timeout), str(timeout)] args += [os.path.join(self.base_dir, "bin", "fakesingle")] if self.use_alt_flag: args += ["-s", self.SEED_ALT] else: args += ["-s", self.SEED] args += self.binaries with open('/dev/null', 'wb') as devnull: stdout_f = devnull if stdout_file is not None: stdout_f = open(stdout_file, 'wb') l.debug("tracing as raw input") p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=stdout_f, stderr=devnull) _, _ = p.communicate(self.payload) ret = p.wait() self.returncode = p.returncode # did a crash occur? if ret < 0 or ret == 139: if abs(ret) == signal.SIGSEGV or abs(ret) == signal.SIGILL or ret == 139: l.info("input caused a crash (signal %d) during dynamic tracing", abs(ret)) l.debug("entering crash mode") self.crash_mode = True if stdout_file is not None: stdout_f.close()
Example #11
Source File: afl.py From phuzzer with BSD 2-Clause "Simplified" License | 5 votes |
def crashes(self, signals=(signal.SIGSEGV, signal.SIGILL)): """ Retrieve the crashes discovered by AFL. Since we are now detecting flag page leaks (via SIGUSR1) we will not return these leaks as crashes. Instead, these 'crashes' can be found with the leaks function. :param signals: list of valid kill signal numbers to override the default (SIGSEGV and SIGILL) :return: a list of strings which are crashing inputs """ return self._get_crashing_inputs(signals)
Example #12
Source File: __init__.py From phuzzer with BSD 2-Clause "Simplified" License | 5 votes |
def crashes(self, signals=(signal.SIGSEGV, signal.SIGILL)): """ Retrieve the crashes discovered by AFL. Since we are now detecting flag page leaks (via SIGUSR1) we will not return these leaks as crashes. Instead, these 'crashes' can be found with the leaks function. :param signals: list of valid kill signal numbers to override the default (SIGSEGV and SIGILL) :return: a list of strings which are crashing inputs """ raise NotImplementedError()
Example #13
Source File: unicorefuzz.py From unicorefuzz with Apache License 2.0 | 5 votes |
def force_crash(self, uc_error: UcError) -> None: """ This function should be called to indicate to AFL that a crash occurred during emulation. Pass in the exception received from Uc.emu_start() :param uc_error: The unicorn Error """ mem_errors = [ UC_ERR_READ_UNMAPPED, UC_ERR_READ_PROT, UC_ERR_READ_UNALIGNED, UC_ERR_WRITE_UNMAPPED, UC_ERR_WRITE_PROT, UC_ERR_WRITE_UNALIGNED, UC_ERR_FETCH_UNMAPPED, UC_ERR_FETCH_PROT, UC_ERR_FETCH_UNALIGNED, ] if uc_error.errno in mem_errors: # Memory error - throw SIGSEGV os.kill(os.getpid(), signal.SIGSEGV) elif uc_error.errno == UC_ERR_INSN_INVALID: # Invalid instruction - throw SIGILL os.kill(os.getpid(), signal.SIGILL) else: # Not sure what happened - throw SIGABRT os.kill(os.getpid(), signal.SIGABRT)
Example #14
Source File: test_signal.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_issue9324(self): # Updated for issue #10003, adding SIGBREAK handler = lambda x, y: None for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM): # Set and then reset a handler for signals that work on windows signal.signal(sig, signal.signal(sig, handler)) with self.assertRaises(ValueError): signal.signal(-1, handler) with self.assertRaises(ValueError): signal.signal(7, handler)
Example #15
Source File: fuzzer.py From fuzzer with BSD 2-Clause "Simplified" License | 5 votes |
def crashes(self, signals=(signal.SIGSEGV, signal.SIGILL)): """ Retrieve the crashes discovered by AFL. Since we are now detecting flag page leaks (via SIGUSR1) we will not return these leaks as crashes. Instead, these 'crashes' can be found with the leaks function. :param signals: list of valid kill signal numbers to override the default (SIGSEGV and SIGILL) :return: a list of strings which are crashing inputs """ return self._get_crashing_inputs(signals)
Example #16
Source File: process.py From peach with Mozilla Public License 2.0 | 5 votes |
def GetMonitorData(self): time.sleep(self.lookout_time) sytem_crash_report = self.get_crash_report(self.system_report_path) bucket = {} if not len(self.crash_trace): if self.process.returncode < 0: crashSignals = [ # POSIX.1-1990 signals signal.SIGILL, signal.SIGABRT, signal.SIGFPE, signal.SIGSEGV, # SUSv2 / POSIX.1-2001 signals signal.SIGBUS, signal.SIGSYS, signal.SIGTRAP, ] for crashSignal in crashSignals: if process.returncode == -crashSignal: bucket["auxdat.txt"] = "Process exited with signal: %d" % -process.returncode else: bucket["auxdat.txt"] = "".join(self.crash_trace) if sytem_crash_report: bucket["system_crash_report.txt"] = sytem_crash_report if self.console_log: bucket["stdout.txt"] = "".join(self.console_log[-1000:]) if self.failure: meta = { "environ": os.environ.data, "command": self.arguments } bucket["meta.txt"] = json.dumps(dict(meta)) bucket["Bucket"] = os.path.basename(self.command) return bucket
Example #17
Source File: clientbase_cdm_dbg.py From codimension with GNU General Public License v3.0 | 5 votes |
def __interceptSignals(self): """Intercepts common signals""" for signum in [signal.SIGABRT, # abnormal termination signal.SIGFPE, # floating point exception signal.SIGILL, # illegal instruction signal.SIGSEGV]: # segmentation violation signal.signal(signum, self.__signalHandler)
Example #18
Source File: test_signal.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_module_constants(self): self.assertEqual(signal.NSIG, 23) self.assertEqual(signal.SIGABRT, 22) self.assertEqual(signal.SIGBREAK, 21) self.assertEqual(signal.SIGFPE, 8) self.assertEqual(signal.SIGILL, 4) self.assertEqual(signal.SIGINT, 2) self.assertEqual(signal.SIGSEGV, 11) self.assertEqual(signal.SIGTERM, 15) self.assertEqual(signal.SIG_DFL, 0) self.assertEqual(signal.SIG_IGN, 1)
Example #19
Source File: test_faulthandler.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_sigill(self): self.check_fatal_error(""" import _testcapi import faulthandler import signal faulthandler.enable() _testcapi.raise_signal(signal.SIGILL) """, 6, 'Illegal instruction')
Example #20
Source File: test_faulthandler.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_read_null(self): self.check_fatal_error(""" import faulthandler faulthandler.enable() faulthandler._read_null() """, 3, # Issue #12700: Read NULL raises SIGILL on Mac OS X Lion '(?:Segmentation fault|Bus error|Illegal instruction)')
Example #21
Source File: cli.py From SlowLoris with MIT License | 5 votes |
def init(): # exit handlers for sig in (SIGABRT, SIGILL, SIGINT, SIGSEGV, SIGTERM): signal(sig, cleanup)
Example #22
Source File: test_signal.py From oss-ftp with MIT License | 5 votes |
def test_issue9324(self): # Updated for issue #10003, adding SIGBREAK handler = lambda x, y: None for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM): # Set and then reset a handler for signals that work on windows signal.signal(sig, signal.signal(sig, handler)) with self.assertRaises(ValueError): signal.signal(-1, handler) with self.assertRaises(ValueError): signal.signal(7, handler)
Example #23
Source File: test_signal.py From BinderFilter with MIT License | 5 votes |
def test_issue9324(self): # Updated for issue #10003, adding SIGBREAK handler = lambda x, y: None for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM): # Set and then reset a handler for signals that work on windows signal.signal(sig, signal.signal(sig, handler)) with self.assertRaises(ValueError): signal.signal(-1, handler) with self.assertRaises(ValueError): signal.signal(7, handler)
Example #24
Source File: autograder.py From autograder with GNU General Public License v3.0 | 5 votes |
def signal_to_string(self, signalNumber): if signalNumber < 0: signalNumber = signalNumber * -1 if signalNumber == signal.SIGINT: return "SIGINT - Interrupt (Ctrl+C)" elif signalNumber == signal.SIGKILL: return "SIGKILL - Killed" elif signalNumber == signal.SIGTERM: return "SIGTERM - Terminated" elif signalNumber == signal.SIGSEGV: return "SIGSEGV - Segmentation fault" elif signalNumber == signal.SIGHUP: return "SIGHUP - Hang up" elif signalNumber == signal.SIGBUS: return "SIGBUS - Bus error" elif signalNumber == signal.SIGILL: return "SIGILL - Illegal instruction" elif signalNumber == signal.SIGFPE: return "SIGFPE - Floating point exception" elif signalNumber == signal.SIGPIPE: return "SIGPIPE - Broken pipe (write to pipe with no readers)" elif signalNumber == signal.SIGABRT: return "SIGABRT - Called abort()" elif signalNumber == signal.SIGXFSZ: return "SIGXFSZ - Process created files that were too big." elif signalNumber == signal.SIGXCPU: return "SIGXCPU - Process used too much CPU time." else: return "Unknown signal #" + str(signalNumber)
Example #25
Source File: test_signal.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_module_constants(self): self.assertEqual(signal.NSIG, 23) self.assertEqual(signal.SIGABRT, 22) self.assertEqual(signal.SIGBREAK, 21) self.assertEqual(signal.SIGFPE, 8) self.assertEqual(signal.SIGILL, 4) self.assertEqual(signal.SIGINT, 2) self.assertEqual(signal.SIGSEGV, 11) self.assertEqual(signal.SIGTERM, 15) self.assertEqual(signal.SIG_DFL, 0) self.assertEqual(signal.SIG_IGN, 1)
Example #26
Source File: test_signal.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_issue9324(self): # Updated for issue #10003, adding SIGBREAK handler = lambda x, y: None for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM): # Set and then reset a handler for signals that work on windows signal.signal(sig, signal.signal(sig, handler)) with self.assertRaises(ValueError): signal.signal(-1, handler) with self.assertRaises(ValueError): signal.signal(7, handler)
Example #27
Source File: clientbase_cdm_dbg.py From codimension with GNU General Public License v3.0 | 5 votes |
def __signalHandler(self, signalNumber, stackFrame): """Handles signals""" if signalNumber == signal.SIGABRT: message = "Abnormal Termination" elif signalNumber == signal.SIGFPE: message = "Floating Point Exception" elif signalNumber == signal.SIGILL: message = "Illegal Instruction" elif signalNumber == signal.SIGSEGV: message = "Segmentation Violation" else: message = "Unknown Signal '{0}'".format(signalNumber) filename = self.absPath(stackFrame.f_code.co_filename) linenr = stackFrame.f_lineno ffunc = stackFrame.f_code.co_name if ffunc == '?': ffunc = '' if ffunc and not ffunc.startswith('<'): argInfo = getArgValues(stackFrame) try: fargs = formatArgValues( argInfo.args, argInfo.varargs, argInfo.keywords, argInfo.locals) except Exception: fargs = '' else: fargs = '' sendJSONCommand(self.socket, METHOD_SIGNAL, self.procuuid, {'message': message, 'filename': filename, 'linenumber': linenr, 'function': ffunc, 'arguments': fargs})
Example #28
Source File: process.py From peach with Mozilla Public License 2.0 | 4 votes |
def _StartProcess(self): MonitorDebug(self._name, "_StartProcess") self.failure = False self.sanlog = [] self.stderr = [] self.stdout = [] print("Command: {}".format(self.arguments)) self.process = Popen(self.arguments, stderr=PIPE, stdout=PIPE, env=os.environ, bufsize=1, close_fds=isPosix()) # Todo: Add timeout= for GUI applications. stdout, stderr = self.process.communicate() if stderr.find("ERROR: AddressSanitizer: ") != -1: if stderr.find("AddressSanitizer failed to allocate") == -1: self.failure = True self.sanlog = re.findall(self.asan_regex, stderr, re.DOTALL)[0] self.stdout = stdout self.stderr = stderr else: if self.process.returncode < 0: crashSignals = [ # POSIX.1-1990 signals signal.SIGILL, signal.SIGABRT, signal.SIGFPE, signal.SIGSEGV, # SUSv2 / POSIX.1-2001 signals signal.SIGBUS, signal.SIGSYS, signal.SIGTRAP, ] for crashSignal in crashSignals: if process.returncode == -crashSignal: self.failure = True self.sanlog = "Process exited with signal: %d" % -process.returncode self.stdout = stdout self.stderr = stderr if self.failure: self._StopProcess()
Example #29
Source File: rpc_daemon.py From MCVirt with GNU General Public License v2.0 | 4 votes |
def __init__(self): """Store required object member variables and create MCVirt object.""" # Before doing ANYTHING, ensure that the hostname that MCVirt thinks the # machine is (i.e. the hostname that the machine was already setup as) # matches the current hostname of the machine ensure_hostname_consistent() # Initialise Pyro4 with flag to showing that the daemon is being started Pyro4.current_context.STARTUP_PERIOD = True # Store nameserver, MCVirt instance and create daemon self.daemon_lock = DaemonLock() self.timer_objects = [] Pyro4.config.USE_MSG_WAITALL = False Pyro4.config.CREATE_SOCKET_METHOD = SSLSocket.create_ssl_socket Pyro4.config.CREATE_BROADCAST_SOCKET_METHOD = SSLSocket.create_broadcast_ssl_socket Pyro4.config.THREADPOOL_ALLOW_QUEUE = True Pyro4.config.THREADPOOL_SIZE = 128 self.hostname = get_hostname() # Ensure that the required SSL certificates exist ssl_socket = CertificateGeneratorFactory().get_cert_generator('localhost') ssl_socket.check_certificates(check_client=False) ssl_socket = None # Wait for nameserver Syslogger.logger().debug('Wait for connection to nameserver') self.obtain_connection() Syslogger.logger().debug('Obtained nameserver connection') RpcNSMixinDaemon.DAEMON = BaseRpcDaemon(host=self.hostname) self.register_factories() # Ensure libvirt is configured Syslogger.logger().debug('Start certificate check') cert_gen_factory = RpcNSMixinDaemon.DAEMON.registered_factories[ 'certificate_generator_factory'] cert_gen = cert_gen_factory.get_cert_generator('localhost') cert_gen.check_certificates() cert_gen = None cert_gen_factory = None Syslogger.logger().debug('Register atexit') atexit.register(self.shutdown, 'atexit', '') for sig in (signal.SIGABRT, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM): signal.signal(sig, self.shutdown) Syslogger.logger().debug('Initialising modules') for registered_object, obj in RpcNSMixinDaemon.DAEMON.registered_factories_lst: if type(obj) is not types.TypeType: # noqa Syslogger.logger().debug('Initialising module %s' % registered_object) try: obj.initialise() except Exception, exc: Syslogger.logger().error( 'Failed to initailise module: %s\n:%s' % (registered_object, str(exc)))