Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DeviceSanitizer] Checking "sycl::free" related errors #1402

Merged
merged 54 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
92576b8
[GHA] Bump actions/checkout to v4.1.1
kbenzie Jan 31, 2024
4a52d27
[CL] Handle INTERMEDIATE binary type
kbenzie Jan 31, 2024
eb63bc1
[CUDA] Fix sizeof(const char*) usage
kbenzie Jan 29, 2024
4652f52
[Docs] Update the Adapter Change Process
kbenzie Feb 1, 2024
8e698cd
wip
AllanZyne Feb 2, 2024
f23e2c1
bad free
AllanZyne Feb 4, 2024
0b6afb8
initial implementation
AllanZyne Feb 7, 2024
3bbcf25
refactor asan_interceptor
AllanZyne Feb 20, 2024
29c408a
Merge branch 'main' into user-after-free
AllanZyne Feb 20, 2024
090dbca
fix build
AllanZyne Feb 20, 2024
010b052
fix crash
AllanZyne Feb 20, 2024
024e865
small fix
AllanZyne Feb 23, 2024
7d2b5e9
fix size of DeviceType
AllanZyne Feb 23, 2024
a058dbf
WIP
AllanZyne Feb 27, 2024
be90282
Merge branch 'main' into user-after-free
AllanZyne Feb 27, 2024
5467e40
fix build
AllanZyne Feb 27, 2024
e8f8674
fix out-of-bounds test
AllanZyne Feb 29, 2024
f697026
update report
AllanZyne Mar 1, 2024
73fbdfe
Use iterator to pass AllocInfo
AllanZyne Mar 3, 2024
6e2b37d
Use iterator to pass AllocInfo
AllanZyne Mar 3, 2024
a55a333
Merge branch 'main' into user-after-free
AllanZyne Mar 3, 2024
5de2624
wip
AllanZyne Mar 4, 2024
afe24fe
wip
AllanZyne Mar 4, 2024
31a36d8
wip
AllanZyne Mar 4, 2024
56cf58c
fix reviews
AllanZyne Mar 4, 2024
afd6910
fix CI
AllanZyne Mar 4, 2024
5a0781c
fix comments
AllanZyne Mar 4, 2024
84d5825
check llvm-symbolizer
AllanZyne Mar 4, 2024
e07c64b
fix ci
AllanZyne Mar 4, 2024
535996e
fix device global on gpu & support fgpa emulator
AllanZyne Mar 6, 2024
84644c1
fix LaunchInfo
AllanZyne Mar 6, 2024
f889e00
clean code
AllanZyne Mar 7, 2024
196ac4b
fix build
AllanZyne Mar 7, 2024
3914b03
Merge branch 'main' into user-after-free
AllanZyne Mar 7, 2024
4eefa5b
fix large alignment
AllanZyne Mar 8, 2024
60f33bd
disable copy and skip size=0
AllanZyne Mar 12, 2024
d89abd9
Merge branch 'main' into user-after-free
AllanZyne Mar 12, 2024
726435d
clean code
AllanZyne Mar 13, 2024
e198d84
move ManagedQueue
AllanZyne Mar 13, 2024
3d9aa64
Merge branch 'main' into user-after-free
AllanZyne Mar 14, 2024
3c55cac
Merge branch 'main' into user-after-free
AllanZyne Mar 14, 2024
8c823c5
remove llvm-symbolizer
AllanZyne Mar 23, 2024
2f15623
Merge branch 'main' into user-after-free
AllanZyne Mar 23, 2024
77a0422
sycn with latest code
AllanZyne Mar 24, 2024
b5e4aa5
fix crash at use-after-free; fix build fail
AllanZyne Mar 27, 2024
8408f4b
sync with latest code
AllanZyne Mar 27, 2024
25319a0
Merge branch 'main' into user-after-free
AllanZyne Mar 27, 2024
d698d33
fix build
AllanZyne Mar 27, 2024
611a872
remove RunCommand
AllanZyne Mar 27, 2024
7a90ab6
clean code
AllanZyne Mar 27, 2024
af29fa0
Merge branch 'main' into user-after-free
AllanZyne Apr 2, 2024
a8ae97e
fix crash
AllanZyne Apr 3, 2024
def6bd0
Merge branch 'main' into user-after-free
AllanZyne Apr 7, 2024
7a5c1ad
Merge branch 'main' into user-after-free
AllanZyne Apr 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions source/loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,35 @@ if(UR_ENABLE_SANITIZER)
target_sources(ur_loader
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../ur/ur.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_allocator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_allocator.hpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_interceptor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_interceptor.hpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_quarantine.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_quarantine.hpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_report.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_report.hpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_shadow_setup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_shadow_setup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_shadow_setup.hpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/asan_shadow_setup.hpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/common.hpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/device_sanitizer_report.hpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/stacktrace.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/stacktrace.hpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/symbolizer_llvm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/symbolizer_llvm.hpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/ur_sanddi.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/ur_sanitizer_layer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/ur_sanitizer_layer.hpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/ur_sanddi.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/ur_sanitizer_utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/ur_sanitizer_utils.hpp
)

target_sources(ur_loader
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/linux/san_utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/linux/backtrace.cpp
${CMAKE_CURRENT_SOURCE_DIR}/layers/sanitizer/linux/sanitizer_utils.cpp
)

target_include_directories(ur_loader PRIVATE
Expand Down
17 changes: 17 additions & 0 deletions source/loader/layers/sanitizer/asan_allocator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
*
* Copyright (C) 2024 Intel Corporation
*
* Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
* See LICENSE.TXT
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
* @file asan_allocator.cpp
*
*/

#include "asan_allocator.hpp"

namespace ur_sanitizer_layer {

} // namespace ur_sanitizer_layer
67 changes: 67 additions & 0 deletions source/loader/layers/sanitizer/asan_allocator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
*
* Copyright (C) 2024 Intel Corporation
*
* Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
* See LICENSE.TXT
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
* @file asan_allocator.hpp
*
*/

#pragma once

#include "common.hpp"
#include "stacktrace.hpp"

#include <map>
#include <memory>

namespace ur_sanitizer_layer {

enum class AllocType : uint32_t {
DEVICE_USM,
SHARED_USM,
HOST_USM,
MEM_BUFFER,
DEVICE_GLOBAL
};

struct AllocInfo {
uptr AllocBegin = 0;
uptr UserBegin = 0;
uptr UserEnd = 0;
size_t AllocSize = 0;

AllocType Type = AllocType::DEVICE_USM;
AllanZyne marked this conversation as resolved.
Show resolved Hide resolved
bool IsReleased = false;

ur_context_handle_t Context = nullptr;
ur_device_handle_t Device = nullptr;

StackTrace AllocStack;
StackTrace ReleaseStack;
};

using AllocationMap = std::map<uptr, std::shared_ptr<AllocInfo>>;
using AllocationIterator = AllocationMap::iterator;

inline const char *ToString(AllocType Type) {
switch (Type) {
case AllocType::DEVICE_USM:
return "Device USM";
case AllocType::HOST_USM:
return "Host USM";
case AllocType::SHARED_USM:
return "Shared USM";
case AllocType::MEM_BUFFER:
return "Memory Buffer";
case AllocType::DEVICE_GLOBAL:
return "Device Global";
default:
return "Unknown Type";
}
}

} // namespace ur_sanitizer_layer
Loading
Loading