From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Wu, Hao A" <hao.a.wu@intel.com>,
"mhaeuser@posteo.de" <mhaeuser@posteo.de>
Cc: "Wang, Jian J" <jian.j.wang@intel.com>,
Vitaly Cheptsov <vit9696@protonmail.com>
Subject: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/EbcDxe: Mitigate memcpy intrinsics
Date: Mon, 30 Aug 2021 01:59:52 +0000 [thread overview]
Message-ID: <BN8PR11MB3666CB2F149E33D4746EB6E4CACB9@BN8PR11MB3666.namprd11.prod.outlook.com> (raw)
In-Reply-To: <BN8PR11MB3666CDC8DA06E365A970E4B3CAC19@BN8PR11MB3666.namprd11.prod.outlook.com>
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; mhaeuser@posteo.de
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Vitaly Cheptsov
> <vit9696@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.wang@intel.com>; Wu, Hao A
> > <hao.a.wu@intel.com>; Vitaly Cheptsov <vit9696@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.wu@intel.com> Will merge after the
> upcoming stable tag.
>
> Best Regards,
> Hao Wu
>
>
> >
> > 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>
> > ---
> > 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
> >
> >
> >
> >
> >
>
>
>
>
>
prev parent reply other threads:[~2021-08-30 1:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-15 20:11 [PATCH 1/1] MdeModulePkg/EbcDxe: Mitigate memcpy intrinsics Marvin Häuser
2021-08-20 5:15 ` [edk2-devel] " Wu, Hao A
2021-08-30 1:59 ` Wu, Hao A [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BN8PR11MB3666CB2F149E33D4746EB6E4CACB9@BN8PR11MB3666.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox