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]
Date:	Sat, 29 May 2010 15:09:01 +0100
From:	Jamie Lokier <jamie@...reable.org>
To:	Changli Gao <xiaosuo@...il.com>
Cc:	Miklos Szeredi <miklos@...redi.hu>, axboe@...nel.dk,
	viro@...iv.linux.org.uk, mszeredi@...e.cz,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/4] splice: fix updating sd->pos wrongly

Changli Gao wrote:
> On Fri, May 28, 2010 at 6:13 PM, Miklos Szeredi <miklos@...redi.hu> wrote:
> > On Fri, 28 May 2010, Changli Gao wrote:
> >> On Fri, May 28, 2010 at 5:42 PM, Miklos Szeredi <miklos@...redi.hu> wrote:
> >> > On Wed, 26 May 2010, Changli Gao wrote:
> >> >> fix updating sd->pos wrongly.
> >> >>
> >> >> In error path, we don't need to updating sd->pos, if the file isn't seekable.
> >> >
> >> > This patch is nonsense.  Why should we handle sd->pos != 0 case
> >> > differently?
> >> >
> >>
> >> If the in file isn't seekable, its splice_read won't update *ppos, so
> >> in the error path, we'd better not change it too. Otherwise, some
> >> assumption will go wrong.
> >
> > That may be true, but the patch is still nonsense.
> >
> > Look, your patch is updating/not updating sd->pos based on whether it
> > is zero or not.  It will prevent updating the position for sockets,
> > but it will also prevent updating the position for regular files if
> > the position is zero, which is really not what we want.
> 
> I think you misread my patch. Before checking the sd->pos, sd->pos
> already is updated with the value returned by splice_read(), so if in
> file is seekabble, sd->pos is non-zero when I checking it.

Not true if the "file" is /dev/mem or /dev/kmem.  The starting offset
can be negative, so can end at zero.

It's an obscure case and I don't know if you can sendfile from
/dev/{,k}mem anyway :-) but illustrates why sd->pos != 0 is dubious.

-- Jamie
--
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