Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1567715 > unrolled thread

[PATCH 1/3] intel_sgx: do not use BUG() in sgx_free_page()

Started byJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
First post2017-01-26 22:30 +0100
Last post2017-01-29 16:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/3] intel_sgx: do not use BUG() in sgx_free_page() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-01-26 22:30 +0100
    Re: [PATCH 1/3] intel_sgx: do not use BUG() in sgx_free_page() Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-27 16:50 +0100
      Re: [PATCH 1/3] intel_sgx: do not use BUG() in sgx_free_page() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-01-29 16:20 +0100

#1567715 — [PATCH 1/3] intel_sgx: do not use BUG() in sgx_free_page()

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2017-01-26 22:30 +0100
Subject[PATCH 1/3] intel_sgx: do not use BUG() in sgx_free_page()
Message-ID<t3ZMe-3YK-11@gated-at.bofh.it>
EREMOVE fails on non-EPC page or when a SECS page with children is to be
removed. These do not happen if the driver is working correctly. Log the
error but do not crash the driver.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/platform/x86/intel_sgx_page_cache.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/intel_sgx_page_cache.c b/drivers/platform/x86/intel_sgx_page_cache.c
index d073057..7f73ac7 100644
--- a/drivers/platform/x86/intel_sgx_page_cache.c
+++ b/drivers/platform/x86/intel_sgx_page_cache.c
@@ -551,10 +551,8 @@ void sgx_free_page(struct sgx_epc_page *entry,
 		ret = __eremove(epc);
 		sgx_put_epc_page(epc);
 
-		if (ret) {
-			pr_err("EREMOVE returned %d\n", ret);
-			BUG();
-		}
+		if (ret)
+			sgx_err(encl, "EREMOVE returned %d\n", ret);
 	}
 
 	spin_lock(&sgx_free_list_lock);
-- 
2.9.3

[toc] | [next] | [standalone]


#1568464

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2017-01-27 16:50 +0100
Message-ID<t4gWK-5Xr-23@gated-at.bofh.it>
In reply to#1567715
On Thu, Jan 26, 2017 at 11:20 PM, Jarkko Sakkinen
<jarkko.sakkinen@linux.intel.com> wrote:
> EREMOVE fails on non-EPC page or when a SECS page with children is to be
> removed. These do not happen if the driver is working correctly. Log the
> error but do not crash the driver.
>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
>  drivers/platform/x86/intel_sgx_page_cache.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/platform/x86/intel_sgx_page_cache.c b/drivers/platform/x86/intel_sgx_page_cache.c
> index d073057..7f73ac7 100644
> --- a/drivers/platform/x86/intel_sgx_page_cache.c
> +++ b/drivers/platform/x86/intel_sgx_page_cache.c
> @@ -551,10 +551,8 @@ void sgx_free_page(struct sgx_epc_page *entry,
>                 ret = __eremove(epc);
>                 sgx_put_epc_page(epc);
>
> -               if (ret) {
> -                       pr_err("EREMOVE returned %d\n", ret);
> -                       BUG();
> -               }
> +               if (ret)
> +                       sgx_err(encl, "EREMOVE returned %d\n", ret);

Do you have something like critical level? For me seems reasonable to
increase the level of message if BUG() was somehow related to actual
situation.

>         }
>
>         spin_lock(&sgx_free_list_lock);

-- 
With Best Regards,
Andy Shevchenko

[toc] | [prev] | [next] | [standalone]


#1569210

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2017-01-29 16:20 +0100
Message-ID<t4ZqO-cH-21@gated-at.bofh.it>
In reply to#1568464
On Fri, Jan 27, 2017 at 05:45:03PM +0200, Andy Shevchenko wrote:
> On Thu, Jan 26, 2017 at 11:20 PM, Jarkko Sakkinen
> <jarkko.sakkinen@linux.intel.com> wrote:
> > EREMOVE fails on non-EPC page or when a SECS page with children is to be
> > removed. These do not happen if the driver is working correctly. Log the
> > error but do not crash the driver.
> >
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > ---
> >  drivers/platform/x86/intel_sgx_page_cache.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/platform/x86/intel_sgx_page_cache.c b/drivers/platform/x86/intel_sgx_page_cache.c
> > index d073057..7f73ac7 100644
> > --- a/drivers/platform/x86/intel_sgx_page_cache.c
> > +++ b/drivers/platform/x86/intel_sgx_page_cache.c
> > @@ -551,10 +551,8 @@ void sgx_free_page(struct sgx_epc_page *entry,
> >                 ret = __eremove(epc);
> >                 sgx_put_epc_page(epc);
> >
> > -               if (ret) {
> > -                       pr_err("EREMOVE returned %d\n", ret);
> > -                       BUG();
> > -               }
> > +               if (ret)
> > +                       sgx_err(encl, "EREMOVE returned %d\n", ret);
> 
> Do you have something like critical level? For me seems reasonable to
> increase the level of message if BUG() was somehow related to actual
> situation.

Hmm... I think that would make sense. This could only happen when
the driver implementation is working incorrectly.

/Jarkko

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web