Skip to content

Unsound points-to results? #70

@Machiry

Description

@Machiry

I am trying to find aliases for a pointer, specifically, netibuf.

Target (simplified) source of the program (telnet):

Ring netiring;
unsigned char  netibuf[BUFSIZ];
void init_network (void)
{
 ..
  if (ring_init (&netiring, netibuf, sizeof netibuf) != 1)
    {
      exit (EXIT_FAILURE);
    }
  ..
}

int ring_init (Ring * ring, unsigned char *buffer, int count)
{
  memset ((char *) ring, 0, sizeof *ring);

  ring->size = count;

  ring->supply = ring->consume = ring->bottom = buffer;
  ...
}

I use the following code:

PointerAnalysis* currPta = new AndersenWaveDiffWithType();
currPta->analyze(svfModule);
// get the PAG
PAG *currentPAG = currPta->getPAG();
// Get the top-level variable
GlobalVariable *targetGlobVar = targetModule->getGlobalVariable("netibuf", true);

// get node id
NodeID targetNode = currentPAG->getValueNode(targetGlobVar);

// then I search for aliases
for (NodeBS::iterator nIter = currPta->getAllValidPtrs().begin();
                 nIter != currPta->getAllValidPtrs().end();
                 ++nIter) {
                if (currPta->alias(*nIter, targetNode) != NoAlias) {
                    if (targetAliases.find(*nIter) == targetAliases.end()) {
                       dbgs() << "[+] Alias found:" << *nIter << "\n";
                    }
                }
  }

The above doesn't print any aliases, however, as we can see in the program source above, netibuf has aliases. These results are not sound, Am I missing something here?

Attached is the bc file telnet.0.4.opt.mem2reg.bc.zip, of the telnet, that I am using. The target source code is of telnet is available here: https://ftp.gnu.org/gnu/inetutils/inetutils-1.9.4.tar.gz

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions