Re: bsd.upgrade uvm_fault

"Theo de Raadt" <[email protected]>
Newsgroups gmane.os.openbsd.bugs
Message-ID <[email protected]>
The problem is that sendsyslog has code sequences to send text to the
console, and chooses which one to use based upon an incorrect condition.

In this case, the console has been found on a chip at an address. The
console is is available for some interactions.  But the real driver
never attached at that location.

So along comes sendsyslog with the two io path choices:

                if (constty || cn_devvp) {
                        error = cnwrite(0, &auio, 0);
			...
                } else {
		       ...
                                        cnputc(kbuf[i]);
			...
                }


The first choice requires there to be a proper underlying device, because
cnwrite derefernces the cdevsw[] and other things.

The second codepath uses cnputc() which can reach deep inside the driver
without assuming it is a tty.

As seen above, the conditional which decides which codepath to use is this:

                if (constty || cn_devvp) {

The idea is if we know the console isn't on a REAL DEVICE we'll use the
cnputc() method.  But this check is wrong.  The console code sets up
either of those two.  We need to the condition that will force these
console-not-on-a-device to the cnputc() codepath.

It should definately not be some condition tested with ||.

I prefer to not modify the situation so that cnwrite() becomes "silent"
by avoiding the (*cdevsw[major(dev)].d_write)() call.  This code should
not be calling cnwrite() because it recognizes use of the other path.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.