Emitting an ignore_int() handled interrupt and system response

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi list,

As said by `Understanding linux kernel', all the 255 IDT (Interrupt 
Descriptor Table) entries are initialized in system initialization 
to the handler ignore_int. ignore_int job is to print "Unkown 
interrupt" and return to normal code:

--> arch/i386/kernel/head.S:
int_msg:
	.asciz "Unknown interrupt or fault at EIP %p %p %p\n"
[...]
ignore_int:
[...]
	pushl $int_msg
	call printk 
[...]
	iret

I've created a small module to test above code (having a doubt about 
a line) and I got a BUG and the message above wasn't printed.

Here's the module code:

#include <linux/module.h>
MODULE_LICENSE("GPL");
/* IRQ 25 is reserved as said by Intel documentation, So 
 * vector 25 is handled by ignore_int */
int init(void) { asm("int $25");  return 0;}
module_init(init);

So Is the problem in in my module code ?.

Here's the BUG() - faulty_int is the above module:

Mar 19 00:42:08 localhost kernel: [  395.697490] int3: 0000 [#1]
Mar 19 00:42:08 localhost kernel: [  395.697499] Modules linked in: faulty_int i915 drm cpufreq_stats nls_iso8859_1 nls_cp437 vfat fat arc4 ecb blkcipher ieee80211_crypt_wep usbhid snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm_oss snd_mixer_oss snd_pcm snd_timer serio_raw ipw2100 parport_pc parport ehci_hcd uhci_hcd ieee80211 ieee80211_crypt e100 ohci1394 ieee1394 psmouse rtc pcspkr snd soundcore snd_page_alloc generic usbcore intel_agp agpgart evdev
Mar 19 00:42:08 localhost kernel: [  395.697584] CPU:    0
Mar 19 00:42:08 localhost kernel: [  395.697587] EIP:    0060:[<c03ce23d>]    Not tainted VLI
Mar 19 00:42:08 localhost kernel: [  395.697591] EFLAGS: 00000086   (2.6.21-rc4 #27)
Mar 19 00:42:08 localhost kernel: [  395.697606] EIP is at ignore_int+0x1/0x44
Mar 19 00:42:08 localhost kernel: [  395.697614] eax: e07d9000   ebx: cb613d80   ecx: 00000000   edx: 00000001
Mar 19 00:42:08 localhost kernel: [  395.697624] esi: e07d92c0   edi: e07d3ad0   ebp: e07d92c0   esp: ca23dec4
Mar 19 00:42:08 localhost kernel: [  395.697633] ds: 007b   es: 007b   fs: 00d8  gs: 0033  ss: 0068
Mar 19 00:42:08 localhost kernel: [  395.697643] Process insmod (pid: 3684, ti=ca23c000 task=ce2000b0 task.ti=ca23c000)
Mar 19 00:42:08 localhost kernel: [  395.697650] Stack: e07d9002 00000060 00000286 c013dd93 00000000 00000000 00000000 c05378b8 
Mar 19 00:42:08 localhost kernel: [  395.697670]        00000000 e07d92cc 00000000 0000001c 00000018 0000001c 00000018 e07d3aa8 
Mar 19 00:42:08 localhost kernel: [  395.697688]        e07d37b0 e07d3a80 00000000 d2b60b10 e07d7438 00000018 00000017 00000000 
Mar 19 00:42:08 localhost kernel: [  395.697707] Call Trace:
Mar 19 00:42:08 localhost kernel: [  395.697714]  [<e07d9002>] init_module+0x2/0x10 [faulty_int]
Mar 19 00:42:08 localhost kernel: [  395.697730]  [<c013dd93>] sys_init_module+0x143/0x1590
Mar 19 00:42:08 localhost kernel: [  395.697782]  [<c0103f10>] sysenter_past_esp+0x5d/0x99
Mar 19 00:42:08 localhost kernel: [  395.697805]  =======================
Mar 19 00:42:08 localhost kernel: [  395.697810] Code: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc <cc> cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc 
Mar 19 00:42:08 localhost kernel: [  395.697902] EIP: [<c03ce23d>] ignore_int+0x1/0x44 SS:ESP 0068:ca23dec4
Mar 19 00:42:08 localhost kernel: [  395.697923] BUG: sleeping function called from invalid context at kernel/rwsem.c:20
Mar 19 00:42:08 localhost kernel: [  395.697931] in_atomic():0, irqs_disabled():1
Mar 19 00:42:08 localhost kernel: [  395.697938] no locks held by insmod/3684.
Mar 19 00:42:08 localhost kernel: [  395.697943] irq event stamp: 12668
Mar 19 00:42:08 localhost kernel: [  395.697949] hardirqs last  enabled at (12667): [<c02ed715>] __mutex_unlock_slowpath+0xb5/0x170
Mar 19 00:42:08 localhost kernel: [  395.697965] hardirqs last disabled at (12668): [<c02ef4d5>] _spin_lock_irqsave+0x15/0x50
Mar 19 00:42:08 localhost kernel: [  395.697980] softirqs last  enabled at (12262): [<c0120285>] do_softirq+0x45/0x50
Mar 19 00:42:08 localhost kernel: [  395.697996] softirqs last disabled at (12253): [<c0120285>] do_softirq+0x45/0x50
Mar 19 00:42:08 localhost kernel: [  395.698012]  [<c0131b95>] down_read+0x15/0x50
Mar 19 00:42:08 localhost kernel: [  395.698026]  [<c013174f>] hrtimer_try_to_cancel+0x3f/0xa0
Mar 19 00:42:08 localhost kernel: [  395.698039]  [<c0143b62>] acct_collect+0x32/0x150
Mar 19 00:42:08 localhost kernel: [  395.698052]  [<c011d86c>] do_exit+0xec/0x7d0
Mar 19 00:42:08 localhost kernel: [  395.698065]  [<c0117018>] __wake_up+0x38/0x50
Mar 19 00:42:08 localhost kernel: [  395.698085]  [<c010576b>] die+0x21b/0x220
Mar 19 00:42:08 localhost kernel: [  395.698105]  [<c0105aef>] do_int3+0x6f/0x80
Mar 19 00:42:08 localhost kernel: [  395.698122]  [<c02ef87f>] int3+0x27/0x2c
Mar 19 00:42:08 localhost kernel: [  395.698137]  [<e07d9000>] init_module+0x0/0x10 [faulty_int]
Mar 19 00:42:08 localhost kernel: [  395.698152]  [<c03ce23d>] ignore_int+0x1/0x44
Mar 19 00:42:08 localhost kernel: [  395.698164]  [<e07d9002>] init_module+0x2/0x10 [faulty_int]
Mar 19 00:42:08 localhost kernel: [  395.698176]  [<c013dd93>] sys_init_module+0x143/0x1590
Mar 19 00:42:08 localhost kernel: [  395.698225]  [<c0103f10>] sysenter_past_esp+0x5d/0x99
Mar 19 00:42:08 localhost kernel: [  395.698246]  =======================

Thanks,

-- 
Ahmed S. Darwish
http://darwish.07.googlepages.com


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux