diff options
-rw-r--r-- | kernel/exit.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index ac90425ce996..d1e6789064cf 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -900,6 +900,15 @@ NORET_TYPE void do_exit(long code) if (unlikely(!tsk->pid)) panic("Attempted to kill the idle task!"); + /* + * If do_exit is called because this processes oopsed, it's possible + * that get_fs() was left as KERNEL_DS, so reset it to USER_DS before + * continuing. Amongst other possible reasons, this is to prevent + * mm_release()->clear_child_tid() from writing to a user-controlled + * kernel address. + */ + set_fs(USER_DS); + tracehook_report_exit(&code); validate_creds_for_do_exit(tsk); |