lkml.org 
[lkml]   [2018]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] kernel/exit.c: pointer sighand could be uninitialized
On Wed, May 2, 2018 at 6:48 PM, Yizhuo Zhai <yzhai003@ucr.edu> wrote:
> Variable 'sighand' could be uninitialized if probe_kernel_address fails
> (-EFAULT). The later use in the if statement may lead to undefined behavior.
>
> Signed-off-by: yzhai003@ucr.edu <yzhai003@ucr.edu>
> ---
> kernel/exit.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/exit.c b/kernel/exit.c
> index f6cad39..a353bd1 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -232,7 +232,7 @@ void release_task(struct task_struct *p)
> */
> struct task_struct *task_rcu_dereference(struct task_struct **ptask)
> {
> - struct sighand_struct *sighand;
> + struct sighand_struct *sighand = NULL;
> struct task_struct *task;
>
> /*

Better would probably be to check the return of probe_kernel_address()
and take appropriate action...

-Kees

--
Kees Cook
Pixel Security

\
 
 \ /
  Last update: 2018-05-03 09:44    [W:0.060 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site