linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adam J. Richter" <adam@yggdrasil.com>
To: parsley@roanoke.edu
Cc: linux-kernel@vger.kernel.org, torvalds@transmeta.com
Subject: Patch (repost): cramfs memory corruption fix
Date: Sat, 6 Jan 2001 22:41:09 -0800	[thread overview]
Message-ID: <20010106224109.A1601@adam.yggdrasil.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1568 bytes --]

>From: "David L. Parsley" <parsley@roanoke.edu>
>
>Using root=/dev/ram0 and a cramfs initrd gives me 'wrong magic' when it
>tries to boot.  Even more bizarre, if cramfs is compiled in the kernel
>when I use a romfs root, it says 'wrong magic' then mounts the romfs but
>can't find init.  If I take cramfs out of the kernel, the romfs mounts &
>init runs fine.  I just saw this with ac3.
>
>ramfs croaks with 'kernel BUG in filemap.c line 2559' anytime I make a
>file in ac2 and ac3.  Works fine in 2.4.0 vanilla.  Should be quite
>repeatable...

	This sounds like a bug that I posted a fix for a long time ago.
cramfs calls bforget on the superblock area, destroying that block of
the ramdisk, even when the ramdisk does not contain a cramfs file system.
Normally, bforget is called on block that really can be trashed,
such as blocks release by truncate or unlink.  If it worked for
you before, you were just getting lucky.  Here is the patch.

	Linus, please consider applying this.  Thank you.

	By the way, the other approach to fixing this problem would
be to change bforget not to trash blocks marked with BH_Protected
(I think that is just ramdisk blocks), but that would waste memory,
because we really can release blocks from things like truncating
or unlinking files.

-- 
Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 353 bytes --]

--- /tmp/adam/linux-2.4.0/fs/cramfs/inode.c	Fri Dec 29 14:07:57 2000
+++ linux/fs/cramfs/inode.c	Sat Dec 30 02:12:06 2000
@@ -138,7 +138,7 @@
 		struct buffer_head * bh = bh_array[i];
 		if (bh) {
 			memcpy(data, bh->b_data, PAGE_CACHE_SIZE);
-			bforget(bh);
+			brelse(bh);
 		} else
 			memset(data, 0, PAGE_CACHE_SIZE);
 		data += PAGE_CACHE_SIZE;

             reply	other threads:[~2001-01-07  6:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-07  6:41 Adam J. Richter [this message]
2001-01-07 13:53 ` Patch (repost): cramfs memory corruption fix Alan Cox
2001-01-07 19:26   ` Linus Torvalds
2001-01-07 19:42     ` Alan Cox
2001-01-07 19:56       ` Linus Torvalds
2001-01-07 21:11         ` Rik van Riel
2001-01-07 21:20           ` Alan Cox
2001-01-08  6:56           ` Eric W. Biederman
2001-01-07 21:54         ` Chris Wedgwood
2001-01-08 13:37         ` Christoph Rohland
2001-01-08 14:19           ` Christoph Hellwig
2001-01-08 14:43             ` Christoph Rohland
2001-01-08 14:42           ` Alan Cox
2001-01-08 14:49             ` Christoph Rohland
2001-01-07 20:39       ` David L. Parsley
2001-01-08 18:27         ` Linus Torvalds
2001-01-08  3:46 ` Linus Torvalds
2001-01-08 13:11   ` David Woodhouse
2001-01-08 12:30     ` Shane Nay
2001-01-08 14:34     ` David Woodhouse
2001-01-10 23:30   ` [PATCH] one-liner fix for bforget() honoring BH_Protected; was: " David L. Parsley
2001-01-11  4:23     ` Linus Torvalds

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=20010106224109.A1601@adam.yggdrasil.com \
    --to=adam@yggdrasil.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=parsley@roanoke.edu \
    --cc=torvalds@transmeta.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;
as well as URLs for NNTP newsgroup(s).