Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overview of features required by DOOP basic-only analysis #111

Closed
7 tasks done
rlwww opened this issue Jan 25, 2023 · 1 comment
Closed
7 tasks done

Overview of features required by DOOP basic-only analysis #111

rlwww opened this issue Jan 25, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@rlwww
Copy link
Collaborator

rlwww commented Jan 25, 2023

The following syntax features have been manually found in the basic-only analysis of DOOP. Also, following files which are added automatically by DOOP: facts/facts.dl, basic/basic.dl, basic-only/analysis.dl, and possible more (depending on flags, see https://bitbucket.org/yanniss/doop/src/master/src/main/groovy/org/clyze/doop/core/SouffleAnalysis.groovy).

It probably does not make sense to mirror the Souffle syntax 1:1, so some things can/must be replaced with some additional preprocessing of the rules.

  • Disjunctions in the body (We do not need this.)
  • Conjunctions in the head
  • Primitive Data types, see https://souffle-lang.github.io/types
    • Strings
    • Numbers
  • Constants in rules (in the place of variables)
  • Facts
  • Stratified negation, see https://souffle-lang.github.io/rules#negation-in-rules
    isStaticMethodInvocation_Insn(?instruction) :-
    _StaticMethodInvocation(?instruction, _, ?signature, _),
    !isOpaqueMethod(?signature).
  • Implement built-in Functions and Aggregates #325
    • Equality to constants (this could maybe be replaced by allowing constants in the place of variables)
    isOpaqueMethod(m) :- isMethod(m), m = "<sun.misc.ProxyGenerator: byte[] generateClassFile()>".
    TypeToSCCId(type, scc) :-
    PartitionedType(type),
    scc = min ord(x) : TypesInSameSCC(type, x).
    • String concatenation
    Method_Descriptor(?method, ?descriptor) :-
    Method_ReturnType(?method, ?returnType),
    Method_ParamTypes(?method, ?params),
    ?descriptor = cat(?returnType, cat("(", cat(?params, ")"))).
    _MethodLookup_ClosestInterface(?simplename, ?descriptor, ?type, ?method) :-
        _MethodLookup_MoreThanOne(?simplename, ?descriptor, ?type),
        ?minLen = min ?len : { _MethodLookup_WithLen(?simplename, ?descriptor, ?type, _, ?len) },
        _MethodLookup_WithLen(?simplename, ?descriptor, ?type, ?method, ?minLen),
        !_MethodLookup_ClassResolution(?simplename, ?descriptor, ?type, _).
    PossibleNativeCodeTargetMethod(?method, "<<UNKNOWN>>", ?file) :-
    _NativeMethodTypeCandidate(?file, ?function, ?descriptor, _),
    _NativeNameCandidate(?file, ?function, ?name, _),
    _NativeXRef(?descriptor, ?file, _, ?descriptorRefAddr),
    _NativeXRef(?name, ?file, _, ?nameRefAddr),
    Method_SimpleName(?method, ?name),
    Method_JVMDescriptor(?method, ?descriptor),
    (?nameRefAddr - ?descriptorRefAddr) <= 15,
    (?descriptorRefAddr - ?nameRefAddr) <= 15 .
    • Constrains
      • String matching
      MethodsOfSameNonSDKType(?method1, ?method2, ?class) :-
      Method_DeclaringType(?method1, ?class),
      !match("java.*", ?class),
      
      !match("sun.*", ?class),
      • Number comparison, e.g. >, <=, =, !=
      ExceptionHandler_InRange(?handler, ?instruction) :-
          ExceptionHandler_Method(?handler, ?method),
          Instruction_Method(?instruction, ?method),
          Instruction_Index(?instruction, ?index),
          ExceptionHandler_Begin(?handler, ?beginIndex),
          ?beginIndex <= ?index,
          ExceptionHandler_End(?handler, ?endIndex),
          ?endIndex > ?index.
@mmarx mmarx added the enhancement New feature or request label Apr 26, 2023
@mmarx mmarx added this to nemo Apr 26, 2023
@mmarx mmarx added this to the Beyond the first release milestone Apr 26, 2023
@github-project-automation github-project-automation bot moved this to Todo in nemo Apr 26, 2023
@monsterkrampe monsterkrampe removed this from the Release 0.6.0 milestone Aug 28, 2024
@monsterkrampe
Copy link
Member

monsterkrampe commented Aug 28, 2024

Supporting modules requires some more fundamental (theoretical) considerations. We still need to make up our minds, what kind of module system we want to build. This might deviate from Souffle's components quite a bit.
In this sense, #324 is still on the roadmap.
The feature is not vital for implementing a basic Doop-like program analysis since the same behavior can likely be achieved already by executing multiple Nemo programs consecutively or simply merging them into a single Nemo program.

@github-project-automation github-project-automation bot moved this from Todo to Done in nemo Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

3 participants