mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Wayne Scott <wscott@bitmover.com>, Andrew Morton <akpm@osdl.org>,
	Linus Torvalds <torvalds@osdl.org>,
	elenstev@mesatop.com, lm@bitmover.com,
	William Lee Irwin III <wli@holomorphy.com>,
	hugh@veritas.com, adi@bitmover.com, scole@lanl.gov,
	support@bitmover.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: 1352 NUL bytes at the end of a page?
Date: Mon, 17 May 2004 09:23:01 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0405170919590.19557@bigblue.dev.mdolabs.com> (raw)
In-Reply-To: <20040517151738.GA4730@thunk.org>

On Mon, 17 May 2004, Theodore Ts'o wrote:

> On Mon, May 17, 2004 at 08:56:40AM -0500, Wayne Scott wrote:
> > From: Andrew Morton <akpm@osdl.org>
> > > Well we can stop right there, because the only way someone can get some
> > > more non-zero user data into this page before we memset and write it is by
> > > locking the page beforehand, and block_write_full_page() has the page lock.
> > > (Or they can write stuff into it via mmap, but writing to the page outside
> > > i_size is an application bug).
> > 
> > BTW: BitKeeper never opens a writable mmap to a file.  The files are
> > read with mmap() and written by fwriting to a tmp file and then
> > renaming over the target.  And since we run on Windows, no process has
> > the file open when we are updating it.
> 
> Note though that the stdio library uses a writeable mmap to implement
> fwrite.

Strange, it uses read/write but it also opens an mmap(private and 
anonymous):


#include <stdio.h>

int main(int ac, char **av) {
	size_t rd;
	FILE *fp;
	static char buf[1024 * 64];

	fp = fopen(av[1], "r+");
	rd = fread(buf, 1, sizeof(buf), fp);
	fseek(fp, 0, SEEK_SET);
	fwrite(buf, 1, rd, fp);
	fflush(fp);
	fclose(fp);

	return 0;
}


[davide@bigblue davide]$ strace ./foo zzzzzzzzzzzzzzzzzzz
execve("./foo", ["./foo", "zzzzzzzzzzzzzzzzzzz"], [/* 30 vars */]) = 0
uname({sys="Linux", node="bigblue.dev.mdolabs.com", ...}) = 0
brk(0)                                  = 0x9cc8000
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or 
directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=84014, ...}) = 0
old_mmap(NULL, 84014, PROT_READ, MAP_PRIVATE, 3, 0) = 0xbf50b000
close(3)                                = 0
open("/lib/tls/libc.so.6", O_RDONLY)    = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`\350\270"..., 
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1578228, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0xbf50a000
old_mmap(0xb79000, 1281996, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 
0xb79000
old_mmap(0xcac000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
0x132000) = 0xcac000
old_mmap(0xcb0000, 8140, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xcb0000
close(3)                                = 0
set_thread_area({entry_number:-1 -> 6, base_addr:0xbf50a740, 
limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, 
limit_in_pages:1, seg_not_present:0, useable:1}) = 0
munmap(0xbf50b000, 84014)               = 0
brk(0)                                  = 0x9cc8000
brk(0x9ce9000)                          = 0x9ce9000
brk(0)                                  = 0x9ce9000
open("zzzzzzzzzzzzzzzzzzz", O_RDWR)     = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=188307, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0xbf51f000
read(3, "<!DOCTYPE HTML PUBLIC \"-//IETF//"..., 65536) = 65536
_llseek(3, 0, [0], SEEK_SET)            = 0
write(3, "<!DOCTYPE HTML PUBLIC \"-//IETF//"..., 65536) = 65536
close(3)                                = 0
munmap(0xbf51f000, 4096)                = 0
exit_group(0)



- Davide


  parent reply	other threads:[~2004-05-17 16:23 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200405122234.06902.elenstev@mesatop.com>
     [not found] ` <15594C37-A509-11D8-A7EA-000A95CC3A8A@lanl.gov>
     [not found]   ` <20040513183316.GE17965@bitmover.com>
     [not found]     ` <200405131723.15752.elenstev@mesatop.com>
     [not found]       ` <6616858C-A5AF-11D8-A7EA-000A95CC3A8A@lanl.gov>
     [not found]         ` <20040514144617.GE20197@work.bitmover.com>
