From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 4EAFB740032 for ; Thu, 30 Nov 2023 06:29:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=24HMRJUQa/BpiA6xUdwJXSBWbflax2qRzNFoWwY4TZY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1701325791; v=1; b=HSKXaT+AbZ/7borCixvnG5lIi2LEe1pLXATsjyJZAY094e2owx1eexuZLYW+y2/OuBVrUgVd SWa2Kh5UL8LVukPPzm3S2xJdH7vfm3xGNwWa4gVf0k3S1yhq51+Po1Uqpf0xKyD9Ff/Y/iuAXZs ojXPbVlWn8N4EsgUbkWR+I0o= X-Received: by 127.0.0.2 with SMTP id 1iucYY7687511xVC7GbSXE0t; Wed, 29 Nov 2023 22:29:51 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.66739.1701325790007373240 for ; Wed, 29 Nov 2023 22:29:50 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="378304838" X-IronPort-AV: E=Sophos;i="6.04,237,1695711600"; d="scan'208";a="378304838" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2023 22:29:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="860095430" X-IronPort-AV: E=Sophos;i="6.04,237,1695711600"; d="scan'208";a="860095430" X-Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.151]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2023 22:29:46 -0800 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Zhiguang Liu , Ray Ni , Rahul Kumar , Gerd Hoffmann , Laszlo Ersek Subject: [edk2-devel] [PATCH v2 1/3] UefiCpuPkg/CpuPageTableLib: Init local variable before using it. Date: Thu, 30 Nov 2023 14:29:07 +0800 Message-Id: <20231130062909.2003-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: R5hQ8TzfHORWNVlISzvrbkdOx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=HSKXaT+A; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io The local variable OneOfPagingEntry is used before initialized, this may cause reserved bit in page table entry is set especially in PAE paging mode. The bug is random because it depends on the value in stack. Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Laszlo Ersek Signed-off-by: Zhiguang Liu --- UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c index eff02619fa..36b2c4e6a3 100644 --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c @@ -338,7 +338,7 @@ PageTableLibMapInLevel ( ParentAttribute = &LocalParentAttribute; OriginalParentPagingEntry.Uint64 = ParentPagingEntry->Uint64; - + OneOfPagingEntry.Uint64 = 0; // // RegionLength: 256T (1 << 48) 512G (1 << 39), 1G (1 << 30), 2M (1 << 21) or 4K (1 << 12). // @@ -367,8 +367,6 @@ PageTableLibMapInLevel ( if (RETURN_ERROR (Status)) { return Status; } - - OneOfPagingEntry.Pnle.Uint64 = 0; } else { PageTableLibSetPle (Level, &OneOfPagingEntry, 0, &PleBAttribute, &AllOneMask); } -- 2.31.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111889): https://edk2.groups.io/g/devel/message/111889 Mute This Topic: https://groups.io/mt/102889278/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-