[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAGXu5j+xXbOaPyDrVHTBY3YKt_vEReFCgWCbw0q-220A5eh5RA@mail.gmail.com>
Date: Wed, 2 May 2018 21:50:41 -0700
From: Kees Cook <keescook@...omium.org>
To: Yizhuo Zhai <yzhai003@....edu>
Cc: Al Viro <viro@...iv.linux.org.uk>, Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
LKML <linux-kernel@...r.kernel.org>,
Chengyu Song <csong@...ucr.edu>,
Zhiyun Qian <zhiyunq@...ucr.edu>
Subject: Re: [PATCH] kernel/exit.c: pointer sighand could be uninitialized
On Wed, May 2, 2018 at 6:48 PM, Yizhuo Zhai <yzhai003@....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@....edu <yzhai003@....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
Powered by blists - more mailing lists