[llvm-bugs] [Bug 36315] New: DFSan incorrectly transfers param attributes for variadic custom "__dfsw_*" handlers

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 8 23:51:21 PST 2018


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

            Bug ID: 36315
           Summary: DFSan incorrectly transfers param attributes for
                    variadic custom "__dfsw_*" handlers
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Miscellaneous Instrumentation passes
          Assignee: unassignedbugs at nondot.org
          Reporter: sbucur at google.com
                CC: llvm-bugs at lists.llvm.org

For variadic function calls that are uninstrumented and provided with a custom
"__dfsw_*" handler, the DFSan pass transfers the param attributes from the old
call to the new call, but it does not offset the indices of the extra
arguments, which come after the shadow arguments in the new call. This causes
attributes like "nonnull" to be attached to shadow arguments, which aren't
pointers, and hence should never be marked as "nonnull".

Example for a snprintf custom wrapper:

Before instrumentation:   %X = call i32 (i8*, i64, i8*, ...) @snprintf(i8*
nonnull %30, i64 200, i8* getelementptr inbounds ([19 x i8], [19 x i8]*
@.str.94.1284, i64 0, i64 0), i64 %32, i8* %29, i8* nonnull %34) #1

After instrumentation: %Y = call i32 (i8*, i64, i8*, i16, i16, i16, i16*, i16*,
...) @__dfsw_snprintf(i8* nonnull %98, i64 200, i8* getelementptr inbounds ([19
x i8], [19 x i8]* @.str.94.1284, i64 0, i64 0), i16 zeroext 0, i16 zeroext 0,
i16 nonnull zeroext 0, i16* %130, i16* %labelreturn, i64 %118, i8* %97, i8*
%126)

Note that the "nonnull" attribute stays in the same position, although it
should have been shifted to the end of the argument list.

-- 
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/20180209/c4d8a41c/attachment.html>


More information about the llvm-bugs mailing list