_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q253700 | X86Cpu.PSRLQ | validation | def PSRLQ(cpu, dest, src):
"""Shift Packed Data Right Logical
Shifts the bits in the individual quadword in the destination operand to the right by
the number of bits specified in the count operand . As the bits in the data elements
are shifted right, the empty high-order bits are clear... | python | {
"resource": ""
} |
q253701 | StateBase.constrain | validation | def constrain(self, constraint):
"""Constrain state.
:param manticore.core.smtlib.Bool constraint: Constraint to add
"""
| python | {
"resource": ""
} |
q253702 | StateBase.new_symbolic_buffer | validation | def new_symbolic_buffer(self, nbytes, **options):
"""Create and return a symbolic buffer of length `nbytes`. The buffer is
not written into State's memory; write it to the state's memory to
introduce it into the program state.
:param int nbytes: Length of the new buffer
:param s... | python | {
"resource": ""
} |
q253703 | StateBase.new_symbolic_value | validation | def new_symbolic_value(self, nbits, label=None, taint=frozenset()):
"""Create and return a symbolic value that is `nbits` bits wide. Assign
the value to a register or write it into the address space to introduce
it into the program state.
:param int nbits: The bitwidth of the value retu... | python | {
"resource": ""
} |
q253704 | StateBase.concretize | validation | def concretize(self, symbolic, policy, maxcount=7):
""" This finds a set of solutions for symbolic using policy.
This raises TooManySolutions if more solutions than maxcount
"""
assert self.constraints == self.platform.constraints
symbolic = self.migrate_expression(symbolic)
... | python | {
"resource": ""
} |
q253705 | StateBase.solve_buffer | validation | def solve_buffer(self, addr, nbytes, constrain=False):
"""
Reads `nbytes` of symbolic data from a buffer in memory at `addr` and attempts to
concretize it
:param int address: Address of buffer to concretize
:param int nbytes: Size of buffer to concretize
:param bool cons... | python | {
"resource": ""
} |
q253706 | UnicornEmulator._hook_xfer_mem | validation | def _hook_xfer_mem(self, uc, access, address, size, value, data):
"""
Handle memory operations from unicorn.
"""
assert access in (UC_MEM_WRITE, UC_MEM_READ, UC_MEM_FETCH)
if access == UC_MEM_WRITE:
self._cpu.write_int(address, value, size * 8)
# If client c... | python | {
"resource": ""
} |
q253707 | UnicornEmulator.emulate | validation | def emulate(self, instruction):
"""
Emulate a single instruction.
"""
# The emulation might restart if Unicorn needs to bring in a memory map
# or bring a value from Manticore state.
while True:
self.reset()
# Establish Manticore state, potentia... | python | {
"resource": ""
} |
q253708 | Solver.must_be_true | validation | def must_be_true(self, constraints, expression) -> bool:
"""Check if expression is True and that it can not | python | {
"resource": ""
} |
q253709 | Solver.min | validation | def min(self, constraints, X: BitVec, M=10000):
"""
Iteratively finds the minimum value for a symbol within given constraints.
:param constraints: constraints that | python | {
"resource": ""
} |
q253710 | Solver.minmax | validation | def minmax(self, constraints, x, iters=10000):
"""Returns the min and max possible values for x within given constraints"""
if issymbolic(x):
m = self.min(constraints, x, iters)
| python | {
"resource": ""
} |
q253711 | Z3Solver._solver_version | validation | def _solver_version(self) -> Version:
"""
If we fail to parse the version, we assume z3's output has changed, meaning it's a newer
version than what's used now, and therefore ok.
Anticipated version_cmd_output format: 'Z3 version 4.4.2'
'Z3... | python | {
"resource": ""
} |
q253712 | Z3Solver._start_proc | validation | def _start_proc(self):
"""Spawns z3 solver process"""
assert '_proc' not in dir(self) or self._proc is None
try:
self._proc = Popen(shlex.split(self._command), stdin=PIPE, stdout=PIPE, bufsize=0, universal_newlines=True)
except OSError as e:
print(e, "Probably too... | python | {
"resource": ""
} |
q253713 | Z3Solver._reset | validation | def _reset(self, constraints=None):
"""Auxiliary method to reset the smtlib external solver to initial defaults"""
if self._proc is None:
self._start_proc()
else:
if self.support_reset:
self._send("(reset)")
for cfg in self._init:
... | python | {
"resource": ""
} |
q253714 | Z3Solver._send | validation | def _send(self, cmd: str):
"""
Send a string to the solver.
:param cmd: a SMTLIBv2 command (ex. (check-sat))
"""
logger.debug('>%s', cmd)
try:
| python | {
"resource": ""
} |
q253715 | Z3Solver._recv | validation | def _recv(self) -> str:
"""Reads the response from the solver"""
buf, left, right = self.__readline_and_count()
bufl = [buf]
while left != right:
buf, l, r = self.__readline_and_count()
bufl.append(buf)
left += l
| python | {
"resource": ""
} |
q253716 | Z3Solver._is_sat | validation | def _is_sat(self) -> bool:
"""
Check the satisfiability of the current state
:return: whether current state is satisfiable or not.
"""
logger.debug("Solver.check() ")
start = time.time()
self._send('(check-sat)')
status = self._recv()
logger.debug... | python | {
"resource": ""
} |
q253717 | Z3Solver._assert | validation | def _assert(self, expression: Bool):
"""Auxiliary method to send an assert"""
assert isinstance(expression, Bool)
smtlib = | python | {
"resource": ""
} |
q253718 | Z3Solver._getvalue | validation | def _getvalue(self, expression):
"""
Ask the solver for one possible assignment for given expression using current set of constraints.
The current set of expressions must be sat.
NOTE: This is an internal method: it uses the current solver state (set of constraints!).
"""
... | python | {
"resource": ""
} |
q253719 | Z3Solver.can_be_true | validation | def can_be_true(self, constraints, expression):
"""Check if two potentially symbolic values can be equal"""
if isinstance(expression, bool):
if not expression:
return expression
else:
| python | {
"resource": ""
} |
q253720 | Z3Solver.get_all_values | validation | def get_all_values(self, constraints, expression, maxcnt=None, silent=False):
"""Returns a list with all the possible values for the symbol x"""
if not isinstance(expression, Expression):
return [expression]
assert isinstance(constraints, ConstraintSet)
assert isinstance(expr... | python | {
"resource": ""
} |
q253721 | Z3Solver.get_value | validation | def get_value(self, constraints, expression):
"""
Ask the solver for one possible result of given expression using given set of constraints.
"""
if not issymbolic(expression):
return expression
assert isinstance(expression, (Bool, BitVec, Array))
with constrai... | python | {
"resource": ""
} |
q253722 | ContextFilter.summarized_name | validation | def summarized_name(self, name):
"""
Produce a summarized record name
i.e. manticore.core.executor -> m.c.executor
"""
| python | {
"resource": ""
} |
q253723 | ContextFilter.colored_level_name | validation | def colored_level_name(self, levelname):
"""
Colors the logging level in the logging record
"""
if self.colors_disabled:
return self.plain_levelname_format.format(levelname)
| python | {
"resource": ""
} |
q253724 | _find_zero | validation | def _find_zero(cpu, constrs, ptr):
"""
Helper for finding the closest NULL or, effectively NULL byte from a starting address.
:param Cpu cpu:
:param ConstraintSet constrs: Constraints for current `State`
:param int ptr: Address to start searching for a zero from | python | {
"resource": ""
} |
q253725 | strcmp | validation | def strcmp(state, s1, s2):
"""
strcmp symbolic model.
Algorithm: Walks from end of string (minimum offset to NULL in either string)
to beginning building tree of ITEs each time either of the
bytes at current offset is symbolic.
Points of Interest:
- We've been building up a symbolic tree b... | python | {
"resource": ""
} |
q253726 | strlen | validation | def strlen(state, s):
"""
strlen symbolic model.
Algorithm: Walks from end of string not including NULL building ITE tree when current byte is symbolic.
:param State state: current program state
:param int s: Address of string
:return: Symbolic strlen result
:rtype: Expression or int
"... | python | {
"resource": ""
} |
q253727 | Eventful.all_events | validation | def all_events(cls):
"""
Return all events that all subclasses have so far registered to publish.
| python | {
"resource": ""
} |
q253728 | Eventful.forward_events_to | validation | def forward_events_to(self, sink, include_source=False):
"""This forwards signal to sink"""
assert | python | {
"resource": ""
} |
q253729 | ManticoreBase.get_profiling_stats | validation | def get_profiling_stats(self):
"""
Returns a pstat.Stats instance with profiling results if `run` was called with `should_profile=True`.
Otherwise, returns `None`.
"""
profile_file_path = os.path.join(self.workspace, 'profiling.bin')
try:
| python | {
"resource": ""
} |
q253730 | ManticoreBase.run | validation | def run(self, procs=1, timeout=None, should_profile=False):
"""
Runs analysis.
:param int procs: Number of parallel worker processes
:param timeout: Analysis timeout, in seconds
"""
assert not self.running, "Manticore is already running."
self._start_run()
... | python | {
"resource": ""
} |
q253731 | GetNBits | validation | def GetNBits(value, nbits):
"""
Get the first `nbits` from `value`.
:param value: Source value from which to extract
:type value: int or long or BitVec
:param int nbits: How many bits to extract
:return: Low `nbits` bits of `value`.
:rtype int or long or BitVec
"""
# NOP if sizes ar... | python | {
"resource": ""
} |
q253732 | SInt | validation | def SInt(value, width):
"""
Convert a bitstring `value` of `width` bits to a signed integer
representation.
:param value: The value to convert.
:type value: int or long or BitVec
:param int width: The width of the bitstring to consider
:return: The converted value
:rtype int or long or ... | python | {
"resource": ""
} |
q253733 | Policy.locked_context | validation | def locked_context(self, key=None, default=dict):
""" Policy shared context dictionary """
keys = ['policy']
| python | {
"resource": ""
} |
q253734 | Executor.enqueue | validation | def enqueue(self, state):
"""
Enqueue state.
Save state on storage, assigns an id to it, then add it to the
priority queue
| python | {
"resource": ""
} |
q253735 | Executor.put | validation | def put(self, state_id):
""" Enqueue it for processing """
| python | {
"resource": ""
} |
q253736 | Executor.get | validation | def get(self):
""" Dequeue a state with the max priority """
# A shutdown has been requested
if self.is_shutdown():
return None
# if not more states in the queue, let's wait for some forks
while len(self._states) == 0:
# if no worker is running, bail out... | python | {
"resource": ""
} |
q253737 | Executor.fork | validation | def fork(self, state, expression, policy='ALL', setstate=None):
"""
Fork state on expression concretizations.
Using policy build a list of solutions for expression.
For the state on each solution setting the new state with setstate
For example if expression is a Bool it may have... | python | {
"resource": ""
} |
q253738 | Executor.run | validation | def run(self):
"""
Entry point of the Executor; called by workers to start analysis.
"""
# policy_order=self.policy_order
# policy=self.policy
current_state = None
current_state_id = None
with WithKeyboardInterruptAs(self.shutdown):
# notify s... | python | {
"resource": ""
} |
q253739 | Manticore.linux | validation | def linux(cls, path, argv=None, envp=None, entry_symbol=None, symbolic_files=None, concrete_start='', pure_symbolic=False, stdin_size=None, **kwargs):
"""
Constructor for Linux binary analysis.
:param str path: Path to binary to analyze
:param argv: Arguments to provide to the binary
... | python | {
"resource": ""
} |
q253740 | Manticore.decree | validation | def decree(cls, path, concrete_start='', **kwargs):
"""
Constructor for Decree binary analysis.
:param str path: Path to binary to analyze
:param str concrete_start: Concrete stdin to use before symbolic input
:param kwargs: Forwarded to the | python | {
"resource": ""
} |
q253741 | Manticore._hook_callback | validation | def _hook_callback(self, state, pc, instruction):
'Invoke all registered generic hooks'
# Ignore symbolic pc.
# TODO(yan): Should we ask the solver if any of the hooks are possible,
| python | {
"resource": ""
} |
q253742 | Manticore.resolve | validation | def resolve(self, symbol):
"""
A helper method used to resolve a symbol name into a memory address when
injecting hooks for analysis.
:param symbol: function name to be resolved
:type symbol: string
:param line: if more functions present, optional line number can be inc... | python | {
"resource": ""
} |
q253743 | binary_arch | validation | def binary_arch(binary):
"""
helper method for determining binary architecture
:param binary: str for binary to introspect.
:rtype bool: True | python | {
"resource": ""
} |
q253744 | binary_symbols | validation | def binary_symbols(binary):
"""
helper method for getting all binary symbols with SANDSHREW_ prepended.
We do this in order to provide the symbols Manticore should hook on to
perform main analysis.
:param binary: str for binary to instrospect.
:rtype list: list of symbols from binary
"""
... | python | {
"resource": ""
} |
q253745 | get_group | validation | def get_group(name: str) -> _Group:
"""
Get a configuration variable group named |name|
"""
global _groups
if name in _groups:
| python | {
"resource": ""
} |
q253746 | save | validation | def save(f):
"""
Save current config state to an yml file stream identified by |f|
:param f: where to write the config file
"""
global _groups
c = {}
for group_name, group in _groups.items():
| python | {
"resource": ""
} |
q253747 | parse_config | validation | def parse_config(f):
"""
Load an yml-formatted configuration from file stream |f|
:param file f: Where to read the config.
"""
try:
c = yaml.safe_load(f)
for section_name, section in c.items():
group = get_group(section_name)
| python | {
"resource": ""
} |
q253748 | load_overrides | validation | def load_overrides(path=None):
"""
Load config overrides from the yml file at |path|, or from default paths. If a path
is provided and it does not exist, raise an exception
Default paths: ./mcore.yml, ./.mcore.yml, ./manticore.yml, ./.manticore.yml.
"""
if path is not None:
names = [pa... | python | {
"resource": ""
} |
q253749 | process_config_values | validation | def process_config_values(parser: argparse.ArgumentParser, args: argparse.Namespace):
"""
Bring in provided config values to the args parser, and import entries to the config
from all arguments that were actually passed on the command line
:param parser: The arg parser
:param args: The value that p... | python | {
"resource": ""
} |
q253750 | _Group.add | validation | def add(self, name: str, default=None, description: str=None):
"""
Add a variable named |name| to this value group, optionally giving it a
default value and a description.
Variables must be added with this method before they can be set or read.
Reading a variable replaces the va... | python | {
"resource": ""
} |
q253751 | _Group.update | validation | def update(self, name: str, value=None, default=None, description: str=None):
"""
Like add, but can tolerate existing values; also updates the value.
Mostly used for setting fields from imported INI files and modified CLI flags.
"""
| python | {
"resource": ""
} |
q253752 | _Group.get_description | validation | def get_description(self, name: str) -> str:
"""
Return the description, or a help string of variable identified by |name|.
"""
if name not in self._vars:
| python | {
"resource": ""
} |
q253753 | SolidityMetadata.function_signature_for_name_and_inputs | validation | def function_signature_for_name_and_inputs(name: str, inputs: Sequence[Mapping[str, Any]]) -> str:
"""Returns the function signature for the specified name and Solidity JSON metadata inputs array.
The ABI specification defines the function signature as the function name followed by the parenthesised li... | python | {
"resource": ""
} |
q253754 | SolidityMetadata.get_constructor_arguments | validation | def get_constructor_arguments(self) -> str:
"""Returns the tuple type signature for the arguments of the contract constructor."""
item = self._constructor_abi_item
| python | {
"resource": ""
} |
q253755 | SolidityMetadata.get_source_for | validation | def get_source_for(self, asm_offset, runtime=True):
""" Solidity source code snippet related to `asm_pos` evm bytecode offset.
If runtime is False, initialization bytecode source map is used
"""
srcmap = self.get_srcmap(runtime)
try:
beg, size, _, _ = srcmap[asm_... | python | {
"resource": ""
} |
q253756 | SolidityMetadata.constructor_abi | validation | def constructor_abi(self) -> Dict[str, Any]:
"""Returns a copy of the Solidity JSON ABI item for the contract constructor.
The content of the returned dict is described at https://solidity.readthedocs.io/en/latest/abi-spec.html#json_ | python | {
"resource": ""
} |
q253757 | SolidityMetadata.get_abi | validation | def get_abi(self, hsh: bytes) -> Dict[str, Any]:
"""Returns a copy of the Solidity JSON ABI item for the function associated with the selector ``hsh``.
If no normal contract function has the specified selector, a dict describing the default or non-default
fallback function is returned.
... | python | {
"resource": ""
} |
q253758 | SolidityMetadata.get_func_argument_types | validation | def get_func_argument_types(self, hsh: bytes):
"""Returns the tuple type signature for the arguments of the function associated with the selector ``hsh``.
If no normal contract function has the specified selector,
the empty tuple type signature ``'()'`` is returned.
"""
if not i... | python | {
"resource": ""
} |
q253759 | SolidityMetadata.get_func_return_types | validation | def get_func_return_types(self, hsh: bytes) -> str:
"""Returns the tuple type signature for the output values of the function
associated with the selector ``hsh``.
If no normal contract function has the specified selector,
the empty tuple type signature ``'()'`` is returned.
"""... | python | {
"resource": ""
} |
q253760 | SolidityMetadata.get_func_signature | validation | def get_func_signature(self, hsh: bytes) -> Optional[str]:
"""Returns the signature of the normal function with the selector ``hsh``,
or ``None`` if no such function exists.
This function returns | python | {
"resource": ""
} |
q253761 | ConcreteUnicornEmulator.map_memory_callback | validation | def map_memory_callback(self, address, size, perms, name, offset, result):
"""
Catches did_map_memory and copies the mapping into Manticore
"""
logger.info(' '.join(("Mapping Memory @",
hex(address) if type(address) is int else "0x??",
... | python | {
"resource": ""
} |
q253762 | ConcreteUnicornEmulator.unmap_memory_callback | validation | def unmap_memory_callback(self, start, size):
"""Unmap Unicorn maps when Manticore unmaps them"""
logger.info(f"Unmapping memory from {hex(start)} to {hex(start + size)}")
mask = (1 << 12) - 1
if (start & mask) != 0:
logger.error("Memory to be unmapped is not | python | {
"resource": ""
} |
q253763 | ConcreteUnicornEmulator.protect_memory_callback | validation | def protect_memory_callback(self, start, size, perms):
""" Set memory protections in Unicorn correctly """ | python | {
"resource": ""
} |
q253764 | ConcreteUnicornEmulator._hook_syscall | validation | def _hook_syscall(self, uc, data):
"""
Unicorn hook that transfers control to Manticore so it can execute the syscall
"""
logger.debug(f"Stopping emulation at {hex(uc.reg_read(self._to_unicorn_id('RIP')))} to perform syscall")
| python | {
"resource": ""
} |
q253765 | ConcreteUnicornEmulator._hook_write_mem | validation | def _hook_write_mem(self, uc, access, address, size, value, data):
"""
Captures memory written by Unicorn
| python | {
"resource": ""
} |
q253766 | ConcreteUnicornEmulator.emulate | validation | def emulate(self, instruction):
"""
Wrapper that runs the _step function in a loop while handling exceptions
"""
# The emulation might restart if Unicorn needs to bring in a memory map
# or bring a value from Manticore state.
while True:
| python | {
"resource": ""
} |
q253767 | ConcreteUnicornEmulator.sync_unicorn_to_manticore | validation | def sync_unicorn_to_manticore(self):
"""
Copy registers and written memory back into Manticore
"""
self.write_backs_disabled = True
for reg in self.registers:
val = self._emu.reg_read(self._to_unicorn_id(reg))
self._cpu.write_register(reg, val)
if ... | python | {
"resource": ""
} |
q253768 | ConcreteUnicornEmulator.write_back_memory | validation | def write_back_memory(self, where, expr, size):
""" Copy memory writes from Manticore back into Unicorn in real-time """
if self.write_backs_disabled:
return
if type(expr) is bytes:
self._emu.mem_write(where, expr)
else:
if issymbolic(expr):
... | python | {
"resource": ""
} |
q253769 | ConcreteUnicornEmulator.write_back_register | validation | def write_back_register(self, reg, val):
""" Sync register state from Manticore -> Unicorn"""
if self.write_backs_disabled:
return
if issymbolic(val):
logger.warning("Skipping Symbolic write-back")
return
if reg in self.flag_registers:
| python | {
"resource": ""
} |
q253770 | ConcreteUnicornEmulator.update_segment | validation | def update_segment(self, selector, base, size, perms):
""" Only useful for setting FS right now. """
logger.info("Updating selector %s to 0x%02x (%s bytes) (%s)", selector, base, size, perms)
| python | {
"resource": ""
} |
q253771 | deprecated | validation | def deprecated(message: str):
"""A decorator for marking functions as deprecated. """
assert isinstance(message, str), "The deprecated decorator requires a message string argument."
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
warnings.warn(f"`{func.__qualname... | python | {
"resource": ""
} |
q253772 | perm | validation | def perm(lst, func):
''' Produce permutations of `lst`, where permutations are mutated by `func`. Used for flipping constraints. highly
possible that returned constraints can be unsat this does it blindly, without any attention to the constraints
themselves
Considering lst as a list of constraints, e.g... | python | {
"resource": ""
} |
q253773 | input_from_cons | validation | def input_from_cons(constupl, datas):
' solve bytes in |datas| based on '
def make_chr(c):
try:
return chr(c)
except Exception:
| python | {
"resource": ""
} |
q253774 | symbolic_run_get_cons | validation | def symbolic_run_get_cons(trace):
'''
Execute a symbolic run that follows a concrete run; return constraints generated
and the stdin data produced
'''
m2 = Manticore.linux(prog, workspace_url='mem:')
f = Follower(trace)
m2.verbosity(VERBOSITY)
m2.register_plugin(f)
def on_term_test... | python | {
"resource": ""
} |
q253775 | Linux.empty_platform | validation | def empty_platform(cls, arch):
"""
Create a platform without an ELF loaded.
:param str arch: The architecture of the | python | {
"resource": ""
} |
q253776 | Linux._execve | validation | def _execve(self, program, argv, envp):
"""
Load `program` and establish program state, such as stack and arguments.
:param program str: The ELF binary to load
:param argv list: argv array
:param envp list: envp array
"""
argv = [] if argv is None else argv
... | python | {
"resource": ""
} |
q253777 | Linux._init_arm_kernel_helpers | validation | def _init_arm_kernel_helpers(self):
"""
ARM kernel helpers
https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt
"""
page_data = bytearray(b'\xf1\xde\xfd\xe7' * 1024)
# Extracted from a RPi2
preamble = binascii.unhexlify(
'ff0300ea' +... | python | {
"resource": ""
} |
q253778 | Linux._open | validation | def _open(self, f):
"""
Adds a file descriptor to the current file descriptor list
:rtype: int
:param f: the file descriptor to add.
:return: the index of the file descriptor in the file descr. list
"""
if None in self.files:
| python | {
"resource": ""
} |
q253779 | Linux.sys_openat | validation | def sys_openat(self, dirfd, buf, flags, mode):
"""
Openat SystemCall - Similar to open system call except dirfd argument
when path contained in buf is relative, dirfd is referred to set the relative path
Special value AT_FDCWD set for dirfd to set path relative to current directory
... | python | {
"resource": ""
} |
q253780 | Linux.sys_rename | validation | def sys_rename(self, oldnamep, newnamep):
"""
Rename filename `oldnamep` to `newnamep`.
:param int oldnamep: pointer to oldname
:param int newnamep: pointer to newname
"""
oldname = self.current.read_string(oldnamep)
newname = self.current.read_string(newnamep)
... | python | {
"resource": ""
} |
q253781 | Linux.sys_fsync | validation | def sys_fsync(self, fd):
"""
Synchronize a file's in-core state with that on disk.
"""
ret = 0
try:
self.files[fd].sync()
except IndexError:
| python | {
"resource": ""
} |
q253782 | Linux.sys_rt_sigaction | validation | def sys_rt_sigaction(self, signum, act, oldact):
"""Wrapper for sys_sigaction"""
| python | {
"resource": ""
} |
q253783 | Linux.sys_rt_sigprocmask | validation | def sys_rt_sigprocmask(self, cpu, how, newset, oldset):
"""Wrapper for sys_sigprocmask"""
| python | {
"resource": ""
} |
q253784 | Linux.sys_chroot | validation | def sys_chroot(self, path):
"""
An implementation of chroot that does perform some basic error checking,
but does not actually chroot.
:param path: Path to chroot
"""
if path not in self.current.memory:
return -errno.EFAULT
| python | {
"resource": ""
} |
q253785 | Linux.sys_mmap_pgoff | validation | def sys_mmap_pgoff(self, address, size, prot, flags, fd, offset):
"""Wrapper for mmap2"""
| python | {
"resource": ""
} |
q253786 | Linux.syscall | validation | def syscall(self):
"""
Syscall dispatcher.
"""
index = self._syscall_abi.syscall_number()
try:
table = getattr(linux_syscalls, self.current.machine)
name = table.get(index, None)
implementation = getattr(self, name)
except (AttributeE... | python | {
"resource": ""
} |
q253787 | Linux.sched | validation | def sched(self):
""" Yield CPU.
This will choose another process from the running list and change
current running process. May give the same cpu if only one running
process.
"""
if len(self.procs) > 1:
logger.debug("SCHED:")
logger.debu... | python | {
"resource": ""
} |
q253788 | Linux.wait | validation | def wait(self, readfds, writefds, timeout):
""" Wait for file descriptors or timeout.
Adds the current process in the correspondent waiting list and
yield the cpu to another running process.
"""
logger.debug("WAIT:")
logger.debug(f"\tProcess {self._current} is goi... | python | {
"resource": ""
} |
q253789 | Linux.awake | validation | def awake(self, procid):
""" Remove procid from waitlists and reestablish it in the running list """
logger.debug(f"Remove procid:{procid} from waitlists and reestablish it in the running list")
for wait_list in self.rwait:
| python | {
"resource": ""
} |
q253790 | Linux.signal_receive | validation | def signal_receive(self, fd):
""" Awake one process waiting to receive data on fd """
connections = self.connections
if connections(fd) and self.twait[connections(fd)]:
| python | {
"resource": ""
} |
q253791 | Linux.check_timers | validation | def check_timers(self):
""" Awake process if timer has expired """
if self._current is None:
# Advance the clocks. Go to future!!
advance = min([self.clocks] + [x for x in self.timers if x is not None]) + 1
logger.debug(f"Advancing the clock from {self.clocks} to {adv... | python | {
"resource": ""
} |
q253792 | Linux._interp_total_size | validation | def _interp_total_size(interp):
"""
Compute total load size of interpreter.
:param ELFFile interp: interpreter ELF .so
:return: total load size of interpreter, not aligned
:rtype: int
"""
load_segs = [x | python | {
"resource": ""
} |
q253793 | SLinux.sys_openat | validation | def sys_openat(self, dirfd, buf, flags, mode):
"""
A version of openat that includes a symbolic path and symbolic directory file descriptor
:param dirfd: directory file descriptor
:param buf: address of zero-terminated pathname
:param flags: file access bits
:param mode:... | python | {
"resource": ""
} |
q253794 | Decree.sys_allocate | validation | def sys_allocate(self, cpu, length, isX, addr):
""" allocate - allocate virtual memory
The allocate system call creates a new allocation in the virtual address
space of the calling process. The length argument specifies the length of
the allocation in bytes which will be rou... | python | {
"resource": ""
} |
q253795 | Decree.sys_random | validation | def sys_random(self, cpu, buf, count, rnd_bytes):
""" random - fill a buffer with random data
The random system call populates the buffer referenced by buf with up to
count bytes of random data. If count is zero, random returns 0 and optionally
sets *rx_bytes to zero. If coun... | python | {
"resource": ""
} |
q253796 | Decree.sys_receive | validation | def sys_receive(self, cpu, fd, buf, count, rx_bytes):
""" receive - receive bytes from a file descriptor
The receive system call reads up to count bytes from file descriptor fd to the
buffer pointed to by buf. If count is zero, receive returns 0 and optionally
sets *rx_bytes... | python | {
"resource": ""
} |
q253797 | Decree.sys_deallocate | validation | def sys_deallocate(self, cpu, addr, size):
""" deallocate - remove allocations
The deallocate system call deletes the allocations for the specified
address range, and causes further references to the addresses within the
range to generate invalid memory accesses. The region is also
... | python | {
"resource": ""
} |
q253798 | Decree.sched | validation | def sched(self):
""" Yield CPU.
This will choose another process from the RUNNNIG list and change
current running process. May give the same cpu if only one running
process.
"""
if len(self.procs) > 1:
logger.info("SCHED:")
logger.info(... | python | {
"resource": ""
} |
q253799 | Decree.wait | validation | def wait(self, readfds, writefds, timeout):
""" Wait for filedescriptors or timeout.
Adds the current process to the corresponding waiting list and
yields the cpu to another running process.
"""
logger.info("WAIT:")
logger.info("\tProcess %d is going to wait for [... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.