Coder Social home page Coder Social logo

Comments (3)

tobiasherzke avatar tobiasherzke commented on August 29, 2024

Looks like stoat has no concept of multiple definitions of the same symbol in different RTLD_LOCAL contexts, and considers them to be the same function. And in my opinion, this is a good thing, and should stay that way.
Benefit if it stays like this: If you forget to tag the signal processing entry point in one plugin, then that function will be checked anyway by stoat.
Disadvantage if stoat learned about this particular dlopen feature: stoat would get more complicated for no relevant gain. You would have to tell stoat somehow which .bc files form together one plugin. Future requests for solving other corner cases in stoat will have a precedent.

from stoat.

fundamental avatar fundamental commented on August 29, 2024

Stoat generally assumes that one function symbol name is associated with a single underlying C/C++ implementation. This approach is fairly useful in the case where a function may receive multiple definitions (e.g. static/local functions or template code definitions). As you can see the drawback exists when you have a variety of translation units (C/C++ source files) which build into multiple different libraries or executables.

It is possible to get stoat to automatically recognize which LLVM bitcode files are associated with which binaries eventually, but for the moment the recommended course of action would be specifying the bitcode files yourself (e.g. stoat -r common-build-dir/ specific-plugin-file.bc ).

(Notes for feature implementation)
For the structure to be recognized automatically stoat will need to:

  1. recognize the linker phase of a project's build (e.g. $CC -o BIN file.o file2.o file3.o)
  2. dump an additional metadata piece of information specifying the dependent .bc files
  3. do the above in a recursive process for projects that may have a complex build (e.g. 1.o 2.o 3.o => lib.a, lib.a 4.o => binary)
  4. expose a way for stoat to consume the metadata (the metadata files could be as simple as a list of bitcode files)

from stoat.

foolswood avatar foolswood commented on August 29, 2024

I had a bit of a play with this from the perspective of compilation units (as opposed to targets):
https://github.com/fundamental/stoat/compare/master...foolswood:compilation_unit_example?expand=1

Building main with different sub implementations yields different results:

  • sub_safe.c - Summary: 3 functions, all safe. (Actually 4 functions in example).
  • sub_unsafe.c - Summary: 5 functions, 2 unsafe. (Actually 4 functions in example).
  • sub_safe2.c - Summary: 6 functions, 2 unsafe. (Actually 5 in example). In this case a false contradiction is reported.

Don't know if my experimenting here is useful or annoying, but I thought the false positive might be of interest.
That said I have not been able to sneak anything realtime unsafe past stoat :)

from stoat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.