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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A9CDC433E1 for ; Wed, 24 Mar 2021 23:24:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29BA861A1F for ; Wed, 24 Mar 2021 23:24:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233787AbhCXXX4 (ORCPT ); Wed, 24 Mar 2021 19:23:56 -0400 Received: from mga04.intel.com ([192.55.52.120]:14556 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbhCXXXt (ORCPT ); Wed, 24 Mar 2021 19:23:49 -0400 IronPort-SDR: oJ1+qBYzTuvcMfabBLfz1XKfXgCR7WwHVyDG+1LCEaPCq5EyFHaoqErwjlFaKctBUA3tgnOsls DzZN0hcXlD6A== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="188513331" X-IronPort-AV: E=Sophos;i="5.81,275,1610438400"; d="scan'208";a="188513331" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 16:23:49 -0700 IronPort-SDR: TjT8mVaAXncq/9NN9IWUcs+CkXPUg8Ns1ipcpKrJlhQfAUrH7oouXJiLlIjuxBVo0KZw16pRaz j1/zRlw9s9MQ== X-IronPort-AV: E=Sophos;i="5.81,275,1610438400"; d="scan'208";a="415697964" Received: from prdubey-mobl1.amr.corp.intel.com (HELO khuang2-desk.gar.corp.intel.com) ([10.255.230.226]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 16:23:45 -0700 Date: Thu, 25 Mar 2021 12:23:43 +1300 From: Kai Huang To: Paolo Bonzini Cc: Borislav Petkov , Sean Christopherson , kvm@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, jarkko@kernel.org, luto@kernel.org, dave.hansen@intel.com, rick.p.edgecombe@intel.com, haitao.huang@intel.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com Subject: Re: [PATCH v3 03/25] x86/sgx: Wipe out EREMOVE from sgx_free_epc_page() Message-Id: <20210325122343.008120ef70c1a1b16b5657ca@intel.com> In-Reply-To: <236c0aa9-92f2-97c8-ab11-d55b9a98c931@redhat.com> References: <20210322191540.GH6481@zn.tnic> <20210322210645.GI6481@zn.tnic> <20210323110643.f29e214ebe8ec7a4a3d0bc2e@intel.com> <20210322223726.GJ6481@zn.tnic> <20210323121643.e06403a1bc7819bab7c15d95@intel.com> <20210323160604.GB4729@zn.tnic> <20210323163258.GC4729@zn.tnic> <236c0aa9-92f2-97c8-ab11-d55b9a98c931@redhat.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > +/* Error message for EREMOVE failure, when kernel is about to leak EPC page */ > > +#define EREMOVE_ERROR_MESSAGE \ > > + "EREMOVE returned %d (0x%x), kernel bug likely. EPC page leaked, SGX may become > > unusuable. Please refer to Documentation/x86/sgx.rst for more information." > > Rewritten: > > EREMOVE returned %d and an EPC page was leaked; SGX may become unusable. > This is a kernel bug, refer to Documentation/x86/sgx.rst for more information. > > Also please split it across multiple lines. > > Paolo > Hi Boris/Paolo, I changed to below (with slight modification on Paolo's): /* Error message for EREMOVE failure, when kernel is about to leak EPC page */ #define EREMOVE_ERROR_MESSAGE \ "EREMOVE returned %d (0x%x) and an EPC page was leaked. SGX may become unusuable. " \ "This is likely a kernel bug. Refer to Documentation/x86/sgx.rst for more information." I got a checkpatch warning however: WARNING: It's generally not useful to have the filename in the file #60: FILE: Documentation/x86/sgx.rst:223: +This is likely a kernel bug. Refer to Documentation/x86/sgx.rst for more I suppose it is OK? Since the error msg is actually hard-coded in the code, and in this document, IMHO we should explicitly call out what error message user is supposed to see, when this bug happens, so that user can absolutely know he/she is dealing with this particular issue.