mirror of
https://gitee.com/openharmony/security_code_signature
synced 2024-11-23 06:10:10 +00:00
!241 jit signer 判断逻辑后置
Merge pull request !241 from fundavid/move_checkpoint
This commit is contained in:
commit
297b4012b6
@ -204,7 +204,12 @@ __attribute__((no_sanitize("cfi"))) static inline int32_t ResetJitCode(
|
||||
__attribute__((no_sanitize("cfi"))) static inline int32_t CopyToJitCode(
|
||||
JitCodeSignerBase *signer, void *jitMemory, void *tmpBuffer, int size)
|
||||
{
|
||||
CHECK_NULL_AND_RETURN_CODE(signer);
|
||||
if (jitMemory == nullptr) {
|
||||
return CS_ERR_JIT_MEMORY;
|
||||
}
|
||||
if (tmpBuffer == nullptr) {
|
||||
return CS_ERR_TMP_BUFFER;
|
||||
}
|
||||
int32_t ret = CS_SUCCESS;
|
||||
// try not to depend on other dynamic library in JITFORT
|
||||
#ifndef JIT_FORT_DISABLE
|
||||
@ -214,6 +219,7 @@ __attribute__((no_sanitize("cfi"))) static inline int32_t CopyToJitCode(
|
||||
}
|
||||
#endif
|
||||
if (IsSupportJitCodeSigner()) {
|
||||
CHECK_NULL_AND_RETURN_CODE(signer);
|
||||
ret = signer->ValidateCodeCopy(reinterpret_cast<Instr *>(jitMemory),
|
||||
reinterpret_cast<Byte *>(tmpBuffer), size);
|
||||
} else {
|
||||
|
@ -694,7 +694,7 @@ HWTEST_F(JitCodeSignTest, JitCodeSignTest_0018, TestSize.Level0)
|
||||
EXPECT_EQ(PatchInstruction(nullptr, nullptr, 1), CS_ERR_NO_SIGNER);
|
||||
EXPECT_EQ(PatchData(nullptr, 0, nullptr, 0), CS_ERR_NO_SIGNER);
|
||||
EXPECT_EQ(PatchData(nullptr, nullptr, nullptr, 0), CS_ERR_NO_SIGNER);
|
||||
EXPECT_EQ(CopyToJitCode(nullptr, nullptr, nullptr, 0), CS_ERR_NO_SIGNER);
|
||||
EXPECT_EQ(CopyToJitCode(nullptr, nullptr, nullptr, 0), CS_ERR_JIT_MEMORY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user