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

Pointer analysis #5

Open
Theldus opened this issue Nov 23, 2019 · 0 comments
Open

Pointer analysis #5

Theldus opened this issue Nov 23, 2019 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Theldus
Copy link
Owner

Theldus commented Nov 23, 2019

Description

There are two ways to analyze pointers: 1) tracking the pointer value, as a normal variable (eg: ptr++ would be tracked) and 2) tracking the content pointed by the pointer.

The former is already handled by PBD, as can be seen from the test file in src/tests/test.c. The latter is more complicated and this issue aims to discuss some possible approaches to it.

Two main issues with the analysis of (the content of) pointers I can think of are:

  • a) Where does the address come from? The address can come from a dynamic allocation (mmap, malloc, calloc...), a reference to a variable or part of it (ptr = &vec, ptr = &vec[2], ...), shared memory and so on.

  • b) How big is this memory? If the address comes from a dynamically allocated variable, array... the size changes as well.

Both cases can be 'easily' handled if the addresses are already known, as in references to variables and structures... but it becomes quite annoying if dynamically allocated. With dynamic allocation some kind of mechanism should be used to get addresses and their size, maybe something like a dynamic library with hooks for malloc/calloc + LD_PRELOAD could be a reasonable solution to this, although it cannot handle all memory allocation cases it might be able to handle most of them.

That's it, there is no trivial solution to this, so any help in this regard is most welcome, ;-).

@Theldus Theldus added enhancement New feature or request help wanted Extra attention is needed labels Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant