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] [day] [month] [year] [list]
Message-ID: <35454.58.169.129.127.1231667354.squirrel@secure.greenhost.nl>
Date:	Sun, 11 Jan 2009 10:49:14 +0100 (CET)
From:	"Indan Zupancic" <indan@....nu>
To:	"Steven Rostedt" <srostedt@...hat.com>
Cc:	"Ingo Molnar" <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Fix race in ring_buffer_consume(): Replace 
     ring_buffer_consume and ring_buffer_peek with ring_buffer_get_event

On Mon, January 5, 2009 16:09, Steven Rostedt wrote:
> I just hate public functions that have flags that can get confusing.
> Looking at code where I see:
>
> 	ring_buffer_get_event(buffer, cpu, ts, 0);
>
> I find it hard to know if the ",0" is correct or should be a ",1"
> instead.

That's what I didn't like about the original patch either.
Sent a new patch against tip doing the above, as well as doing
the same for rb_iter_peek (ignore the first one, see try 2).

Slightly different topic, there are quite a few unused functions,
e.g. ring_buffer_read_page(). Should those be removed until they
are actually used, or are there things in the pipeline that will
use them?

I'm not sure if rb_event_length() is safe as it is, returning -1
for RINGBUF_TYPE_PADDING, for an unsigned return value. That
easily overflows into a low value in e.g. rb_advance_iter().
Wouldn't it be better to return the maximum possible size?

rb_advance_reader() calls rb_get_reader_page() and rb_reader_event(),
but rb_get_event(), which is the only caller of rb_advance_reader,
does that as well, which seems a bit more of the same.

Further, rb_get_reader_page() takes cpu_buffer->lock, but all callers
of rb_get_event() take the cpu_buffer->reader_lock. As rb_get_event()
always calls rb_get_reader_page(), both locks will be taken for each
of those calls. Doesn't that make the cpu_buffer->lock redundant?
Getting rid of it and moving the locking into rb_get_event() would
simplify things (except that ring_buffer_read_page() is a bit funny).

Greetings,

Indan


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