FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 01-17-2012, 04:23 PM
Joseph Salisbury
 
Default How To Cause An Oops

Hello,

Is there a way to generate or simulate an oops on purpose? This would
be helpful to perform testing while the kerneloops.org site is down.


Thanks,

Joe

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 01-18-2012, 01:10 PM
Andy Whitcroft
 
Default How To Cause An Oops

On Tue, Jan 17, 2012 at 12:23:17PM -0500, Joseph Salisbury wrote:
> Hello,
>
> Is there a way to generate or simulate an oops on purpose? This
> would be helpful to perform testing while the kerneloops.org site is
> down.

I believe there is a sysrq code for oopsing, which you can do either
from the keyboard or /proc/something/something.

-apw

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 01-18-2012, 01:21 PM
Herton Ronaldo Krzesinski
 
Default How To Cause An Oops

On Wed, Jan 18, 2012 at 02:10:03PM +0000, Andy Whitcroft wrote:
> On Tue, Jan 17, 2012 at 12:23:17PM -0500, Joseph Salisbury wrote:
> > Hello,
> >
> > Is there a way to generate or simulate an oops on purpose? This
> > would be helpful to perform testing while the kerneloops.org site is
> > down.
>
> I believe there is a sysrq code for oopsing, which you can do either
> from the keyboard or /proc/something/something.

Yes, "echo c > /proc/sysrq-trigger" should do it

>
> -apw
>
> --
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
>

--
[]'s
Herton

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 01-18-2012, 02:26 PM
Joseph Salisbury
 
Default How To Cause An Oops

On 01/18/2012 09:21 AM, Herton Ronaldo Krzesinski wrote:

On Wed, Jan 18, 2012 at 02:10:03PM +0000, Andy Whitcroft wrote:

On Tue, Jan 17, 2012 at 12:23:17PM -0500, Joseph Salisbury wrote:

Hello,

Is there a way to generate or simulate an oops on purpose? This
would be helpful to perform testing while the kerneloops.org site is
down.


I believe there is a sysrq code for oopsing, which you can do either
from the keyboard or /proc/something/something.


Yes, "echo c> /proc/sysrq-trigger" should do it



-apw

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team




Perfect. Thanks Andy and Herton!

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 01-18-2012, 04:46 PM
Joseph Salisbury
 
Default How To Cause An Oops

On 01/18/2012 09:21 AM, Herton Ronaldo Krzesinski wrote:

On Wed, Jan 18, 2012 at 02:10:03PM +0000, Andy Whitcroft wrote:

On Tue, Jan 17, 2012 at 12:23:17PM -0500, Joseph Salisbury wrote:

Hello,

Is there a way to generate or simulate an oops on purpose? This
would be helpful to perform testing while the kerneloops.org site is
down.


I believe there is a sysrq code for oopsing, which you can do either
from the keyboard or /proc/something/something.


Yes, "echo c> /proc/sysrq-trigger" should do it



-apw

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team





It appears echoing c into /proc/sysrq-trigger causes a crash. Is there
a way to trigger just an oops?


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 01-18-2012, 05:34 PM
Adam Stokes
 
Default How To Cause An Oops

On 01/18/2012 12:46 PM, Joseph Salisbury wrote:

On 01/18/2012 09:21 AM, Herton Ronaldo Krzesinski wrote:

On Wed, Jan 18, 2012 at 02:10:03PM +0000, Andy Whitcroft wrote:

On Tue, Jan 17, 2012 at 12:23:17PM -0500, Joseph Salisbury wrote:

Hello,

Is there a way to generate or simulate an oops on purpose? This
would be helpful to perform testing while the kerneloops.org site is
down.


I believe there is a sysrq code for oopsing, which you can do either
from the keyboard or /proc/something/something.


Yes, "echo c> /proc/sysrq-trigger" should do it



-apw

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team





It appears echoing c into /proc/sysrq-trigger causes a crash. Is
there a way to trigger just an oops?



This guy made a simple module to panic a system

http://www.dufault.info/blog/forcibly-triggering-a-kernel-panic-on-linux/

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 01-18-2012, 07:25 PM
Chris Van Hoof
 
Default How To Cause An Oops

On 01/17/2012 12:23 PM, Joseph Salisbury wrote:
> Hello,
>
> Is there a way to generate or simulate an oops on purpose? This would
> be helpful to perform testing while the kerneloops.org site is down.
>
> Thanks,
>
> Joe

Heya Joe -- I've had this laying around for a while; as long as
/proc/sys/kernel/panic_on_oops is set to 0 it should give you what
you're after.

--chris

vanhoof@hanzo:~/oops$ cat oops.c
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>

static void generate_oops(void) {
*(int*)0 = 1;
}

static int __init my_oops_init(void) {
printk("hi");
generate_oops();
return 0;
}
static void __exit my_oops_exit(void) {
printk("bai");
}

module_init(my_oops_init);
module_exit(my_oops_exit);

