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 C7CE8ECAA24 for ; Thu, 25 Aug 2022 18:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243373AbiHYSiE (ORCPT ); Thu, 25 Aug 2022 14:38:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234217AbiHYSiD (ORCPT ); Thu, 25 Aug 2022 14:38:03 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D0C28C02D; Thu, 25 Aug 2022 11:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661452682; x=1692988682; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=UDIT9w7lLnqkI9XrrOn8rPx4zbFBiEYDz5hJTNkU2iU=; b=f8h8O2Kxp+OjhE7U7LdW7SXEqSv3Hzi1IdXGWOSbyPR72rB0dvGq/jeT YwTg4B7axbST8PJklFJeyObqiTnPnNHIXb6ft4/L90LIyY1u03s3dSZgy cgcH6wSTB4vW7FwzWVCchcawKaWB1o9YQIhdX9hpgp/x7nJ7g3PcEttCt FtVCqR75AJFDvE1Axvc28ESG2ygGv0CEuo34ssjNN2t+7uI6kww64iPgt VAd9upeVOx65jH+6N2QTPDdRx+WxXFIVS6I1VI6Gs6jFUr1vvTHbISrko g1uLbkomBYXQu+IysMHBMdar95kr0nvGeKtzVds8FTdJGB3K5XzVJV7D9 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10450"; a="277345921" X-IronPort-AV: E=Sophos;i="5.93,263,1654585200"; d="scan'208";a="277345921" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 11:38:01 -0700 X-IronPort-AV: E=Sophos;i="5.93,263,1654585200"; d="scan'208";a="752596178" Received: from manjeets-mobl.amr.corp.intel.com (HELO [10.212.220.1]) ([10.212.220.1]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 11:38:00 -0700 Message-ID: <9dda4484-4c81-ab86-0227-ea926178986e@intel.com> Date: Thu, 25 Aug 2022 11:38:00 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v3] x86/sgx: Do not consider unsanitized pages an error Content-Language: en-US To: Jarkko Sakkinen Cc: linux-sgx@vger.kernel.org, Paul Menzel , Haitao Huang , Dave Hansen , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" References: <20220825080802.259528-1-jarkko@kernel.org> From: Dave Hansen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/25/22 11:27, Jarkko Sakkinen wrote: > On Thu, Aug 25, 2022 at 07:07:44AM -0700, Dave Hansen wrote: >> On 8/25/22 01:08, Jarkko Sakkinen wrote: >>> However, if the SGX subsystem initialization is retracted, the sanitization >>> process could end up in the middle, and sgx_dirty_page_list be left >>> non-empty for legit reasons. >> What does "retraction" mean in this context? > Rest of the initialization failing or features not detected (-ENODEV). Can you please work on communicating better descriptions of the problems? This really isn't good enough. I think you're talking about sgx_init(). It launches ksgxd from sgx_page_reclaimer_init() which sets about sanitizing the 'dirty_page_list'. After launching ksgxd, if later actions in sgx_init() (misc_register(), sgx_drv_init(), sgx_vepc_init()) fail, ksgxd will be stopped prematurely. This will leave pages in 'sgx_dirty_page_list' after __sgx_sanitize_pages() has completed, which results in a WARN_ON(). The WARN_ON() is really only valid when __sgx_sanitize_pages() runs to completion *and* fails to empty 'sgx_dirty_page_list'. Is that it? If so, could you please give the changelog another go?