audk/UefiCpuPkg/PiSmmCpuDxeSmm
Jian J Wang 890d9ee554 UefiCpuPkg/PiSmmCpuDxeSmm: fix infinite loop issue in SMM profile
> v2:
>   Reduce the number of page to update/restore from 3 to 2 because DF
>   has no effect in this issue.

The infinite loop is caused by the memory instruction, such as
"rep mov", operating on memory block crossing boundary of NON-PRESENT
pages. Because the address triggering page fault set in CR2 will be in
the first page, SmmProfilePFHandler() will only change the first page
into PRESENT. The page following will be still in NON-PRESENT status.

Since SmmProfilePFHandler() will setup single-step trap for the
instruction causing #PF, when the handler returns back to the
instruction and re-execute it, both #DB and #PF will be triggered
because the instruction wants to access both first and second page
but only first page is PRESENT.

Normally #DB exception will be handled first and its handler will
change first page back to NON-PRESENT status. Then #PF is handled
and its handler will change first page to PRESENT status again and
setup another single-step for the instruction triggering #PF. Then
the whole system falls into an infinite loop and the memory operation
will never move on.

This patch fix above situation by always changing 2 pages to PRESENT
status instead of just 1 page. Those 2 pages include the page causing
#PF and the page after it.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2018-02-08 12:47:17 +08:00
..
Ia32 UefiCpuPkg/PiSmmCpuDxeSmm: eliminate conditional jump in IA32 SmmStartup() 2018-01-31 12:38:26 +01:00
X64 UefiCpuPkg/PiSmmCpuDxeSmm: Enable NXE if it's supported 2018-01-18 17:03:24 +08:00
CpuS3.c UefiCpuPkg: Update PiSmmCpuDxeSmm pass XCODE5 tool chain 2018-01-16 23:43:08 +08:00
CpuService.c UefiCpuPkg/LocalApicLib: Rename GetProcessorLocation() 2016-11-02 09:16:21 +08:00
CpuService.h UefiCpuPkg: Add PiSmmCpuDxeSmm module no IA32/X64 files 2015-10-19 19:12:53 +00:00
MpService.c UefiCpuPkg/PiSmmCpuDxeSmm: Fix bitwise size issue 2017-10-16 09:03:41 +08:00
PiSmmCpuDxeSmm.c UefiCpuPkg: Update PiSmmCpuDxeSmm pass XCODE5 tool chain 2018-01-16 23:43:08 +08:00
PiSmmCpuDxeSmm.h UefiCpuPkg: Update PiSmmCpuDxeSmm pass XCODE5 tool chain 2018-01-16 23:43:08 +08:00
PiSmmCpuDxeSmm.inf UefiCpuPkg: Fix unix style of EOL 2017-11-21 20:24:37 +08:00
PiSmmCpuDxeSmm.uni UefiCpuPkg: Convert all .uni files to utf-8 2015-12-15 04:59:14 +00:00
PiSmmCpuDxeSmmExtra.uni UefiCpuPkg: Convert all .uni files to utf-8 2015-12-15 04:59:14 +00:00
SmmCpuMemoryManagement.c UefiCpuPkg PiSmmCpuDxeSmm: Remove redundant code to set IDT range to RO 2018-01-15 10:41:16 +08:00
SmmProfile.c UefiCpuPkg/PiSmmCpuDxeSmm: fix infinite loop issue in SMM profile 2018-02-08 12:47:17 +08:00
SmmProfile.h UefiCpuPkg/PiSmmCpu: Correct exception message. 2016-11-24 10:51:16 +08:00
SmmProfileInternal.h UefiCpuPkg/PiSmmCpuDxeSmm: Consume new APIs 2017-04-07 09:43:48 +08:00
SmramSaveState.c UefiCpuPkg: Refine casting expression result to bigger size 2017-03-06 14:33:26 +08:00
SyncTimer.c UefiCpuPkg: Add PiSmmCpuDxeSmm module no IA32/X64 files 2015-10-19 19:12:53 +00:00