9front - general discussion about 9front
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9front@9front.org
Subject: Re: [9front] prep divide by zero and kernel panic in devfs
Date: Fri, 21 Mar 2014 18:37:07 +0100	[thread overview]
Message-ID: <27c060f21b9d7ac0f85a08db9def1a98@felloff.net> (raw)
In-Reply-To: <20140321065058.GB3145@iota.offblast.org>

the kernel crash is a off by one bug in error handling codepath
when it tries to clean up state before erroring out:

--- a/sys/src/9/port/devfs.c	Fri Mar 21 16:55:16 2014 +0100
+++ b/sys/src/9/port/devfs.c	Fri Mar 21 18:10:55 2014 +0100
@@ -646,7 +646,7 @@
 Fail:
 		for(i = 1; i < cb->nf; i++)
 			if(idev != nil && idev[i-1] != nil)
-				cclose(idev[i]);
+				cclose(idev[i-1]);
 		if(mp != nil)
 			mdeldev(mp);
 		free(idev);

this has nothing todo with sparsefiles. a sparsefile is a
optimization of the filesystem. it just avoids allocating blocks
containing all zeros, thats all.

you want to use partfs. see the test.disk target in /sys/src/boot/pc/mkfile
devfs is bad because then you need to be hostowner on the machine
and you are manipulating global state to solve a local problem.

--
cinap


      reply	other threads:[~2014-03-21 17:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-21  6:50 Nick Owens
2014-03-21 17:37 ` cinap_lenrek [this message]

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=27c060f21b9d7ac0f85a08db9def1a98@felloff.net \
    --to=cinap_lenrek@felloff.net \
    --cc=9front@9front.org \
    /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).