[compiler-rt] r232936 - [ASan] Distinguish between read, write and read-write file access modes in OpenFile.

Alexander Potapenko glider at google.com
Mon Mar 23 10:56:16 PDT 2015


Ah, right, I've been running check-asan instead of check-sanitizer.
Landing the fix now.

On Mon, Mar 23, 2015 at 8:38 PM, Alexander Potapenko <glider at google.com> wrote:
> You're right, good catch! Not sure yet why MapWritableFileToMemory()
> didn't bark.
> There's another place above where we used to call "OpenFile(tmpfile,
> true);" but actually need "OpenFile(tmpfile, RdOnly);" now.
>
> On Mon, Mar 23, 2015 at 8:09 PM, H.J. Lu <hjl.tools at gmail.com> wrote:
>> On Mon, Mar 23, 2015 at 3:10 AM, Alexander Potapenko <glider at google.com> wrote:
>>> Author: glider
>>> Date: Mon Mar 23 05:10:46 2015
>>> New Revision: 232936
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=232936&view=rev
>>> Log:
>>> [ASan] Distinguish between read, write and read-write file access modes in OpenFile.
>>> This is to fix mapping coverage files into memory on OSX.
>>>
>>> Added:
>>>     compiler-rt/trunk/test/asan/TestCases/Posix/coverage-direct.cc
>>>       - copied unchanged from r232935, compiler-rt/trunk/test/asan/TestCases/Linux/coverage-direct.cc
>>> Removed:
>>>     compiler-rt/trunk/test/asan/TestCases/Linux/coverage-direct.cc
>>> Modified:
>>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc
>>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
>>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
>>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc
>>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
>>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
>>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
>>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
>>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
>>>     compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc
>>>
>> ...
>>> Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc
>>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc?rev=232936&r1=232935&r2=232936&view=diff
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc (original)
>>> +++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc Mon Mar 23 05:10:46 2015
>>> @@ -78,14 +78,14 @@ TEST(SanitizerCommon, FileOps) {
>>>
>>>    char tmpfile[128];
>>>    temp_file_name(tmpfile, sizeof(tmpfile), "sanitizer_common.fileops.tmp.");
>>> -  uptr openrv = OpenFile(tmpfile, true);
>>> +  uptr openrv = OpenFile(tmpfile, WrOnly);
>>>    EXPECT_FALSE(internal_iserror(openrv));
>>>    fd_t fd = openrv;
>>>    EXPECT_EQ(len1, internal_write(fd, str1, len1));
>>>    EXPECT_EQ(len2, internal_write(fd, str2, len2));
>>>    internal_close(fd);
>>>
>>> -  openrv = OpenFile(tmpfile, false);
>>> +  openrv = OpenFile(tmpfile, WrOnly);
>>>    EXPECT_FALSE(internal_iserror(openrv));
>>>    fd = openrv;
>>>    uptr fsize = internal_filesize(fd);
>>> @@ -134,7 +134,7 @@ TEST(SanitizerCommon, InternalMmapWithOf
>>>    char tmpfile[128];
>>>    temp_file_name(tmpfile, sizeof(tmpfile),
>>>                   "sanitizer_common.internalmmapwithoffset.tmp.");
>>> -  uptr res = OpenFile(tmpfile, true);
>>> +  uptr res = OpenFile(tmpfile, WrOnly);
>>                                                ^^^^^^^^^Is this a typo
>> or intentional?
>>>    ASSERT_FALSE(internal_iserror(res));
>>>    fd_t fd = res;
>>>
>>>
>>
>>
>> --
>> H.J.
>
>
>
> --
> Alexander Potapenko
> Software Engineer
> Google Moscow



-- 
Alexander Potapenko
Software Engineer
Google Moscow



More information about the llvm-commits mailing list