mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Fix potential stack corruption in DebugSessionImp
- allocate 64 bytes on stack when accessing registers Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b5ee204d9c
commit
31ebf37091
@@ -36,6 +36,7 @@ struct MockDebugSession : public L0::DebugSessionImp {
|
||||
using L0::DebugSessionImp::generateEventsAndResumeStoppedThreads;
|
||||
using L0::DebugSessionImp::generateEventsForPendingInterrupts;
|
||||
using L0::DebugSessionImp::generateEventsForStoppedThreads;
|
||||
using L0::DebugSessionImp::getRegisterSize;
|
||||
using L0::DebugSessionImp::getStateSaveAreaHeader;
|
||||
using L0::DebugSessionImp::markPendingInterruptsOrAddToNewlyStoppedFromRaisedAttention;
|
||||
using L0::DebugSessionImp::newAttentionRaised;
|
||||
@@ -1717,6 +1718,17 @@ TEST_F(DebugSessionRegistersAccessTest, givenTypeToRegsetDescCalledThenCorrectRe
|
||||
EXPECT_NE(session->typeToRegsetDesc(ZET_DEBUG_REGSET_TYPE_SBA_INTEL_GPU), nullptr);
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenValidRegisterWhenGettingSizeThenCorrectSizeIsReturned) {
|
||||
session->stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);
|
||||
auto pStateSaveAreaHeader = session->getStateSaveAreaHeader();
|
||||
EXPECT_EQ(pStateSaveAreaHeader->regHeader.grf.bytes, session->getRegisterSize(ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenInvalidRegisterWhenGettingSizeThenZeroSizeIsReturned) {
|
||||
session->stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);
|
||||
EXPECT_EQ(0u, session->getRegisterSize(ZET_DEBUG_REGSET_TYPE_INVALID_INTEL_GPU));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenUnsupportedRegisterTypeWhenReadRegistersCalledThenErrorInvalidArgumentIsReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 1;
|
||||
session->stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);
|
||||
|
||||
Reference in New Issue
Block a user