diff options
author | Marvin H?user <mhaeuser@posteo.de> | 2021-08-16 04:11:56 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-08-30 01:58:31 +0000 |
commit | b04453d36bd87735aadd29adbefce8d147f18a35 (patch) | |
tree | a2b0b341f7da56ee2d2486a3bb8d33d2caae4a79 /MdeModulePkg/Universal | |
parent | 77d5fa80246e8784f89e109ff9dadfeb7089ff85 (diff) | |
download | edk2-b04453d36bd87735aadd29adbefce8d147f18a35.tar.gz |
MdeModulePkg/EbcDxe: Mitigate memcpy intrinsics
Assignments of structure values cause the emission of memcpy()
intrinsics by the CLANG38 toolchain. Substitute the assignments with
calls to CopyMem() to mitigate the issue.
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin H?user <mhaeuser@posteo.de>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r-- | MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c | 6 | ||||
-rw-r--r-- | MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c | 6 | ||||
-rw-r--r-- | MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c index 611b2de5d8..e417f4870f 100644 --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c @@ -219,7 +219,11 @@ EdbCheckBreakpoint ( //
// If hit, record current breakpoint
//
- DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX] = DebuggerPrivate->DebuggerBreakpointContext[Index];
+ CopyMem (
+ &DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX],
+ &DebuggerPrivate->DebuggerBreakpointContext[Index],
+ sizeof (DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX])
+ );
DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX].State = TRUE;
//
// Do not set Breakpoint flag. We record the address here just let it not patch breakpoint address when de-init.
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c index e0c797be24..5d32c68406 100644 --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c @@ -158,7 +158,11 @@ DebuggerBreakpointDel ( // Delete this breakpoint
//
for (BpIndex = Index; BpIndex < DebuggerPrivate->DebuggerBreakpointCount - 1; BpIndex++) {
- DebuggerPrivate->DebuggerBreakpointContext[BpIndex] = DebuggerPrivate->DebuggerBreakpointContext[BpIndex + 1];
+ CopyMem (
+ &DebuggerPrivate->DebuggerBreakpointContext[BpIndex],
+ &DebuggerPrivate->DebuggerBreakpointContext[BpIndex + 1],
+ sizeof (DebuggerPrivate->DebuggerBreakpointContext[BpIndex])
+ );
}
ZeroMem (
&DebuggerPrivate->DebuggerBreakpointContext[BpIndex],
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c index 83257a2c25..1bfe5240c7 100644 --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c @@ -230,7 +230,11 @@ EbcDebuggerPushTraceDestEntry ( //
ASSERT (mDebuggerPrivate.TraceEntry[EFI_DEBUGGER_TRACE_MAX].Type == Type);
for (Index = 0; Index < EFI_DEBUGGER_TRACE_MAX; Index++) {
- mDebuggerPrivate.TraceEntry[Index] = mDebuggerPrivate.TraceEntry[Index + 1];
+ CopyMem (
+ &mDebuggerPrivate.TraceEntry[Index],
+ &mDebuggerPrivate.TraceEntry[Index + 1],
+ sizeof (mDebuggerPrivate.TraceEntry[Index])
+ );
}
mDebuggerPrivate.TraceEntry[EFI_DEBUGGER_CALLSTACK_MAX - 1].DestAddress = DestEntry;
mDebuggerPrivate.TraceEntryCount = EFI_DEBUGGER_TRACE_MAX;
|