| Summary: | [MFC] kernel panic when asking help in visual userconfig | ||
|---|---|---|---|
| Product: | Base System | Reporter: | mavetju@chello.nl <Edwin.Groothuis> |
| Component: | kern | Assignee: | dwmalone |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 3.4-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
Responsible Changed From-To: freebsd-bugs->dwmalone I committed a version of this patch to -current. State Changed From-To: open->closed Commited to -current and RELENG_4. |
When in the visual user configuration and I ask for help and press space several times to get aa the bottom, at the last time space is entered the kernel will stop with a kernel-panic. This is a fix to kern/14394 Fix: The problem is when you are at the end of the help (i.e. helptext[line]=NULL) and getchar() is being called. At that moment delta=0. If you press space for the next page, the delta nor topline are changed because helptext[line]==NULL. Back at the top of the for(;;)-loop, delta is stil 0 (was not changed), line is set to 0, the if (delta) failes (so line is still 0), getchar() is ran, space is pressed, helptext[line] is checked and found valid, topline is increased, delta is set and back the helptext is displayed again with an invalid value of topline for helptext. In /sys/i386/i386/userconfig.c: static void helpscreen(void) { int topline = 0; /* where we are in the text */ int c, delta = 1; char prompt[80]; + int line = 0; for (;;) /* loop until user quits */ { - int line = 0; /* display help text */ if (delta) { clear(); /* remove everything else */ for (line = topline; (line < (topline + 24)) && (helptext[line]); Perhaps there is a more elegant solution with working with topline instead of line at the checking for space, but this one works. How-To-Repeat: Reset your computer. Enter "boot user_config" Enter "visual" Enter "?" for help Press space a couple of times Computer will hang with a kernel panic