@@ -185,6 +185,10 @@ extern atomic_t sgx_nr_pids;
pr_err_ratelimited("intel_sgx: [%d:0x%p] " fmt, \
pid_nr((encl)->tgid_ctx->tgid), \
(void *)(encl)->base, ##__VA_ARGS__)
+#define sgx_crit(encl, fmt, ...) \
+ pr_crit_ratelimited("intel_sgx: [%d:0x%p] " fmt, \
+ pid_nr((encl)->tgid_ctx->tgid), \
+ (void *)(encl)->base, ##__VA_ARGS__)
long sgx_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
#ifdef CONFIG_COMPAT
@@ -533,10 +533,8 @@ void sgx_free_page(struct sgx_epc_page *entry, struct sgx_encl *encl)
ret = __eremove(epc);
sgx_put_epc_page(epc);
- if (ret) {
- pr_err("EREMOVE returned %d\n", ret);
- BUG();
- }
+ if (ret)
+ sgx_crit(encl, "EREMOVE returned %d\n", ret);
spin_lock(&sgx_free_list_lock);
list_add(&entry->free_list, &sgx_free_list);
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.h | 4 ++++ drivers/platform/x86/intel_sgx_page_cache.c | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-)