fix: add unrecoverable to avoid out of bound access

Related-To: NEO-9038
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-10-09 09:30:26 +00:00
committed by Compute-Runtime-Automation
parent d76145ee65
commit a31dd7b454
9 changed files with 32 additions and 27 deletions

View File

@@ -101,6 +101,8 @@ DIR *(*sysCallsOpendir)(const char *name) = nullptr;
struct dirent *(*sysCallsReaddir)(DIR *dir) = nullptr;
int (*sysCallsClosedir)(DIR *dir) = nullptr;
int (*sysCallsGetDevicePath)(int deviceFd, char *buf, size_t &bufSize) = nullptr;
off_t lseekReturn = 4096u;
std::atomic<int> lseekCalledCount(0);
int mkdir(const std::string &path) {
if (sysCallsMkdir != nullptr) {
@@ -457,5 +459,10 @@ int closedir(DIR *dir) {
return 0;
}
off_t lseek(int fd, off_t offset, int whence) noexcept {
lseekCalledCount++;
return lseekReturn;
}
} // namespace SysCalls
} // namespace NEO

View File

@@ -7,6 +7,7 @@
#pragma once
#include <atomic>
#include <cstdint>
#include <dirent.h>
#include <iostream>
@@ -73,5 +74,8 @@ extern bool mmapCaptureExtendedPointers;
extern bool mmapAllowExtendedPointers;
extern uint32_t mmapFuncCalled;
extern uint32_t munmapFuncCalled;
extern off_t lseekReturn;
extern std::atomic<int> lseekCalledCount;
} // namespace SysCalls
} // namespace NEO