Git Product home page Git Product logo

Comments (9)

dvyukov avatar dvyukov commented on May 8, 2024

Also filed https://bugs.llvm.org/show_bug.cgi?id=37207 as it's msan bug.

from kmsan.

ramosian-glider avatar ramosian-glider commented on May 8, 2024

Right now [K]MSan uses AllocaInst.getName() to obtain the local's name.
It's actually possible to query the LLVM metadata to get the exact name and declaration location for local vars.

Another idea we've just discussed is to associate the local var's DILocation with the corresponding __msan_poison_alloca() call.

from kmsan.

eugenis avatar eugenis commented on May 8, 2024

Querying metadata is a good idea, and it's not that hard to implement. It will only work with full debug info though, not -gmlt.

In your last sentence, are you saying that you want to describe __msan_poison_alloca call site as data in debug info?

from kmsan.

ramosian-glider avatar ramosian-glider commented on May 8, 2024

In your last sentence, are you saying that you want to describe __msan_poison_alloca call site as data in debug info?
No, the idea was to make the call __msan_poison_alloca have the same file:line info as the local variable.

from kmsan.

eugenis avatar eugenis commented on May 8, 2024

Sure. Either that or __msan_set_alloca_origin4.

from kmsan.

ramosian-glider avatar ramosian-glider commented on May 8, 2024

Another question is how do we represent the information about inlined variables.
E.g. in the following case:

static int bar(int index) {
  int buf[10];
  for (int i = 0; i < 10; i++) {
    buf[i] = (i > 1) ? buf[i-1] + buf[i-2] : 1;
  }
  return (index >= 0 && index < 10) ? buf[index] : 0;
}

static
int foo(int index) {
  return bar(index);
}

We could describe the inlined buf as one of the following options:

  1. buf@foo (current version)
  2. buf@bar (show only the original function)
  3. buf@bar@foo (show all the inlining stack)

Version 3 is the most informative, but it'll create a lot of unnecessary global strings. Version 2 has only the deepest function in the inline stack, which may sometimes be obscure.

from kmsan.

dvyukov avatar dvyukov commented on May 8, 2024
Uninit come from local variable buf created at:
    bar bar.c:11
    foo foo.c:22
    baz baz.c:33

from kmsan.

ramosian-glider avatar ramosian-glider commented on May 8, 2024

Still reproducible with Clang 15.0.0.

from kmsan.

ramosian-glider avatar ramosian-glider commented on May 8, 2024

On the other hand, VLAs are gone from the kernel, so keeping the bug around in LLVM should be enough: https://bugs.llvm.org/show_bug.cgi?id=37207

from kmsan.

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.