[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7bf3af5b-26a6-b6df-1b53-c5217ef4a10c@colorfullife.com>
Date: Sat, 8 May 2021 19:21:29 +0200
From: Manfred Spraul <manfred@...orfullife.com>
To: Davidlohr Bueso <dbueso@...e.de>,
Varad Gautam <varad.gautam@...e.com>
Cc: linux-kernel@...r.kernel.org,
Matthias von Faber <matthias.vonfaber@...-tech.de>,
Christian Brauner <christian.brauner@...ntu.com>,
Oleg Nesterov <oleg@...hat.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] ipc/mqueue: Avoid relying on a stack reference past its
expiry
Hi Davidlohr,
On 5/4/21 11:53 PM, Davidlohr Bueso wrote:
> @@ -1005,11 +1023,9 @@ static inline void __pipelined_op(struct
> wake_q_head *wake_q,
> struct ext_wait_queue *this)
> {
> list_del(&this->list);
> - get_task_struct(this->task);
> -
> + wake_q_add(wake_q, this->task);
> /* see MQ_BARRIER for purpose/pairing */
> smp_store_release(&this->state, STATE_READY);
> - wake_q_add_safe(wake_q, this->task);
> }
>
> /* pipelined_send() - send a message directly to the task waiting in
This can result in lost wakeups:
wake_q_add() wakes up this->task, and the tasks reads this->state before
the smp_store_release() writes STATE_READY.
I would really prefer if we make kernel/futex.c and ipc/whatever as
similar as possible:
The futex slow path, ipc/sem.c, ipc/msg.c and ipc/mqueue.c are all the
same, thus the code should be the same as well.
[a task goes to sleep, another wakes it up, the woken up task doesn't
acquire any locks, and the wake_q framework is used]
--
Manfred
Powered by blists - more mailing lists