from cheriplot.provenance.parser import ( CheriMipsModelParser, MissingParentError, DereferenceUnknownCapabilityError) from cheriplot.provenance.model import CheriNodeOrigin, CheriCapPerm from cheriplot.core.test import pct_cap from tests.provenance.fixtures import pgm from tests.provenance.helper import ( assert_graph_equal, mk_pvertex, mk_cvertex, ProvenanceTraceWriter, mk_vertex_mem, mk_vertex_deref, mk_cvertex_visible) logging.basicConfig(level=logging.DEBUG) # some capabilities that are used in the test perm = CheriCapPerm.LOAD | CheriCapPerm.STORE exec_perm = CheriCapPerm.LOAD | CheriCapPerm.EXEC pcc = pct_cap(0x1000, 0x0c, 0x1000, exec_perm) kcc_default = pct_cap(0x00, 0x00, 0xffffffffffffffff, CheriCapPerm.all()) kdc_default = pct_cap(0x00, 0x00, 0xffffffffffffffff, CheriCapPerm.all()) kcc = pct_cap(0x00, 0xcc, 0xffffffff, CheriCapPerm.all()) kdc = pct_cap(0x00, 0xdc, 0xffffffff, CheriCapPerm.all()) ddc = pct_cap(0x0, 0x0, 0x10000, perm) start_cap = pct_cap(0x1000, 0x0, 0x1000, perm) ptr_cap = pct_cap(0x1000, 0x100, 0x1000, perm) bound_cap = pct_cap(0x1100, 0x0, 0x100, perm) perm_cap = pct_cap(0x1100, 0x0, 0x100, CheriCapPerm.STORE) # common part of the trace used for tests that do not # require special initialization of the registers trace_init = ( ("", { # call graph root "cvertex": mk_cvertex(None, vid="call-root")
UnexpectedOperationError) from cheriplot.provenance.model import (CheriNodeOrigin, CheriCapPerm, EdgeOperation) from cheriplot.core.test import pct_cap from tests.provenance.fixtures import pgm from tests.provenance.helper import (assert_graph_equal, mk_pvertex, mk_cvertex, mk_cvertex_ret, mk_vertex_deref, mk_cvertex_visible, ProvenanceTraceWriter) logging.basicConfig(level=logging.DEBUG) perm = CheriCapPerm.EXEC | CheriCapPerm.LOAD perm_rw = CheriCapPerm.LOAD | CheriCapPerm.STORE target_cap = pct_cap(0xc000, 0x0, 0x10000, perm) link_cap = pct_cap(0x1000, 0x0, 0x10000, perm) ret_cap = pct_cap(0xf000, 0x0, 0x1000, perm) # some function addresses fn_a = pct_cap(0x10000, 0x0, 0xf000, perm) fn_b = pct_cap(0x20000, 0x0, 0xf000, perm) fn_c = pct_cap(0x30000, 0x0, 0xf000, perm) fn_d = pct_cap(0x40000, 0x0, 0xd000, perm) fn_e = pct_cap(0xf0000, 0x0, 0x3000, perm) # some capabilities pcc = pct_cap(0x1000, 0x00, 0x1000, perm) kcc_default = pct_cap(0x00, 0x00, 0xffffffffffffffff, CheriCapPerm.all()) kdc_default = pct_cap(0x00, 0x00, 0xffffffffffffffff, CheriCapPerm.all()) ddc = pct_cap(0x0, 0x0, 0x10000, perm_rw) start_cap = pct_cap(0x1000, 0x0, 0x1000, perm_rw)
DereferenceUnknownCapabilityError) from cheriplot.provenance.model import CheriNodeOrigin, CheriCapPerm from cheriplot.core.test import pct_cap from tests.provenance.fixtures import pgm from tests.provenance.helper import (assert_graph_equal, mk_pvertex, mk_cvertex, ProvenanceTraceWriter, mk_vertex_mem, mk_vertex_deref, mk_cvertex_visible) logging.basicConfig(level=logging.DEBUG) # some capabilities that are used in the test perm = CheriCapPerm.LOAD | CheriCapPerm.STORE exec_perm = CheriCapPerm.LOAD | CheriCapPerm.EXEC pcc = pct_cap(0x1000, 0x0c, 0x1000, exec_perm) kcc = pct_cap(0x00, 0xcc, 0xffffffff, CheriCapPerm.all()) kdc = pct_cap(0x00, 0xdc, 0xffffffff, CheriCapPerm.all()) ddc = pct_cap(0x0, 0x0, 0x10000, perm) start_cap = pct_cap(0x1000, 0x0, 0x1000, perm) ptr_cap = pct_cap(0x1000, 0x100, 0x1000, perm) bound_cap = pct_cap(0x1100, 0x0, 0x100, perm) # test pause switch based on 0x1d1d NOP trace_pause_resume = ( ( "", { # call graph root "cvertex": mk_cvertex(None, vid="call-root") }), (
from cheriplot.provenance.parser import ( CheriMipsModelParser, MissingParentError, DereferenceUnknownCapabilityError) from cheriplot.provenance.model import CheriNodeOrigin, CheriCapPerm from cheriplot.core.test import pct_cap from tests.provenance.fixtures import pgm from tests.provenance.helper import ( assert_graph_equal, mk_pvertex, mk_vertex_mem, mk_vertex_deref, mk_cvertex, ProvenanceTraceWriter) logging.basicConfig(level=logging.DEBUG) # some capabilities used in the tests perm = CheriCapPerm.LOAD | CheriCapPerm.STORE pcc = pct_cap(0x1000, 0x0c, 0x1000, CheriCapPerm.LOAD | CheriCapPerm.EXEC) kcc_default = pct_cap(0x00, 0x00, 0xffffffffffffffff, CheriCapPerm.all()) kdc_default = pct_cap(0x00, 0x00, 0xffffffffffffffff, CheriCapPerm.all()) ddc = pct_cap(0x0, 0x0, 0x10000, perm) start_cap = pct_cap(0x1000, 0x0, 0x1000, perm) # Common bit of the test trace initializing registers # # ROOT(c1) # ROOT(kcc) - inferred # ROOT(kdc) - inferred # ROOT(pcc) # trace_mem_init = ( ("", { # call graph root "cvertex": mk_cvertex(None, vid="call-root")
from cheriplot.provenance.parser import (CheriMipsModelParser, MissingParentError, DereferenceUnknownCapabilityError) from cheriplot.provenance.model import CheriNodeOrigin, CheriCapPerm from cheriplot.core.test import pct_cap from tests.provenance.helper import (assert_graph_equal, mk_pvertex, mk_vertex_mem, mk_vertex_deref, mk_cvertex, ProvenanceTraceWriter) logging.basicConfig(level=logging.DEBUG) # some capabilities that are used in the test perm = CheriCapPerm.LOAD | CheriCapPerm.STORE exec_perm = CheriCapPerm.LOAD | CheriCapPerm.EXEC pcc = pct_cap(0x1000, 0x00, 0x1000, exec_perm) kcc_default = pct_cap(0x00, 0x00, 0xffffffffffffffff, CheriCapPerm.all()) kdc_default = pct_cap(0x00, 0x00, 0xffffffffffffffff, CheriCapPerm.all()) ddc = pct_cap(0x0, 0x0, 0x10000, perm) start_cap = pct_cap(0x1000, 0x0, 0x1000, perm) # common part of the trace used for tests that do not # require special initialization of the registers trace_init = ( ( "", { # call graph root "cvertex": mk_cvertex(None, vid="call-root") }), # {0x1000} (