2004-05-14  4:32           ` Steven Cole
2004-05-14 16:53             ` 1352 NUL bytes at the end of a page? (was Re: Assertion `s && s->tree' failed: The saga continues.) Andy Isaacson
2004-05-14 17:23               ` Steven Cole
2004-05-15  0:54               ` Steven Cole
2004-05-15  1:55                 ` 1352 NUL bytes at the end of a page? Wayne Scott
2004-05-15  3:15               ` 1352 NUL bytes at the end of a page? (was Re: Assertion `s && s->tree' failed: The saga continues.) Lincoln Dale
2004-05-15  3:41                 ` Andrew Morton
2004-05-15  5:39                   ` Steven Cole
2004-05-16  1:23                   ` Steven Cole
2004-05-16  2:18                     ` Linus Torvalds
2004-05-16  3:44                       ` Linus Torvalds
2004-05-16  4:31                         ` Steven Cole
2004-05-16  4:52                           ` Linus Torvalds
2004-05-16  5:22                             ` Andrea Arcangeli
2004-05-16 15:28                               ` Steven Cole
2004-05-16 17:49                                 ` Rutger Nijlunsing
2004-05-16 20:38                                 ` Andrea Arcangeli
2004-05-16 21:19                                   ` Steven Cole
2004-05-16 21:29                                     ` Andrew Morton
2004-05-16 22:11                                       ` Steven Cole
2004-05-16 23:53                                         ` Andrea Arcangeli
2004-05-17  2:12                                           ` Steven Cole
2004-05-17  8:21                                         ` R. J. Wysocki
2004-05-16  5:54                             ` Steven Cole
2004-05-16  6:09                               ` Andrew Morton
2004-05-16  6:24                                 ` Andrew Morton
2004-05-16 10:01                           ` Andrew Morton
2004-05-16 13:49                             ` Steven Cole
2004-05-18  1:47                       ` Benjamin Herrenschmidt
2004-05-16  3:20                     ` Andrew Morton
2004-05-16  3:58                       ` Linus Torvalds
2004-05-17  2:28                     ` Larry McVoy
2004-05-17  2:42                       ` Linus Torvalds
2004-05-17  3:36                         ` Steven Cole
2004-05-17  5:17                           ` Linus Torvalds
2004-05-17  6:11                             ` Andrew Morton
2004-05-17 13:56                               ` 1352 NUL bytes at the end of a page? Wayne Scott
2004-05-17 15:17                                 ` Theodore Ts'o
2004-05-17 15:20                                   ` Larry McVoy
2004-05-17 15:22                                   ` Linus Torvalds
2004-05-17 15:25                                     ` Larry McVoy
2004-05-17 15:37                                     ` viro
2004-05-17 17:30                                       ` Steven Cole
2004-05-17 17:40                                         ` viro
2004-05-17 17:39                                           ` Steven Cole
2004-05-17 19:06                                             ` viro
2004-05-17 15:40                                     ` Arjan van de Ven
2004-05-17 15:53                                       ` Steven Cole
2004-05-17 16:23                                   ` Davide Libenzi [this message]
2004-05-17 16:28                                     ` Davide Libenzi
2004-05-17 14:07                               ` 1352 NUL bytes at the end of a page? (was Re: Assertion `s && s->tree' failed: The saga continues.) Larry McVoy
2004-05-17 14:12                               ` Linus Torvalds
2004-05-17  7:25                             ` Andrew Morton
2004-05-17  7:46                               ` Andrew Morton
2004-05-17  8:39                                 ` Vladimir Saveliev
2004-05-17  8:44                                   ` Andrew Morton
2004-05-17 11:58                                 ` Steven Cole
2004-05-17 14:05                               ` Larry McVoy
2004-05-17 14:14                             ` Larry McVoy
2004-05-17 14:32                               ` Linus Torvalds
2004-05-17 14:52                                 ` Larry McVoy
2004-05-17 15:02                                   ` Linus Torvalds
2004-05-17 15:05                                     ` Larry McVoy
2004-05-17 15:23                                     ` Chris Mason
2004-05-17 15:49                                       ` Steven Cole
2004-05-17 20:24                                       ` Chris Mason
2004-05-17 21:08                                         ` Steven Cole
2004-05-17 21:29                                           ` Andrew Morton
2004-05-17 22:15                                             ` Steven Cole
2004-05-17 23:52                                             ` Steven Cole
2004-05-18  0:03                                               ` Chris Mason
2004-05-18  0:15                                                 ` Andrew Morton
2004-05-18  0:13                                               ` Andrew Morton
2004-05-18  0:45                                                 ` Steven Cole
2004-05-18  1:34                                                 ` Larry McVoy
2004-05-18  1:42                                                   ` Andrew Morton
2004-05-18  1:56                                                     ` Steven Cole
2004-05-17 14:11                         ` Larry McVoy
     [not found]             ` <200405172142.52780.elenstev@mesatop.com>
     [not found]               ` <Pine.LNX.4.58.0405172056480.25502@ppc970.osdl.org>
     [not found]                 ` <200405172319.38853.elenstev@mesatop.com>
2004-05-18 12:42                   ` Chris Mason
2004-05-18 14:29                     ` Steven Cole
2004-05-18 14:38                   ` Linus Torvalds
2004-05-19 10:53                     ` Steven Cole
2004-05-19 12:10                       ` Chris Mason
2004-05-19 12:20                         ` 1352 NUL bytes at the end of a page? Wayne Scott
2004-05-19 12:42                           ` Nick Piggin
2004-05-19 13:28                             ` Steven Cole
2004-05-19 13:36                               ` Chris Mason
2004-05-19 13:59                                 ` Steven Cole
2004-05-19 14:03                                   ` Wayne Scott
2004-05-19 14:08                                   ` Chris Mason
2004-05-19 14:20                                     ` Steven Cole
2004-05-19 14:45                                     ` Steven Cole
2004-05-19 21:11                                     ` Non-regression for current kernel (was Re: 1352 NUL bytes at the end of a page?) Steven Cole
2004-05-13 19:08 1352 NUL bytes at the end of a page? Andy Isaacson
2004-05-14  2:22 ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0405170919590.19557@bigblue.dev.mdolabs.com \
    --to=davidel@xmailserver.org \
    --cc=adi@bitmover.com \
    --cc=akpm@osdl.org \
    --cc=elenstev@mesatop.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm@bitmover.com \
    --cc=scole@lanl.gov \
    --cc=support@bitmover.com \
    --cc=torvalds@osdl.org \
    --cc=tytso@mit.edu \
    --cc=wli@holomorphy.com \
    --cc=wscott@bitmover.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®