[llvm-bugs] [Bug 37138] New: msan: incorrect origin for 64-bit values

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 16 01:06:42 PDT 2018


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

            Bug ID: 37138
           Summary: msan: incorrect origin for 64-bit values
           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

clang version 7.0.0 (trunk 326052)


#include <stdlib.h>

__attribute__((noinline)) void inithalf(void* x)
{
        *(int*)x = 0;
}

__attribute__((noinline)) void copyhalf(void* x, void* y)
{
        *(int*)x = *(int*)y;
}

__attribute__((noinline)) void copy(long long* x, long long* y)
{
        *x = *y;
}

int main() {
        long long x, y, z;
        copyhalf(&y, &z);
        inithalf(&y);
        copy(&x, &y);
        if (x)
                exit(1);
}

==258685==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x499df4 in main /tmp/msan.c:23:6

    #1 0x7f00b44cb2b0 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
    #2 0x41d639 in _start
(/usr/local/google/home/dvyukov/src/linux2/a.out+0x41d639)

  Uninitialized value was stored to memory at
    #0 0x499c98 in copy /tmp/msan.c:15:5

  Uninitialized value was stored to memory at
    #0 0x499c03 in copyhalf /tmp/msan.c:10:11

  Uninitialized value was created by an allocation of 'z' in the stack frame of
function 'main'
    #0 0x499cd0 in main /tmp/msan.c:18

SUMMARY: MemorySanitizer: use-of-uninitialized-value /tmp/msan.c:23:6 in main

Uninit value comes from 'y'.

-- 
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/20180416/f42a7554/attachment-0001.html>


More information about the llvm-bugs mailing list