Skip to content

Mprotect

SYS_MPROTECT = 125 module-attribute

parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description='\nCalls the mprotect syscall and prints its result value.\n\nNote that the mprotect syscall may fail for various reasons\n(see `man mprotect`) and a non-zero error return value\ncan be decoded with the `errno <value>` command.\n\nExamples:\n mprotect $rsp 4096 PROT_READ|PROT_WRITE|PROT_EXEC\n mprotect $rsp 4096 rwx\n mprotect $rsp 4096 7\n mprotect some_symbol 0x1000 PROT_NONE\n') module-attribute

prot_dict = {'PROT_NONE': 0, 'PROT_READ': 1, 'PROT_WRITE': 2, 'PROT_EXEC': 4} module-attribute

mprotect(addr, length, prot)

prot_str_to_val(protstr)

Converts a protection string to an integer. Formats include: - A positive integer, like 3 - A combination of r, w, and x, like rw - A combination of PROT_READ, PROT_WRITE, and PROT_EXEC, like PROT_READ|PROT_WRITE

prot_val_to_str(protval)