Bug 7859 - fatal trap 12 in midi_synth_input
Summary: fatal trap 12 in midi_synth_input
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: i386 (show other bugs)
Version: 2.2.7-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Luigi Rizzo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1998-09-08 09:10 UTC by M.Indlekofer
Modified: 2001-02-11 22:57 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description M.Indlekofer 1998-09-08 09:10:00 UTC
* MIDI-keyboard connected to MIDI-In of SB16-Card
  sb0 at 0x220 irq 5 drq 1 on isa
  sb0: <SoundBlaster 16 4.16>
  sbvxi0 at 0x0 drq 5 on isa
  sbvxi0: <SoundBlaster 16 4.16>
  sbmidi0 at 0x330 on isa
       <SoundBlaster MPU-401>
  opl0 at 0x388 on isa
  opl0: <Yamaha OPL3 FM>

* as non-root: "od /dev/music | less"
* press any key on keyboard
=> immediately fatal trap 12

Fatal trap 12: page fault while in kernel mode
fault virtual address = 0x8c
fault code            = supervisor read, page not present
instruction pointer   = 0x8: 0xf01dd8c5
stack pointer         = 0x10:0xf01f6f80
frame pointer         = 0x10:0xf01f6f88
code segment          = base rx0, limit 0xfffff, type 0x1b
                      = DPL0, pres 1, def32 1, gran 1
processor eflags      = interrupt enabled, resume, IOPL=0
current process       = idle
interrupt mask        =
panic: page fault

Fix: 

gdb -k kernel vmcrash.0 shows:
page fault appears in i386/isa/sound/midi_synth.c: midi_synth_input
line 164 "switch (inc->mstate) {...}"
&(inc->mstate) == 0x8c !!!
0x8c == 0x78 (offset &(inc->in_info) to &inc) + 0x14 (offset mstate)
therefore &(midi_devs[orig_dev]) must be NULL!!

Explanation: the argument dev to midi_synth_input is already an index
             to midi_devs as can be seen in sb16_midi.c and gus_midi.c
             where this interrupt handler is called with mydev!
             (in my case dev==0 and midi2synth provided orig_dev==1
              which is the wrong index for midi_devs)

How to fix the problem: rename the parameter dev of midi_synth_input
                        to orig_dev and remove line 161 in midi_synth.c

If this was the solution midi2synth would be superfluous.

Thanks,
Michael
How-To-Repeat: you only need to open and read /dev/music and any incoming MIDI-event
causes the crash
(note that /dev/sequencer works well)
Comment 1 Nick Hibma freebsd_committer freebsd_triage 1999-07-20 10:45:28 UTC
Responsible Changed
From-To: freebsd-bugs->luigi

Let's shove it onto someone's plate and I think Luigi is hungry. 

Comment 2 Alexander Langer 1999-11-21 14:08:19 UTC
What about this? Does it work on recent -stable/-current releases now?
Did you try the new pcm driver? (does pcm do midi?)

Alex
Comment 3 Luigi Rizzo freebsd_committer freebsd_triage 2001-02-11 22:56:37 UTC
State Changed
From-To: open->closed

the driver generating this problem is not in use in any 
current release of the system.