[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <71c74711-75d6-494e-6ff7-2be49b274477@colorfullife.com>
Date: Sat, 8 May 2021 21:23:45 +0200
From: Manfred Spraul <manfred@...orfullife.com>
To: Varad Gautam <varad.gautam@...e.com>, linux-kernel@...r.kernel.org
Cc: Matthias von Faber <matthias.vonfaber@...-tech.de>,
Davidlohr Bueso <dbueso@...e.de>, stable@...r.kernel.org,
Christian Brauner <christian.brauner@...ntu.com>,
Oleg Nesterov <oleg@...hat.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Andrew Morton <akpm@...ux-foundation.org>,
James Morris <jamorris@...ux.microsoft.com>,
Serge Hallyn <serge@...lyn.com>
Subject: Re: [PATCH v3] ipc/mqueue: Avoid relying on a stack reference past
its expiry
Hi Varad,
On 5/7/21 3:38 PM, Varad Gautam wrote:
> @@ -1005,11 +1022,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
First, I was too fast: I had assumed that wake_q_add() before
smp_store_release() would be a potential lost wakeup.
As __pipelined_op() is called within spin_lock(&info->lock), and as
wq_sleep() will reread this->state after acquiring
spin_lock(&info->lock), I do not see a bug anymore.
But I don't like the change: Why should ipc/*.c differ from kernel/futex.c?
--
Manfred
Powered by blists - more mailing lists