2004-03-29 05:49:33

by Keith Owens

[permalink] [raw]
Subject: [patch] 2.6.5-rc2 __WAITQUEUE_INITIALIZER

When struct __wait_queue is on stack or you reuse an existing
waitqueue, you get garbage in the flags.

Index: 5-rc2.1/include/linux/wait.h
--- 5-rc2.1/include/linux/wait.h Thu, 18 Dec 2003 16:46:13 +1100 kaos (linux-2.6/m/c/34_wait.h 1.1 644)
+++ 5-rc2.1(w)/include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644)
@@ -40,6 +40,7 @@ typedef struct __wait_queue_head wait_qu
*/

#define __WAITQUEUE_INITIALIZER(name, tsk) { \
+ .flags = 0, \
.task = tsk, \
.func = default_wake_function, \
.task_list = { NULL, NULL } }


2004-03-29 06:53:39

by Andrew Morton

[permalink] [raw]
Subject: Re: [patch] 2.6.5-rc2 __WAITQUEUE_INITIALIZER

Keith Owens <[email protected]> wrote:
>
> When struct __wait_queue is on stack or you reuse an existing
> waitqueue, you get garbage in the flags.
>
> Index: 5-rc2.1/include/linux/wait.h
> --- 5-rc2.1/include/linux/wait.h Thu, 18 Dec 2003 16:46:13 +1100 kaos (linux-2.6/m/c/34_wait.h 1.1 644)
> +++ 5-rc2.1(w)/include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644)
> @@ -40,6 +40,7 @@ typedef struct __wait_queue_head wait_qu
> */
>
> #define __WAITQUEUE_INITIALIZER(name, tsk) { \
> + .flags = 0, \
> .task = tsk, \
> .func = default_wake_function, \
> .task_list = { NULL, NULL } }

The compiler will do this for us?

2004-03-29 08:09:32

by Keith Owens

[permalink] [raw]
Subject: Re: [patch] 2.6.5-rc2 __WAITQUEUE_INITIALIZER

On Sun, 28 Mar 2004 22:53:22 -0800,
Andrew Morton <[email protected]> wrote:
>Keith Owens <[email protected]> wrote:
>>
>> When struct __wait_queue is on stack or you reuse an existing
>> waitqueue, you get garbage in the flags.
>>
>> Index: 5-rc2.1/include/linux/wait.h
>> --- 5-rc2.1/include/linux/wait.h Thu, 18 Dec 2003 16:46:13 +1100 kaos (linux-2.6/m/c/34_wait.h 1.1 644)
>> +++ 5-rc2.1(w)/include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644)
>> @@ -40,6 +40,7 @@ typedef struct __wait_queue_head wait_qu
>> */
>>
>> #define __WAITQUEUE_INITIALIZER(name, tsk) { \
>> + .flags = 0, \
>> .task = tsk, \
>> .func = default_wake_function, \
>> .task_list = { NULL, NULL } }
>
>The compiler will do this for us?

I thought I had a test case where the flags were not being set to 0,
but cannot reproduce it. Ignore this patch unless I get some real
evidence.

2004-04-02 13:19:20

by Tomas Szepe

[permalink] [raw]
Subject: Re: [patch] 2.6.5-rc2 __WAITQUEUE_INITIALIZER

> > When struct __wait_queue is on stack or you reuse an existing
> > waitqueue, you get garbage in the flags.
> >
> > Index: 5-rc2.1/include/linux/wait.h
> > --- 5-rc2.1/include/linux/wait.h Thu, 18 Dec 2003 16:46:13 +1100 kaos (linux-2.6/m/c/34_wait.h 1.1 644)
> > +++ 5-rc2.1(w)/include/linux/wait.h Mon, 29 Mar 2004 15:36:39 +1000 kaos (linux-2.6/m/c/34_wait.h 1.1 644)
> > @@ -40,6 +40,7 @@ typedef struct __wait_queue_head wait_qu
> > */
> >
> > #define __WAITQUEUE_INITIALIZER(name, tsk) { \
> > + .flags = 0, \
> > .task = tsk, \
> > .func = default_wake_function, \
> > .task_list = { NULL, NULL } }
>
> The compiler will do this for us?

Yes, but only for statics (I believe).

--
Tomas Szepe <[email protected]>