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: <1182350817.30702.112.camel@ubuntu>
Date:	Wed, 20 Jun 2007 09:46:57 -0500
From:	Tom Zanussi <zanussi@...ibm.com>
To:	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc:	David Wilder <dwilder@...ibm.com>, linux-kernel@...r.kernel.org,
	systemtap@...rces.redhat.com,
	Yumiko Sugita <yumiko.sugita.yf@...achi.com>,
	Satoshi Oshima <soshima@...hat.com>,
	Hideo Aoki <haoki@...hat.com>
Subject: Re: [PATCH] relay-file-read-start-pos-fix.patch

On Wed, 2007-06-20 at 17:31 +0900, Masami Hiramatsu wrote:

[...]

> P.S.
> I attached my patch (relay-file-read-overwrite-mode-fix.patch)
> which fixed the problem pointed in previous mail.
> 
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
> 

Hi,

Thanks for sending the test case.  I wrote my own program that tests for
the same thing, and it also works fine.  To make sure it doesn't break
no-overwrite mode, I also ran several tests with blktrace and that looks
good too.

Thanks very much for analyzing the problem and providing the patch!

Just to summarize - the problem this fixes is that in overwrite mode,
the current read code doesn't pick up all the data it could if the whole
buffer is filled - it will leave behind sub-buffers at the beginning.
With this patch, the data in those sub-buffers is read as well.

Acked-by: Tom Zanussi <zanussi@...ibm.com>

> ---
>  kernel/relay.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6.22-rc4-mm2/kernel/relay.c
> ===================================================================
> --- linux-2.6.22-rc4-mm2.orig/kernel/relay.c	2007-06-13 20:22:02.000000000 +0900
> +++ linux-2.6.22-rc4-mm2/kernel/relay.c	2007-06-20 10:53:06.000000000 +0900
> @@ -812,7 +812,10 @@
>  	}
> 
>  	buf->bytes_consumed += bytes_consumed;
> -	read_subbuf = read_pos / buf->chan->subbuf_size;
> +	if (!read_pos)
> +		read_subbuf = buf->subbufs_consumed % n_subbufs;
> +	else
> +		read_subbuf = read_pos / buf->chan->subbuf_size;
>  	if (buf->bytes_consumed + buf->padding[read_subbuf] == subbuf_size) {
>  		if ((read_subbuf == buf->subbufs_produced % n_subbufs) &&
>  		    (buf->offset == subbuf_size))
> @@ -841,8 +844,9 @@
>  	}
> 
>  	if (unlikely(produced - consumed >= n_subbufs)) {
> -		consumed = (produced / n_subbufs) * n_subbufs;
> +		consumed = produced - n_subbufs + 1;
>  		buf->subbufs_consumed = consumed;
> +		buf->bytes_consumed = 0;
>  	}
>  	
>  	produced = (produced % n_subbufs) * subbuf_size + buf->offset;
> 
> 
> 
> 


-
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