From: Josh Poimboeuf <[email protected]>

To avoid continued attempted use of a bad .sframe section, remove it
on demand when the first sign of corruption is detected.

Signed-off-by: Josh Poimboeuf <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
Reviewed-by: Indu Bhagat <[email protected]>
Signed-off-by: Jens Remus <[email protected]>
---

Notes (jremus):
    Changes in v15:
    - sframe_find(): Align to normalized error code usage and remove .sframe
      for all but ENOENT.  Also remove if user_read_access_begin() fails.

 kernel/unwind/sframe.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/unwind/sframe.c b/kernel/unwind/sframe.c
index 41ece3ca62a1..e0eb2adf5a07 100644
--- a/kernel/unwind/sframe.c
+++ b/kernel/unwind/sframe.c
@@ -371,10 +371,15 @@ int sframe_find(unsigned long ip, struct 
unwind_user_frame *frame)
                        ret = __find_fre(sec, &fde, ip, frame);
        }
 
+end:
+       if (ret && ret != -ENOENT)
+               WARN_ON_ONCE(sframe_remove_section(sec->sframe_start));
+
        return ret;
 
 Efault:
-       return -EFAULT;
+       ret = -EFAULT;
+       goto end;
 }
 
 static void free_section(struct sframe_section *sec)
-- 
2.51.0


Reply via email to