lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240308141311.03eefef1@gandalf.local.home>
Date: Fri, 8 Mar 2024 14:13:11 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Cc: Masami Hiramatsu <mhiramat@...nel.org>, Mark Rutland
 <mark.rutland@....com>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
 Andrew Morton <akpm@...ux-foundation.org>, Linus Torvalds
 <torvalds@...ux-foundation.org>, joel@...lfernandes.org, linke li
 <lilinke99@...com>, Rabin Vincent <rabin@....in>, stable@...r.kernel.org
Subject: Re: [PATCH 4/6] tracing: Fix waking up tracing readers

On Fri, 08 Mar 2024 13:38:20 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:

> +static DEFINE_MUTEX(wait_mutex);
> +
> +static bool wait_woken_prepare(struct trace_iterator *iter, int *wait_index)
> +{
> +	bool woken = false;
> +
> +	mutex_lock(&wait_mutex);
> +	if (iter->waking)
> +		woken = true;
> +	*wait_index = iter->wait_index;
> +	mutex_unlock(&wait_mutex);
> +
> +	return woken;
> +}

The last patch adds this code after a prepare_to_wait(), which triggered
the warning:

  do not call blocking ops when !TASK_RUNNING; state=1 set at [<00000000797e3e20>] prepare_to_wait+0x48/0xf0

Which is correct. The prepare_to_wait() set task state to
TASK_INTERRUPTIBLE, so I can not call a mutex after that.

I'll send a v2 where I switch this over to spin locks.

-- Steve


> +
> +static bool wait_woken_check(struct trace_iterator *iter, int *wait_index)
> +{
> +	bool woken = false;
> +
> +	mutex_lock(&wait_mutex);
> +	if (iter->waking || *wait_index != iter->wait_index)
> +		woken = true;
> +	mutex_unlock(&wait_mutex);
> +
> +	return woken;
> +}
> +
> +static void wait_woken_set(struct trace_iterator *iter)
> +{
> +	mutex_lock(&wait_mutex);
> +	iter->waking++;
> +	iter->wait_index++;
> +	mutex_unlock(&wait_mutex);
> +}
> +
> +static void wait_woken_clear(struct trace_iterator *iter)
> +{
> +	mutex_lock(&wait_mutex);
> +	iter->waking--;
> +	mutex_unlock(&wait_mutex);
> +}
> +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