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]
Date:	Thu, 17 Dec 2009 18:49:35 +0000 (GMT)
From:	Hugh Dickins <hugh.dickins@...cali.co.uk>
To:	Rafael Almeida <almeidaraf@...il.com>
cc:	linux-kernel@...r.kernel.org
Subject: Re: On the workings of mmap

On Thu, 17 Dec 2009, Rafael Almeida wrote:

> Hello. I have been studying the mmap function and it seems like when I
> map an sparse file, that the parts of the file that have nothing are
> defined as 0 when I access them through the address space returned by
> mmap. Is that luck or is it defined to be this way? My only source of
> information was debian's manpage on mmap that didn't seem to talk
> about sparse files at all.

That's not luck, it is required to be that way.

Though I've not located such a definition with respect to mmap(),
it would be perverse if mmap() showed you different data there from
what read() shows you, and the Single Unix Specification (Version 3)
says of read():

"If any portion of a regular file prior to the end-of-file has not
 been written, read() shall return bytes with value 0."

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