[llvm-bugs] [Bug 37206] New: msan: incorrect origin for stack variables

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 23 00:47:36 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37206

            Bug ID: 37206
           Summary: msan: incorrect origin for stack variables
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: dvyukov at google.com
                CC: llvm-bugs at lists.llvm.org

#include <stdio.h>

int main()
{
        volatile char a, b, c, d, e, f, g, h;
        volatile char x, y;
        c = x;
        d = y;
        if (c)
                printf("here\n");
        return 0;
}

$ clang -v
clang version 7.0.0 (trunk 326052)
$ clang test.c -fsanitize=memory -fsanitize-memory-track-origins -g
$ ./a.out

==259013==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x49a1a6 in main test.c:9:6
    #1 0x7f8dd562a2b0 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
    #2 0x41d5f9 in _start (a.out+0x41d5f9)

  Uninitialized value was stored to memory at
    #0 0x49a116 in main test.c:8:4
    #1 0x7f8dd562a2b0 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202b0)

  Uninitialized value was created by an allocation of 'y' in the stack frame of
function 'main'
    #0 0x499b10 in main test.c:4

SUMMARY: MemorySanitizer: use-of-uninitialized-value test.c:9:6 in main

Uninit values is created by variable 'x', not 'y'.

MSAN should align local variables to origin granularity.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180423/3f2215c7/attachment-0001.html>


More information about the llvm-bugs mailing list