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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240213155309.01c7c2b2@gandalf.local.home>
Date: Tue, 13 Feb 2024 15:53:09 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Vincent Donnefort <vdonnefort@...gle.com>
Cc: mhiramat@...nel.org, linux-kernel@...r.kernel.org,
 linux-trace-kernel@...r.kernel.org, mathieu.desnoyers@...icios.com,
 kernel-team@...roid.com
Subject: Re: [PATCH v17 2/6] ring-buffer: Introducing ring-buffer mapping
 functions

On Tue, 13 Feb 2024 11:49:41 +0000
Vincent Donnefort <vdonnefort@...gle.com> wrote:

Did you test with lockdep?

> +static int __rb_inc_dec_mapped(struct trace_buffer *buffer,
> +			       struct ring_buffer_per_cpu *cpu_buffer,
> +			       bool inc)
> +{
> +	unsigned long flags;
> +
> +	lockdep_assert_held(cpu_buffer->mapping_lock);

/work/git/linux-trace.git/kernel/trace/ring_buffer.c: In function ‘__rb_inc_dec_mapped’:
/work/git/linux-trace.git/include/linux/lockdep.h:234:61: error: invalid type argument of ‘->’ (have ‘struct mutex’)
  234 | #define lockdep_is_held(lock)           lock_is_held(&(lock)->dep_map)
      |                                                             ^~
/work/git/linux-trace.git/include/asm-generic/bug.h:123:32: note: in definition of macro ‘WARN_ON’
  123 |         int __ret_warn_on = !!(condition);                              \
      |                                ^~~~~~~~~
/work/git/linux-trace.git/include/linux/lockdep.h:267:9: note: in expansion of macro ‘lockdep_assert’
  267 |         lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
      |         ^~~~~~~~~~~~~~
/work/git/linux-trace.git/include/linux/lockdep.h:267:24: note: in expansion of macro ‘lockdep_is_held’
  267 |         lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
      |                        ^~~~~~~~~~~~~~~
/work/git/linux-trace.git/kernel/trace/ring_buffer.c:6167:9: note: in expansion of macro ‘lockdep_assert_held’
 6167 |         lockdep_assert_held(cpu_buffer->mapping_lock);
      |         ^~~~~~~~~~~~~~~~~~~

I believe that is supposed to be:

	lockdep_assert_held(&cpu_buffer->mapping_lock);

-- Steve

> +
> +	if (inc && cpu_buffer->mapped == UINT_MAX)
> +		return -EBUSY;
> +
> +	if (WARN_ON(!inc && cpu_buffer->mapped == 0))
> +		return -EINVAL;
> +
> +	mutex_lock(&buffer->mutex);
> +	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
> +
> +	if (inc)
> +		cpu_buffer->mapped++;
> +	else
> +		cpu_buffer->mapped--;
> +
> +	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
> +	mutex_unlock(&buffer->mutex);
> +
> +	return 0;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