9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: forsyth@plan9.cs.york.ac.uk forsyth@plan9.cs.york.ac.uk
Subject: change to /sys/src/9/pc/bbmalloc.c
Date: Sun,  5 Nov 1995 10:56:36 -0500	[thread overview]
Message-ID: <19951105155636.G-91BzkhNZwSTql5EFTbo15c_aiDMnroNAu0tr7CloI@z> (raw)

vortex% diff $home/cd/9/pc/bbmalloc.c .
82c82
< 	return 0;
---
> 	return u!=0;
88d87
< 	USED(len, onstack);
89a89,90
> 	if(!onstack)
> 		bbfree(memstart, len);

the key part is the bbfree; the onstack changes simply make
use when possible of an array that's allocated on the stack anyhow.
mind you, that also helps to avoid the underlying problem.

which is:

without the bbfree, bbmalloc returns blocks of Progmax bytes
from each of two 16k arenas in a strictly circular fashion.
the problem arises when a process doing a bitblt is suspended
during the bitblt, and another process (or an interrupt, on the pc)
also does one or more bitblts before the original bitblt is resumed.
i added some counters here and there to find that in practice there
were only ever 2 processes active in the bbmalloc arena[0] at any one
time, but that was enough, since one of them did enough bitblts
(and thus bbmallocs) to cause the 3k allocation to cycle round the arena,
eventually overwriting the first process's bitblt code.

	Weinberl: Well, a little forward.
	Mrs Fischer: A little?  You're in danger of meeting yourself coming back.
		``On the Razzle'', Tom Stoppard.

on the PC, because mousescreenupdate() enables interrupts during vgaupdate,
it's possible for cursor movements to be done using bbmalloc allocations
out of arena[0], which explains why messing about with the cursor in
a scroll bar was the easiest way to crash the system.







                 reply	other threads:[~1995-11-05 15:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=19951105155636.G-91BzkhNZwSTql5EFTbo15c_aiDMnroNAu0tr7CloI@z \
    --to=forsyth@plan9.cs.york.ac.uk \
    /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).