vanhoof@hanzo:~/oops$ cat Makefile
obj-m := oops.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
SYM=$(PWD)

all:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules


vanhoof@hanzo:~/oops$ make
make -C /lib/modules/3.0.0-15-generic/build SUBDIRS=/home/vanhoof/oops
modules
make[1]: Entering directory `/usr/src/linux-headers-3.0.0-15-generic'
CC [M] /home/vanhoof/oops/oops.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/vanhoof/oops/oops.mod.o
LD [M] /home/vanhoof/oops/oops.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.0.0-15-generic'

vanhoof@hanzo:~/oops$ sudo insmod ./oops.ko
vanhoof@hanzo:~/oops$ dmesg
[...]
[ 293.004578] oops: module license 'unspecified' taints kernel.
[ 293.004584] Disabling lock debugging due to kernel taint
[ 293.004832] hi
[ 293.004851] BUG: unable to handle kernel NULL pointer dereference at
(null)
[ 293.004925] IP: [<ffffffffa003c012>] my_oops_init+0x12/0x1000 [oops]
[ 293.004979] PGD 1572e1067 PUD 1559a7067 PMD 0
[ 293.005024] Oops: 0002 [#1] SMP
[ 293.005058] CPU 0
[ 293.005081] Modules linked in: oops(P+) parport_pc autofs4 ppdev
snd_hda_codec_hdmi rfcomm bnep bluetooth binfmt_misc snd_hda_intel
snd_hda_codec snd_hwdep snd_pcm i915 snd_seq_midi snd_rawmidi nouveau
snd_seq_midi_event snd_seq snd_timer snd_seq_device ttm snd
drm_kms_helper drm mei(C) soundcore mxm_wmi snd_page_alloc i2c_algo_bit
wmi video lp parport ahci xhci_hcd libahci e1000e
[ 293.005438]
[ 293.005448] Pid: 2810, comm: insmod Tainted: P C
3.0.0-15-generic #24-Ubuntu Intel Corporation 2012 Client
Platform/Emerald Lake
[ 293.005513] RIP: 0010:[<ffffffffa003c012>] [<ffffffffa003c012>]
my_oops_init+0x12/0x1000 [oops]
[ 293.005558] RSP: 0018:ffff880155ab5f18 EFLAGS: 00010292
[ 293.005584] RAX: 0000000000000014 RBX: ffffffffa009f000 RCX:
000000000003ffff
[ 293.005630] RDX: 0000000000000000 RSI: 0000000000000082 RDI:
0000000000000246
[ 293.005681] RBP: ffff880155ab5f18 R08: 000000000000000a R09:
0000000000000000
[ 293.005732] R10: 0000000000000000 R11: 0000000000000000 R12:
0000000000000000
[ 293.005784] R13: ffffffffa003c000 R14: 00000000015a8010 R15:
0000000000000003
[ 293.005836] FS: 00007f19cfc29720(0000) GS:ffff88015e200000(0000)
knlGS:0000000000000000
[ 293.005895] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 293.005937] CR2: 0000000000000000 CR3: 000000015357f000 CR4:
00000000001406f0
[ 293.005988] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[ 293.006039] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
0000000000000400
[ 293.006091] Process insmod (pid: 2810, threadinfo ffff880155ab4000,
task ffff88013a442e40)
[ 293.006149] Stack:
[ 293.006166] ffff880155ab5f48 ffffffff81002042 ffffffffa009f000
ffffffffffffffff
[ 293.006230] 0000000000000d4e 00000000015a8010 ffff880155ab5f78
ffffffff8109fede
[ 293.006293] 00007fff3bc46992 00000000015a8010 0000000000000d4e
0000000000004000
[ 293.006357] Call Trace:
[ 293.006383] [<ffffffff81002042>] do_one_initcall+0x42/0x180
[ 293.006428] [<ffffffff8109fede>] sys_init_module+0xbe/0x230
[ 293.006473] [<ffffffff815fa3c2>] system_call_fastpath+0x16/0x1b
[ 293.006517] Code: <c7> 04 25 00 00 00 00 01 00 00 00 31 c0 5d c3 00
00 00 00 00 00 00
[ 293.006651] RIP [<ffffffffa003c012>] my_oops_init+0x12/0x1000 [oops]
[ 293.006704] RSP <ffff880155ab5f18>
[ 293.006730] CR2: 0000000000000000
[ 293.066044] ---[ end trace 4e561320e5a93aba ]---



--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 01-18-2012, 08:50 PM
Joseph Salisbury
 
Default How To Cause An Oops

On 01/18/2012 03:25 PM, Chris Van Hoof wrote:

On 01/17/2012 12:23 PM, Joseph Salisbury wrote:

Hello,

Is there a way to generate or simulate an oops on purpose? This would
be helpful to perform testing while the kerneloops.org site is down.

Thanks,

Joe


Heya Joe -- I've had this laying around for a while; as long as
/proc/sys/kernel/panic_on_oops is set to 0 it should give you what
you're after.

--chris

vanhoof@hanzo:~/oops$ cat oops.c
#include<linux/kernel.h>
#include<linux/module.h>
#include<linux/init.h>

static void generate_oops(void) {
*(int*)0 = 1;
}

static int __init my_oops_init(void) {
printk("hi");
generate_oops();
return 0;
}
static void __exit my_oops_exit(void) {
printk("bai");
}

module_init(my_oops_init);
module_exit(my_oops_exit);

vanhoof@hanzo:~/oops$ cat Makefile
obj-m := oops.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
SYM=$(PWD)

all:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules


vanhoof@hanzo:~/oops$ make
make -C /lib/modules/3.0.0-15-generic/build SUBDIRS=/home/vanhoof/oops
modules
make[1]: Entering directory `/usr/src/linux-headers-3.0.0-15-generic'
CC [M] /home/vanhoof/oops/oops.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/vanhoof/oops/oops.mod.o
LD [M] /home/vanhoof/oops/oops.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.0.0-15-generic'

