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 DCDD2EB64DC for ; Mon, 17 Jul 2023 14:34:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231261AbjGQOe3 (ORCPT ); Mon, 17 Jul 2023 10:34:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231708AbjGQOeQ (ORCPT ); Mon, 17 Jul 2023 10:34:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 467A01BD8; Mon, 17 Jul 2023 07:33:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDE37610AB; Mon, 17 Jul 2023 14:33:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40CADC433C7; Mon, 17 Jul 2023 14:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689604431; bh=I21ZDliWD7GOdnTUiUm/tPH/YR8Nmd8AOMXf8/BsAhQ=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=IHUkmxqZ8XZmpa+aN5HU8DZORxXMoMRWO+WWbx47YVDPP8qvPcVzhLHh1XeIU1nv8 QzuwK0t9DPm/8gU/fnssor4Fkmq/bB8XGYkbHHr7y4nEmeUstm1rRH2EwPj95Ker1K ndQjU7fQqZIg6zCAfCxTzu03K585baZEwR6GK48cFRJRo8r8l0MRQ4w+PA1hZNqEk2 rosP4lYUR6++AlrfPC7kpK3RXNhNpJEOgiJy4QIqZNBgQEvsDCtykn/s6ikPHmljVM iwMAYqHp7lpN2ENeBAvgFFQ5uBO42xfrgNcJzvgxERPEFLRFCZbhD5sy8yNFfJ9l7k qM+Ktsgp12Txw== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 17 Jul 2023 14:33:46 +0000 Message-Id: Cc: , , , , Subject: Re: [PATCH v3 17/28] x86/sgx: fix a NULL pointer From: "Jarkko Sakkinen" To: "Haitao Huang" , , , , , , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , , "H. Peter Anvin" X-Mailer: aerc 0.14.0 References: <20230712230202.47929-1-haitao.huang@linux.intel.com> <20230712230202.47929-18-haitao.huang@linux.intel.com> In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.org On Mon Jul 17, 2023 at 1:14 PM UTC, Haitao Huang wrote: > On Mon, 17 Jul 2023 07:49:27 -0500, Jarkko Sakkinen = =20 > 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 = =20 > >> 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= =20 > >> 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 =20 > accounting is not partitioned into cgroups. Will add fix tag with the =20 > related EDMM patch. And move this as the first patch. I understand, it is just a good practice to follow, i.e. have prelude and then the "real" changes :-) BR, Jarkko