From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF5ADC001DC for ; Mon, 17 Jul 2023 13:14:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230210AbjGQNOl (ORCPT ); Mon, 17 Jul 2023 09:14:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229496AbjGQNOk (ORCPT ); Mon, 17 Jul 2023 09:14:40 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44711C7; Mon, 17 Jul 2023 06:14:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689599679; x=1721135679; h=to:cc:subject:references:date:mime-version: content-transfer-encoding:from:message-id:in-reply-to; bh=WXAAajyq7RVwSRDzE/5hqXM57XC+7i9ZvN34rS3CqAg=; b=YXzQdiEr2vtr6RoAmwmzKNNKFAebqPY8Lvj0Xvk3ad6W7GDIu7ASKxu/ m9wFW3Zdhk9Y5fw9KPmOKvuK9L+q+p/3KjP3EyoQ4vGBBqmGlAuX1LXMt jHabnfE1QOfOMp9kDrNcofL1K5HCpVbQJXDdiR29nfSEOBa1vjlvPv8kz 10Sxxr42K4nrzjm0FsLLFdrmMgiDwZPaKbd5QA67Mm6eOwS/6fgIX6jK7 J6oi6GKEAUQykH0q1T6+5qJw3zpkx1nVEPBBTXILTVOJPNerEFXQb8IAM LppHtpXrm7DWSbo/K3XcIdpJaZ83AMnH7kqBbnB4WemmKJO0MXhdsye8M A==; X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="432095354" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="432095354" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2023 06:14:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="717230049" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="717230049" Received: from hhuan26-mobl.amr.corp.intel.com ([10.92.48.113]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 17 Jul 2023 06:14:34 -0700 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: "Jarkko Sakkinen" , dave.hansen@linux.intel.com, tj@kernel.org, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, cgroups@vger.kernel.org, "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , x86@kernel.org, "H. Peter Anvin" Cc: kai.huang@intel.com, reinette.chatre@intel.com, zhiquan1.li@intel.com, kristen@linux.intel.com, seanjc@google.com Subject: Re: [PATCH v3 17/28] x86/sgx: fix a NULL pointer References: <20230712230202.47929-1-haitao.huang@linux.intel.com> <20230712230202.47929-18-haitao.huang@linux.intel.com> Date: Mon, 17 Jul 2023 08:14:30 -0500 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Haitao Huang" Organization: Intel Message-ID: In-Reply-To: User-Agent: Opera Mail/1.0 (Win32) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 Jul 2023 07:49:27 -0500, Jarkko Sakkinen wrote: > On Mon Jul 17, 2023 at 12:48 PM UTC, Jarkko Sakkinen wrote: >> On Wed Jul 12, 2023 at 11:01 PM UTC, Haitao Huang wrote: >> > Under heavy load, the SGX EPC reclaimers (ksgxd or future EPC cgroup >> > worker) may reclaim SECS EPC page for an enclave and set >> > encl->secs.epc_page to NULL. But the SECS EPC page is required for >> EAUG >> > in #PF handler and is used without checking for NULL and reloading. >> > >> > Fix this by checking if SECS is loaded before EAUG and load it if it >> was >> > reclaimed. >> > >> > Signed-off-by: Haitao Huang >> >> A bug fix should be 1/*. > > And a fixes tag. > > Or is there a bug that is momentized by the earlier patches? This patch > feels confusing to say the least. > It happens in heavy reclaiming cases, just extremely rare when EPC accounting is not partitioned into cgroups. Will add fix tag with the related EDMM patch. And move this as the first patch. Thanks Haitao