* Re: [PATCH] kernel/exit.c: pointer sighand could be uninitialized
[not found] <CABvMjLTfuDqNEt4+1E6R47UFQOj7N1SAhb3KCwxjHsxm7itaog@mail.gmail.com>
@ 2018-05-03 4:50 ` Kees Cook
2018-05-03 5:06 ` Al Viro
1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2018-05-03 4:50 UTC (permalink / raw)
To: Yizhuo Zhai
Cc: Al Viro, Ingo Molnar, Andrew Morton, Paul E. McKenney, LKML,
Chengyu Song, Zhiyun Qian
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kernel/exit.c: pointer sighand could be uninitialized
[not found] <CABvMjLTfuDqNEt4+1E6R47UFQOj7N1SAhb3KCwxjHsxm7itaog@mail.gmail.com>
2018-05-03 4:50 ` [PATCH] kernel/exit.c: pointer sighand could be uninitialized Kees Cook
@ 2018-05-03 5:06 ` Al Viro
2018-05-03 6:44 ` Chengyu Song
1 sibling, 1 reply; 3+ messages in thread
From: Al Viro @ 2018-05-03 5:06 UTC (permalink / raw)
To: Yizhuo Zhai
Cc: mingo, keescook, akpm, paulmck, linux-kernel, Chengyu Song,
Zhiyun Qian
On Wed, May 02, 2018 at 06:48:57PM -0700, Yizhuo Zhai wrote:
> Variable 'sighand' could be uninitialized if probe_kernel_address fails
> (-EFAULT). The later use in the if statement may lead to undefined behavior.
Excuse me, but that's nonsense. The value *copied* into it (in case
probe_kernel_address() has not failed) may be just as uninitialized.
If mere "compare uninitialized pointer value to NULL" can cause nasal demons to fly,
* we are screwed anyway
* the piece of crap compiler should be printed on sandpaper and used to
polish its authors.
Read the comments in there, please. Especially the one regarding the second case.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kernel/exit.c: pointer sighand could be uninitialized
2018-05-03 5:06 ` Al Viro
@ 2018-05-03 6:44 ` Chengyu Song
0 siblings, 0 replies; 3+ messages in thread
From: Chengyu Song @ 2018-05-03 6:44 UTC (permalink / raw)
To: Al Viro
Cc: Yizhuo Zhai, mingo, keescook, akpm, paulmck, linux-kernel,
Zhiyun Qian
Right. Should have checked the commit history ... this has been brought up before:
> Peter Zijlstra - May 18, 2016, 5:02 p.m.
>
> > +struct task_struct *task_rcu_dereference(struct task_struct **ptask)
> > +{
> > + struct task_struct *task;
> > + struct sighand_struct *sighand;
>
> I think that needs: ' = NULL',
and led to the comments added there.
Sorry for wasting your time.
-chengyu
> On May 2, 2018, at 10:06 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> On Wed, May 02, 2018 at 06:48:57PM -0700, Yizhuo Zhai wrote:
>> Variable 'sighand' could be uninitialized if probe_kernel_address fails
>> (-EFAULT). The later use in the if statement may lead to undefined behavior.
>
> Excuse me, but that's nonsense. The value *copied* into it (in case
> probe_kernel_address() has not failed) may be just as uninitialized.
> If mere "compare uninitialized pointer value to NULL" can cause nasal demons to fly,
> * we are screwed anyway
> * the piece of crap compiler should be printed on sandpaper and used to
> polish its authors.
>
> Read the comments in there, please. Especially the one regarding the second case.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-03 6:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CABvMjLTfuDqNEt4+1E6R47UFQOj7N1SAhb3KCwxjHsxm7itaog@mail.gmail.com>
2018-05-03 4:50 ` [PATCH] kernel/exit.c: pointer sighand could be uninitialized Kees Cook
2018-05-03 5:06 ` Al Viro
2018-05-03 6:44 ` Chengyu Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox