Pushed via: PR - https://github.com/tianocore/edk2/pull/1928 Commit - https://github.com/tianocore/edk2/commit/b04453d36bd87735aadd29adbefce8d147f18a35
Best Regards, Hao Wu > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao > A > Sent: Friday, August 20, 2021 1:15 PM > To: devel@edk2.groups.io; mhaeu...@posteo.de > Cc: Wang, Jian J <jian.j.w...@intel.com>; Vitaly Cheptsov > <vit9...@protonmail.com> > Subject: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/EbcDxe: Mitigate > memcpy intrinsics > > > -----Original Message----- > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > Marvin > > H?user > > Sent: Monday, August 16, 2021 4:12 AM > > To: devel@edk2.groups.io > > Cc: Wang, Jian J <jian.j.w...@intel.com>; Wu, Hao A > > <hao.a...@intel.com>; Vitaly Cheptsov <vit9...@protonmail.com> > > Subject: [edk2-devel] [PATCH 1/1] 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. > > > Reviewed-by: Hao A Wu <hao.a...@intel.com> Will merge after the > upcoming stable tag. > > Best Regards, > Hao Wu > > > > > > Cc: Jian J Wang <jian.j.w...@intel.com> > > Cc: Hao A Wu <hao.a...@intel.com> > > Cc: Vitaly Cheptsov <vit9...@protonmail.com> > > Signed-off-by: Marvin Häuser <mhaeu...@posteo.de> > > --- > > MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c | 6 +++++- > > MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c | 6 > > +++++- > > 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 611b2de5d81f..e417f4870f3d 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 e0c797be247f..5d32c684066e 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 83257a2c25fe..1bfe5240c760 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; > > > > -- > > 2.31.1 > > > > > > > > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#79930): https://edk2.groups.io/g/devel/message/79930 Mute This Topic: https://groups.io/mt/84909447/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-