Skip to contentSkip to conversation

Call of tty->driver.write provides segmentation fault

DISCUSSION Laurent Hugé 2 participants 5 messages Sep 4, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

I'm currently contriving a network driver using the serial port. I've created my own line discipline (and tests prove it reads well), but I can't write to the port : I tried to use tty->driver.write(tty, 0, msg, strlen(msg)) (the same way that in printk.c, i.e. after testing that tty->driver.write exists) but it crashs into a segmentation fault. Since the driver implementation is not mine (I'm just using the serial module), I can't check the function's address, but I believe the tty is ok (it is the same I use for the line discipline).

Does anyone know in which way I can search a solution ? Thanks,

Signature · 1 line
Laurent Hugé.
#1 lore raw
Quoted 8 lines · Laurent Hugé

I'm currently contriving a network driver using the serial port. I've created my own line discipline (and tests prove it reads well), but I can't write to the port : I tried to use tty->driver.write(tty, 0, msg, strlen(msg)) (the same way that in printk.c, i.e. after testing that tty->driver.write exists) but it crashs into a segmentation fault. Since the driver implementation is not mine (I'm just using the serial module), I can't check the function's address, but I believe the tty is ok (it is the same I use for the line discipline).

You need to look at the kernel messages - normally you'll find an "oops" in there when this happens. If the dump doesn't contain symbolic information (ie, the function names) you'll need to pass it though ksymoops to decode it (using the correct System.map file for the kernel which generated the dump.)

If you do use ksymoops, be sure to include the original oops dump - ksymoops appears to drop some lines from the oops dump.

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#2 lore raw
Quoted 2 lines · Russell King

You need to look at the kernel messages - normally you'll find an "oops" in there when this happens.

There's no Oops ; I've only got a segmentation fault, but the kernel doesn't crash.

Signature · 1 line
Laurent Hugé.
#3 lore raw
Quoted 5 lines · Laurent Hugé
Quoted 2 lines · Russell King

You need to look at the kernel messages - normally you'll find an "oops" in there when this happens.

There's no Oops ; I've only got a segmentation fault, but the kernel doesn't crash.

If that's the case, I can't help you. If the kernel isn't oopsing, then it isn't the call to tty->driver.write which is causing your problem - it must be an error in the userspace program.

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#4 lore raw
Quoted 3 lines · Russell King

If that's the case, I can't help you. If the kernel isn't oopsing, then it isn't the call to tty->driver.write which is causing your problem - it must be an error in the userspace program.

Ok, at least, I learned one thing !
Eventually, I've found a workaround ; I've been taught that I can write directly at the serial port address (I tought it wasn't permitted by the serial module), so that's what I do since I've got to send only one caracter (sort of acknowledge).
Now I'm trying to find out why the tcsetattr of my termios configuration fails (the thing work at 9600 bauds but not at 115200).
Thanks,

Signature · 1 line
Laurent Hugé.