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:	Wed, 20 Jun 2007 09:22:20 -0700
From:	"Ray Lee" <ray-lk@...rabbit.org>
To:	"Timo Sirainen" <tss@....fi>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: SMP read() stopping at memory page boundaries

On 6/20/07, Timo Sirainen <tss@....fi> wrote:
> On Wed, 2007-06-20 at 17:52 +0300, Timo Sirainen wrote:
> > Sometimes read() returns only 4096 bytes. I'm locking the file, so I
> > don't think this should ever happen, right?

man 2 read

read() is always allowed to return less than you asked for. You need
to go back and ask for the rest. That's why people wrap read() and
write() in loops, and use those wrapped versions instead.

> read() sometimes returns 4096 bytes but with the "1111" already included
> in the data.

Uhm, do you mean 'without the 1111'? 4096 with the 1111 sounds
perfectly fine. (Though 4096 without the 1111 is also perfectly fine.)

> Is there a way to avoid this without locking the file while
> reading? The "1111" tries to act as a kind of a lock.

I think you've misunderstood how read and write work. pread and pwrite
are no different in this respect -- they just allow an atomic
seek+read/write.

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