J-Soft
Now With Sprinkles!!!
Back to Homepage
Web based programs I have written
Info on my web design experience
A bunch of BASIC programs I wrote a while ago. Pong is fun.
Who am I anyway?
My weblog. I wonder if I can keep it up this time?
This is where I will put anything that I feel deserves a more permanent home than a simple blog entry
Webmail for those who have an email address @jsoft.ca
Contacts

Personal: jmalone@jsoft.ca

Anything to do with Reblogger: reblogger@jsoft.ca

Anything to do with Chorus: chorus@jsoft.ca

The IT Resource

Valid XHTML 1.0!

This website created by Jesse Malone
Home Web Apps Web Design Basic
About Me Blog Noteworthy Webmail

J-Soft Blog

Tuesday, July 21, 2009

This issue is no doubt very esoteric, but it caught me, so there must be someone else out there scratching their head about it. This is a problem that plagues the Linux kernel for the avr32 architecture version 2.6.22.atmel.6, and likely other versions. It is caused by a bug in gcc. I do not remember the exact version numbers off the top of my head, but I believe it was avr32-linux-gcc 4.2 which has a bug in it that causes a few problems, one of which is expressed in n_tty.c and causes a kernel oops whenever a character is sent to a pty. In other words, anything you type in a terminal session crashes the machine. Definitely not good! The solution is to patch n_tty.c as described below, or just use an older gcc. What follows is from a posting on the avr32 Linux kernel mailing list.

-----------------------------------------------------
I found what looks like another symptom of this gcc bug in
drivers/char/n_tty.c from kernel 2.6.22.atmel.6. It causes a kernel Oops
when you send a character to a pty (ie. type anything at all in a telnet
session).

Here's the Oops:
---------------------------------------------------------------------- #
Unable to handle kernel NULL pointer dereference at virtual address
00000000
ptbr = 91ceb800 pgd = 11d6bc66 pte = 00000000
Oops: Kernel access of bad area, sig: 11 [#1]
FRAME_POINTER chip: 0x01f:0x1e82 rev 2
Modules linked in:
PC is at n_tty_receive_buf+0xd4/0xb80
LR is at pty_write+0x2a/0x38
pc : [<900c41e0>] lr : [<900c5d36>] Not tainted
sp : 91d8fe2c r12: 914fd000 r11: 914fd800
r10: 00000000 r9 : 00000000 r8 : 00000000
r7 : 91d8febc r6 : 900c410c r5 : 00000001 r4 : 0007f03c
r3 : 914fd000 r2 : 00000001 r1 : 91e5fb40 r0 : 914fd800
Flags: qvnzc
Mode bits: hrje....g
CPU Mode: Supervisor
Process: telnetd [246] (task: 91c6ea80 thread: 91d8e000)
Stack: (0x91d8fe2c to 0x91d90000)
fe20: 914fd800 00000000 00000000 00000001
91d8ff8c fe40: 00000038 00000020 00000000 00000000 00000020 00000000
00000fa0 91fdbc80 fe60: 900102d8 00000000 91d8fe6c 00000000 00000000
91d8ff38 00000001 00000000 fe80: 00000000 00000040 91d8feb0 90042a9c
91d8ff40 900e1ea8 91d0bc80 0007f03c fea0: 91d8feb0 00000000 91d8ff88
91d8e000 0007ffdc 900c5f8e 00000000 900c5d36 fec0: 91d8fee0 900c410c
00000001 0007f03c 00000001 914fd800 91e5fb40 914fd800 fee0: 900c3fa6
91d8ff0c 91c6ea80 91d0cc00 0007f03c 91d8e000 00000000 91c6ea80 ff00:
900162a8 91d0cd20 91d0cd20 900c2184 91d8ff40 00000001 91d0cfa8 0007f03c
ff20: 00000400 91d0cc00 00000001 00000000 0007f03c 91e5fb40 900c3dc6
91d0cc0c ff40: 90042eba 91d8ff64 91e5fb40 0007f03c 0007f03c 91d8ff88
00000000 0007f03c ff60: 91d8e000 90043126 91d8ff94 91e5fb40 00000001
0007f03c 00000000 00000000 ff80: 0007f03c 91d8e000 00000000 00000000
00000000 90010132 00000000 2aafb074 ffa0: 00000001 0007f03c 00000005
0007f03d 80000000 91d8e000 00000001 2aaf616a

---------------------------------------------------------------------

This is resolved by sticking in a call to barrier() as follows:

--- drivers/char/n_tty.c 2008-08-20 14:25:02.000000000 -0400 +++
drivers/char/n_tty-fixed.c 2008-08-20 14:58:01.000000000 -0400 @@ -929,9
+929,10 @@ static void n_tty_receive_buf(struct tty
spin_unlock_irqrestore(&tty->read_lock, cpuflags);
} else {
for (i=count, p = cp, f = fp; i; i--, p++) {
- if (f)
+ if (f) {
+ barrier();
flags = *f++;
-
+ }
switch (flags) {
case TTY_NORMAL:
n_tty_receive_char(tty, *p);


.....or use an older avr32-linux-gcc.



Jesse Malone

-------------------------------------------

The original thread is here: http://www.avr32linux.org/archives/kernel/2008-August/001467.html

posted by Jesse at 3:29 AM #