vanhoof@hanzo:~/oops$ sudo insmod ./oops.ko
vanhoof@hanzo:~/oops$ dmesg
[...]
[ 293.004578] oops: module license 'unspecified' taints kernel.
[ 293.004584] Disabling lock debugging due to kernel taint
[ 293.004832] hi
[ 293.004851] BUG: unable to handle kernel NULL pointer dereference at
(null)
[ 293.004925] IP: [<ffffffffa003c012>] my_oops_init+0x12/0x1000 [oops]
[ 293.004979] PGD 1572e1067 PUD 1559a7067 PMD 0
[ 293.005024] Oops: 0002 [#1] SMP
[ 293.005058] CPU 0
[ 293.005081] Modules linked in: oops(P+) parport_pc autofs4 ppdev
snd_hda_codec_hdmi rfcomm bnep bluetooth binfmt_misc snd_hda_intel
snd_hda_codec snd_hwdep snd_pcm i915 snd_seq_midi snd_rawmidi nouveau
snd_seq_midi_event snd_seq snd_timer snd_seq_device ttm snd
drm_kms_helper drm mei(C) soundcore mxm_wmi snd_page_alloc i2c_algo_bit
wmi video lp parport ahci xhci_hcd libahci e1000e
[ 293.005438]
[ 293.005448] Pid: 2810, comm: insmod Tainted: P C
3.0.0-15-generic #24-Ubuntu Intel Corporation 2012 Client
Platform/Emerald Lake
[ 293.005513] RIP: 0010:[<ffffffffa003c012>] [<ffffffffa003c012>]
my_oops_init+0x12/0x1000 [oops]
[ 293.005558] RSP: 0018:ffff880155ab5f18 EFLAGS: 00010292
[ 293.005584] RAX: 0000000000000014 RBX: ffffffffa009f000 RCX:
000000000003ffff
[ 293.005630] RDX: 0000000000000000 RSI: 0000000000000082 RDI:
0000000000000246
[ 293.005681] RBP: ffff880155ab5f18 R08: 000000000000000a R09:
0000000000000000
[ 293.005732] R10: 0000000000000000 R11: 0000000000000000 R12:
0000000000000000
[ 293.005784] R13: ffffffffa003c000 R14: 00000000015a8010 R15:
0000000000000003
[ 293.005836] FS: 00007f19cfc29720(0000) GS:ffff88015e200000(0000)
knlGS:0000000000000000
[ 293.005895] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 293.005937] CR2: 0000000000000000 CR3: 000000015357f000 CR4:
00000000001406f0
[ 293.005988] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[ 293.006039] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
0000000000000400
[ 293.006091] Process insmod (pid: 2810, threadinfo ffff880155ab4000,
task ffff88013a442e40)
[ 293.006149] Stack:
[ 293.006166] ffff880155ab5f48 ffffffff81002042 ffffffffa009f000
ffffffffffffffff
[ 293.006230] 0000000000000d4e 00000000015a8010 ffff880155ab5f78
ffffffff8109fede
[ 293.006293] 00007fff3bc46992 00000000015a8010 0000000000000d4e
0000000000004000
[ 293.006357] Call Trace:
[ 293.006383] [<ffffffff81002042>] do_one_initcall+0x42/0x180
[ 293.006428] [<ffffffff8109fede>] sys_init_module+0xbe/0x230
[ 293.006473] [<ffffffff815fa3c2>] system_call_fastpath+0x16/0x1b
[ 293.006517] Code:<c7> 04 25 00 00 00 00 01 00 00 00 31 c0 5d c3 00
00 00 00 00 00 00
[ 293.006651] RIP [<ffffffffa003c012>] my_oops_init+0x12/0x1000 [oops]
[ 293.006704] RSP<ffff880155ab5f18>
[ 293.006730] CR2: 0000000000000000
[ 293.066044] ---[ end trace 4e561320e5a93aba ]---






Awesome! thanks for this, Chris. Thanks for the link you provided as
well, Adam.


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 08:25 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org