How to set SA_ONSTACK flag - go

My Go application connect to IBM MQ.
When my application throws segmentation violation error (signal SIGSEGV), signal handlers registered by IBM MQ make my application throw "non-Go code set up signal handler without SA_ONSTACK flag".
So how can I set that flag?
My code
package main
import (
"fmt"
"github.com/ibm-messaging/mq-golang/ibmmq"
)
type A struct {
Str string
}
type B struct {
Apointer *A
}
func main() {
connectIBMMQ()
b := B{}
fmt.Println(b.Apointer.Str)
}
const (
QMgrName = `QMgrName`
ChannelName = `ChannelName`
ConnectionName = `0.0.0.0(1416)`
Username = `username`
Password = `password`
)
func connectIBMMQ() {
mqcd := ibmmq.NewMQCD()
mqcd.ChannelName = ChannelName
mqcd.ConnectionName = ConnectionName
csp := ibmmq.NewMQCSP()
csp.AuthenticationType = ibmmq.MQCSP_AUTH_USER_ID_AND_PWD
csp.UserId = Username
csp.Password = Password
cno := ibmmq.NewMQCNO()
cno.ClientConn = mqcd
cno.Options = ibmmq.MQCNO_CLIENT_BINDING + ibmmq.MQCNO_RECONNECT + ibmmq.MQCNO_HANDLE_SHARE_BLOCK
cno.SecurityParms = csp
ibmmq.Connx(QMgrName, cno)
}
Ref
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.dev.doc/q025880_.htm
https://golang.org/pkg/os/signal/#hdr-Go_programs_that_use_cgo_or_SWIG
Full error
signal 11 received but handler not on signal stack
fatal error: non-Go code set up signal handler without SA_ONSTACK flag
runtime stack:
runtime: unexpected return pc for runtime.sigtramp called from 0x7f60f6e9a517
stack: frame={sp:0xc000046628, fp:0xc000046680} stack=[0xc00003e578,0xc000046978)
000000c000046528: 000000c000046530 00000000004549a0 <runtime.throw.func1+0>
000000c000046538: 00000000004e2c3b 0000000000000039
000000c000046548: 000000c000046568 00000000004415df <runtime.sigNotOnStack+127>
000000c000046558: 00000000004e2c3b 0000000000000039
000000c000046568: 000000c000046618 0000000000440c6d <runtime.sigtrampgo+749>
000000c000046578: 000000000000000b 000000c000046600
000000c000046588: 000000c000046880 0000000000000000
000000c000046598: 0000000000000000 000000c000046628
000000c0000465a8: 0000000000000000 0000000000000000
000000c0000465b8: 0000000000000000 0000000000000000
000000c0000465c8: 0000000000000000 000000c000000180
000000c0000465d8: 0000000000000000 ffffffffffffffff
000000c0000465e8: 0000000000000000 0000000000000000
000000c0000465f8: 0000000000000000 000000c000002000
000000c000046608: 0000000000000000 0000000000008000
000000c000046618: 000000c000046670 0000000000459a33 <runtime.sigtramp+67>
000000c000046628: <000000000000000b 000000c0000469b0
000000c000046638: 000000c000046880 000000c000046880
000000c000046648: 000000c0000469b0 0000000000000000
000000c000046658: 000000000000000b 000000c000046670
000000c000046668: 00007f60f78213c0 000000000262e400
000000c000046678: !00007f60f6e9a517 >000000c000046690
000000c000046688: 8e26f8f48c919100 0000000000000000
000000c000046698: 0000000000000000 0000000000000008
000000c0000466a8: 0000000000000000 000000c000000180
000000c0000466b8: 0000000000000000 0000000000000000
000000c0000466c8: 0000000000000000 0000000000000000
000000c0000466d8: 0000000000000000 0000000000000000
000000c0000466e8: 0000000000000000 0000000000000000
000000c0000466f8: 0000000000000000 0000000000000000
000000c000046708: 0000000000000000 0000000000000000
000000c000046718: 0000000000000000 000000c000046f88
000000c000046728: 0000000000000004 0000000000000012
000000c000046738: 00000000004f21e1 0000000000000000
000000c000046748: 00007f60f6e9b45a 0000000000000000
000000c000046758: 0000000000000000 0000000000000000
000000c000046768: 0000000000000000 0000000000000000
000000c000046778: 0000000000000000
runtime.throw(0x4e2c3b, 0x39)
/usr/local/go/src/runtime/panic.go:617 +0x72
runtime.sigNotOnStack(0xb)
/usr/local/go/src/runtime/signal_unix.go:576 +0x7f
runtime.sigtrampgo(0xb, 0xc0000469b0, 0xc000046880)
/usr/local/go/src/runtime/signal_unix.go:334 +0x2ed
runtime: unexpected return pc for runtime.sigtramp called from 0x7f60f6e9a517
stack: frame={sp:0xc000046628, fp:0xc000046680} stack=[0xc00003e578,0xc000046978)
000000c000046528: 000000c000046530 00000000004549a0 <runtime.throw.func1+0>
000000c000046538: 00000000004e2c3b 0000000000000039
000000c000046548: 000000c000046568 00000000004415df <runtime.sigNotOnStack+127>
000000c000046558: 00000000004e2c3b 0000000000000039
000000c000046568: 000000c000046618 0000000000440c6d <runtime.sigtrampgo+749>
000000c000046578: 000000000000000b 000000c000046600
000000c000046588: 000000c000046880 0000000000000000
000000c000046598: 0000000000000000 000000c000046628
000000c0000465a8: 0000000000000000 0000000000000000
000000c0000465b8: 0000000000000000 0000000000000000
000000c0000465c8: 0000000000000000 000000c000000180
000000c0000465d8: 0000000000000000 ffffffffffffffff
000000c0000465e8: 0000000000000000 0000000000000000
000000c0000465f8: 0000000000000000 000000c000002000
000000c000046608: 0000000000000000 0000000000008000
000000c000046618: 000000c000046670 0000000000459a33 <runtime.sigtramp+67>
000000c000046628: <000000000000000b 000000c0000469b0
000000c000046638: 000000c000046880 000000c000046880
000000c000046648: 000000c0000469b0 0000000000000000
000000c000046658: 000000000000000b 000000c000046670
000000c000046668: 00007f60f78213c0 000000000262e400
000000c000046678: !00007f60f6e9a517 >000000c000046690
000000c000046688: 8e26f8f48c919100 0000000000000000
000000c000046698: 0000000000000000 0000000000000008
000000c0000466a8: 0000000000000000 000000c000000180
000000c0000466b8: 0000000000000000 0000000000000000
000000c0000466c8: 0000000000000000 0000000000000000
000000c0000466d8: 0000000000000000 0000000000000000
000000c0000466e8: 0000000000000000 0000000000000000
000000c0000466f8: 0000000000000000 0000000000000000
000000c000046708: 0000000000000000 0000000000000000
000000c000046718: 0000000000000000 000000c000046f88
000000c000046728: 0000000000000004 0000000000000012
000000c000046738: 00000000004f21e1 0000000000000000
000000c000046748: 00007f60f6e9b45a 0000000000000000
000000c000046758: 0000000000000000 0000000000000000
000000c000046768: 0000000000000000 0000000000000000
000000c000046778: 0000000000000000
runtime.sigtramp(0xc000046690, 0x8e26f8f48c919100, 0x0, 0x0, 0x8, 0x0, 0xc000000180, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/runtime/sys_linux_amd64.s:357 +0x43
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc00004afe8 sp=0xc00004afe0 pc=0x457e41
goroutine 1 [running]:
goroutine running on other thread; stack unavailable

You can try setting the environment variable "MQS_NO_SYNC_SIGNAL_HANDLING=true" to disable some of MQ's signal setting. That should at least give a better idea of where the SEGV is coming from.

Related

import Dll which build from Go and runtime error

I have a Win64 Dll file, name "test.dll". Build it with MinGW64. Dll inside code like this:
// GOLANG CODE
package main
import "C"
import "time"
//export TestGo
func TestGo(str *C.char)*C.char {
gostr := C.GoString(str)
println("TestGo : ", str)
time.Sleep(time.Second * 3)
gostr = "return:" + gostr
cstr := C.CString(gostr)
return cstr
}
func main() {
}
And I have another Go program , try to import this "test.dll":
// GOLANG CODE
package main
import "C"
import (
"fmt"
"syscall"
"unsafe"
)
func main() {
pth := "./godll/test.dll"
dll := syscall.NewLazyDLL(pth)
ptrfun := dll.NewProc("TestGo")
msg := C.CString("this is a message")
res, _, _ := ptrfun.Call(uintptr(unsafe.Pointer(msg)))
gostr := C.GoString((*C.char)(unsafe.Pointer(res)))
fmt.Println(gostr)
for {
select {}
}
}
When I run this program, I got this:
TestGo : 0x1864b921f80
fatal error: unexpected signal during runtime execution
[signal 0xc0000005 code=0x1 addr=0x0 pc=0x6bf1f528]
goroutine 1 [running, locked to thread]:
runtime.throw(0x6bf524d9, 0x2a)
I:/Soft_Install/GO/src/runtime/panic.go:1116 +0x79 fp=0xc00010ef08 sp=0xc00010eed8 pc=0x6bef2859
runtime.sigpanic()
I:/Soft_Install/GO/src/runtime/signal_windows.go:240 +0x285 fp=0xc00010ef38 sp=0xc00010ef08 pc=0x6bf040a5
runtime.memmove(0x0, 0xc00004a050, 0x1)
I:/Soft_Install/GO/src/runtime/memmove_amd64.s:148 +0x108 fp=0xc00010ef40 sp=0xc00010ef38 pc=0x6bf1f528
runtime.heapBitsSetType(0xc00004a050, 0x50, 0x48, 0x6bf48a60)
I:/Soft_Install/GO/src/runtime/mbitmap.go:1373 +0x4cd fp=0xc00010f048 sp=0xc00010ef40 pc=0x6bed310d
runtime.mallocgc(0x50, 0x6bf48a60, 0x1, 0x6bf4c29e)
I:/Soft_Install/GO/src/runtime/malloc.go:1090 +0x5ee fp=0xc00010f0e8 sp=0xc00010f048 pc=0x6beccace
runtime.newobject(0x6bf48a60, 0x1)
I:/Soft_Install/GO/src/runtime/malloc.go:1195 +0x3f fp=0xc00010f118 sp=0xc00010f0e8 pc=0x6becd23f
time.Sleep(0xb2d05e00)
I:/Soft_Install/GO/src/runtime/time.go:182 +0x108 fp=0xc00010f158 sp=0xc00010f118 pc=0x6bf1b828
main.TestGo(0x1864b921f80, 0x0)
C:/Users/hgmmy/Desktop/GitGoCache/maquego/Test/GoDllTest/godll/dll.go:16 +0x93 fp=0xc00010f1d0 sp=0xc00010f158 pc=0x6bf2d833
main._cgoexpwrap_0fad9edfa800_TestGo(0x1864b921f80, 0x0)
_cgo_gotypes.go:73 +0x67 fp=0xc00010f208 sp=0xc00010f1d0 pc=0x6bf2d6a7
runtime.call32(0x0, 0x55e6dff3d0, 0x55e6dff540, 0x10)
I:/Soft_Install/GO/src/runtime/asm_amd64.s:540 +0x45 fp=0xc00010f238 sp=0xc00010f208 pc=0x6bf1cc25
runtime.cgocallbackg1(0x0)
I:/Soft_Install/GO/src/runtime/cgocall.go:332 +0x1b8 fp=0xc00010f2d0 sp=0xc00010f238 pc=0x6bec3558
runtime.cgocallbackg(0x0)
I:/Soft_Install/GO/src/runtime/cgocall.go:207 +0xe5 fp=0xc00010f338 sp=0xc00010f2d0 pc=0x6bec32e5
runtime: unexpected return pc for runtime.cgocallback_gofunc called from 0x78dca7
stack: frame={sp:0xc00010f338, fp:0xc00010f358} stack=[0xc000100000,0xc000110000)
000000c00010f238: 0000000000000000 00000055e6dff3d0
000000c00010f248: 00000055e6dff540 0000000000000010
000000c00010f258: 000000006befcd0f <runtime.exitsyscallfast+207> 000000c000020000
000000c00010f268: 0000000000000000 0000000000000000
000000c00010f278: 0202010000000000 0000000000000000
000000c00010f288: 0000000000000000 000000c00010f2c0
000000c00010f298: 000000c000034000 000000c00010f27d
000000c00010f2a8: 000000006bf539d0 0000000000000000
000000c00010f2b8: 0000000000000000 000000c00010f328
000000c00010f2c8: 000000006bec32e5 <runtime.cgocallbackg+229> 0000000000000000
000000c00010f2d8: 0000000000000000 0000000000724775
000000c00010f2e8: 000000006bf2d9a0 0000000000000001
000000c00010f2f8: 000000c00010f3e8 000000006bf2d9a0
000000c00010f308: 0000000000000000 0000000000000000
000000c00010f318: 000000c00010f360 000000c000034000
000000c00010f328: 00000055e6dff390 000000006bf1e3d2 <runtime.cgocallback_gofunc+178>
000000c00010f338: <0000000000000000 00000000008a0020
000000c00010f348: 000000c00010f360 !000000000078dca7
000000c00010f358: >00000000007247a9 000000000078f880
000000c00010f368: 00000000008a02e0 00000000008a0020
000000c00010f378: 000000c000034000 00000000008a0020
000000c00010f388: 000000c00010f3c8 000000000078ac1c
000000c00010f398: 000000000078f880 00000000008a02e0
000000c00010f3a8: 0000000000000000 0100000000000000
000000c00010f3b8: 00000000008a0020 0000000000832f90
000000c00010f3c8: 000000c00010fde8 000000000079e9fb
000000c00010f3d8: 000000006bf2d9a0 0000000000000001
000000c00010f3e8: 000001864b921f80 0000000000000000
000000c00010f3f8: 0000000000000000 0000000000000000
000000c00010f408: 0000000000000000 0000000000000000
000000c00010f418: 0000000000000000 0000000000000000
000000c00010f428: 0000000000000000 0000000000000000
000000c00010f438: 0000000000000000 0000000000000000
000000c00010f448: 0000000000000000 0000000000000000
runtime.cgocallback_gofunc(0x7247a9, 0x78f880, 0x8a02e0, 0x8a0020)
I:/Soft_Install/GO/src/runtime/asm_amd64.s:794 +0xb2 fp=0xc00010f358 sp=0xc00010f338 pc=0x6bf1e3d2
goroutine 1 [runnable, locked to thread]:
syscall.LoadDLL(0x6bf4d1ab, 0xc, 0x1c00004e078, 0x6bf6282d, 0x1c00004e000)
I:/Soft_Install/GO/src/syscall/dll_windows.go:92 +0x30d
syscall.(*LazyDLL).Load(0x1c000004060, 0x0, 0x0)
I:/Soft_Install/GO/src/syscall/dll_windows.go:245 +0xc8
syscall.(*LazyProc).Find(0x1c00004c2a0, 0x0, 0x0)
I:/Soft_Install/GO/src/syscall/dll_windows.go:300 +0xbf
syscall.(*LazyProc).mustFind(...)
I:/Soft_Install/GO/src/syscall/dll_windows.go:318
syscall.(*LazyProc).Addr(...)
I:/Soft_Install/GO/src/syscall/dll_windows.go:327
syscall.GetStdHandle(0xfffffffffffffff6, 0x1c00003bee8, 0x6bf280f8, 0x6bf461e0)
I:/Soft_Install/GO/src/syscall/zsyscall_windows.go:366 +0x3e
syscall.getStdHandle(0xfffffffffffffff6, 0x6bf4e818)
I:/Soft_Install/GO/src/syscall/syscall_windows.go:467 +0x32
syscall.init()
I:/Soft_Install/GO/src/syscall/syscall_windows.go:461 +0x129a
BUT!!!
I can call the dll with Python:
(Python Codes)
# PYTHON CODE
from ctypes import *
dll=CDLL("test.dll")
dll.TestGo.restype = c_char_p
msg=create_string_buffer("this is a message".encode())
res = dll.TestGo(msg)
print(string_at(res).decode())
Python return this:
TestGo : 0x259bd3aad90
return:this is a message
It return correct answer.
So, why I can't call this Dll functions from Go ......?

which file cause my kernel to crash

I had a kernel crash on a Redhat 6.
I want to retreive which file was openend
reading the dump I see
crash> bt
(...)
#8 [ffff8805050d7dc0] page_fault at ffffffff814ef845
[exception RIP: configfs_readdir+244]
RIP: ffffffffa0422444 RSP: ffff8805050d7e78 RFLAGS: 00010282
RAX: 0000000000000000 RBX: ffff880814a738d0 RCX: ffff880814a738c8
RDX: 0000000000000006 RSI: ffff880814a73830 RDI: ffffffffa04486d0
RBP: ffff8805050d7ed8 R8: ffff880814a738d0 R9: 0000000000000004
R10: 00000000000000a8 R11: 0000000000000246 R12: ffff8804cf782b00
R13: ffffffffa04486d0 R14: ffff8802087039d0 R15: ffff8802087039d8
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
#9 [ffff8805050d7ee0] vfs_readdir at ffffffff8118a670
(...)
crash > bt -f
(...)
#9 [ffff8805050d7ee0] vfs_readdir at ffffffff8118a670
ffff8805050d7ee8: ffff8805050d7f28 ffffffff81176652
ffff8805050d7ef8: 0000000000001000 00000000009ca848
ffff8805050d7f08: ffff8804cf782b00 0000000000008000
ffff8805050d7f18: 0000000000000000 00000000009ca820
ffff8805050d7f28: ffff8805050d7f78 ffffffff8118a7f9
I look at vfs_readdir
crash> whatis vfs_readdir
int vfs_readdir(struct file *, filldir_t, void *);
Then searching for the file (address ffff8805050d7f28 picked from top of stack at #9 )
crash> struct file ffff8805050d7f28
struct file {
f_u = {
fu_list = {
next = 0xffff8805050d7f78,
prev = 0xffffffff8118a7f9
},
fu_rcuhead = {
next = 0xffff8805050d7f78,
func = 0xffffffff8118a7f9 <sys_getdents+137>
}
},
f_path = {
mnt = 0x9ca878,
dentry = 0x9ca860
},
f_op = 0xffffffea00007fd0,
f_lock = {
raw_lock = {
slock = 578155200
}
},
At this point, I can go no further, how can I get string from f_path struct ?
I want to convert
f_path = {
mnt = 0x9ca878,
dentry = 0x9ca860
},
to strings
reading the struct, file owner is -1, effective uid didn't map to a known user.
from crash, files command show only 2 regular file
EDIT: as requested
crash> p ffff8805050d7f28
No symbol "ffff8805050d7f28" in current context.
p: gdb request failed: p ffff8805050d7f28
crash> p *(struct file) ffff8805050d7f28
No symbol "ffff8805050d7f28" in current context.
p: gdb request failed: p *(struct file) ffff8805050d7f28

Linux kernel module crash debug: general protection fault: 0000 [#1] SMP

I have a kernel module for splitting incoming rtp packets and merging rtp outgoing packets. The program crashes once in 2/3 days. If would be very convenient for me if its possible to find the exact line where the module crashes.
I have given the crash dump below. Is it possible to find the exact line in the code from crash dump?
PID: 1256 TASK: ffff88020fc71700 CPU: 0 COMMAND: "rtpproxy"
#0 [ffff880212faf2f0] machine_kexec at ffffffff8103bb7a
#1 [ffff880212faf360] crash_kexec at ffffffff810bb968
#2 [ffff880212faf430] oops_end at ffffffff8169fad8
#3 [ffff880212faf460] die at ffffffff81017808
#4 [ffff880212faf490] do_general_protection at ffffffff8169f5d2
#5 [ffff880212faf4c0] general_protection at ffffffff8169eef5
[exception RIP: pkt_queue+388]
RIP: ffffffffa00f3fa0 RSP: ffff880212faf578 RFLAGS: 00010292
RAX: ffff8802110ae400 RBX: ffff880213a53f38 RCX: 00015d910000a20f
RDX: 497d74565cede60c RSI: 000000006df1ed57 RDI: 00000000e46e0cfc
RBP: ffff880212faf728 R8: ffff880211a8b000 R9: ffff880212fafa60
R10: ffff880212fafbc8 R11: 0000000000000293 R12: 00000000134ab2b4
R13: 000000008386615c R14: 00000000000000e3 R15: 00000000000000e3
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
#6 [ffff880212faf730] obsf_tg at ffffffffa00f34a0 [xt_OBSF]
#7 [ffff880212faf890] ipt_do_table at ffffffffa00e41a5 [ip_tables]
#8 [ffff880212faf970] ipt_mangle_out at ffffffffa00dd129 [iptable_mangle]
#9 [ffff880212faf9c0] iptable_mangle_hook at ffffffffa00dd1eb [iptable_mangle]
#10 [ffff880212faf9d0] nf_iterate at ffffffff815aded5
#11 [ffff880212fafa20] nf_hook_slow at ffffffff815adf85
#12 [ffff880212fafaa0] __ip_local_out at ffffffff815babb2
#13 [ffff880212fafac0] ip_local_out at ffffffff815babd6
#14 [ffff880212fafae0] ip_send_skb at ffffffff815bbefb
#15 [ffff880212fafb00] udp_send_skb at ffffffff815df1d1
#16 [ffff880212fafb50] udp_sendmsg at ffffffff815e0286
#17 [ffff880212fafc90] inet_sendmsg at ffffffff815eabc4
#18 [ffff880212fafcd0] sock_sendmsg at ffffffff8156a437
#19 [ffff880212fafe50] sys_sendto at ffffffff8156d91d
#20 [ffff880212faff80] system_call_fastpath at ffffffff816a7029
RIP: 00007f17363b83a3 RSP: 00007ffff2965f90 RFLAGS: 00010213
RAX: 000000000000002c RBX: ffffffff816a7029 RCX: 00007ffff29ff99b
RDX: 0000000000000020 RSI: 00007f1737da4378 RDI: 0000000000000006
RBP: 0000000000000001 R8: 00007f1737da67a0 R9: 0000000000000010
R10: 0000000000000000 R11: 0000000000000293 R12: 00007f1737da4378
R13: 0000000000000001 R14: 00007f1737da42a0 R15: 0000000000000000
ORIG_RAX: 000000000000002c CS: 0033 SS: 002b
[157707.736203] general protection fault: 0000 [#1] SMP
[157707.736955] CPU 0
[157707.736973] Modules linked in:
[157707.737654] arc4 xt_tcpudp xt_OBSF(O) iptable_mangle ip_tables x_tables ghash_clmulni_intel aesni_intel cryptd aes_x86_64 joydev hid_generic microcode ext2 usbhid psmouse hid serio_raw i2c_piix4 virtio_balloon lp parport mac_hid floppy
[157707.740018]
[157707.740102] Pid: 1256, comm: rtpproxy Tainted: G O 3.5.0-23-generic #35~precise1-Ubuntu Bochs Bochs
[157707.740102] RIP: 0010:[<ffffffffa00f3fa0>] [<ffffffffa00f3fa0>] pkt_queue+0x184/0x48a [xt_OBSF]
[157707.740102] RSP: 0018:ffff880212faf578 EFLAGS: 00010292
[157707.740102] RAX: ffff8802110ae400 RBX: ffff880213a53f38 RCX: 00015d910000a20f
[157707.740102] RDX: 497d74565cede60c RSI: 000000006df1ed57 RDI: 00000000e46e0cfc
[157707.740102] RBP: ffff880212faf728 R08: ffff880211a8b000 R09: ffff880212fafa60
[157707.740102] R10: ffff880212fafbc8 R11: 0000000000000293 R12: 00000000134ab2b4
[157707.740102] R13: 000000008386615c R14: 00000000000000e3 R15: 00000000000000e3
[157707.740102] FS: 00007f1736ad9700(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
[157707.740102] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[157707.740102] CR2: 00007fd8a39f8000 CR3: 0000000211ad7000 CR4: 00000000000407f0
[157707.740102] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[157707.740102] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[157707.740102] Process rtpproxy (pid: 1256, threadinfo ffff880212fae000, task ffff88020fc71700)
[157707.740102] Stack:
[157707.740102] ffff880212faf5a8 0000000000015d91 134ab2b400000008 000008f58386615c
[157707.740102] 00015d910000a20f a080527800000014 3a78560000d1fa00 564812de1a006045
[157707.740102] ffff880212faf618 ffffffff81872e20 0000000000000000 ffff880210ca9000
[157707.740102] Call Trace:
[157707.740102] [<ffffffff8169e7de>] ? _raw_spin_lock+0xe/0x20
[157707.740102] [<ffffffff815a0958>] ? sch_direct_xmit+0x88/0x1c0
[157707.740102] [<ffffffff81090833>] ? update_cpu_power+0x63/0x100
[157707.740102] [<ffffffff810909c3>] ? update_group_power+0xf3/0x100
[157707.740102] [<ffffffff81090db2>] ? update_sd_lb_stats+0x3e2/0x5f0
[157707.740102] [<ffffffffa00f34a0>] obsf_tg+0x9c0/0x133c [xt_OBSF]
[157707.740102] [<ffffffff81090ff9>] ? find_busiest_group+0x39/0x4a0
[157707.740102] [<ffffffff81091541>] ? load_balance+0xe1/0x4a0
[157707.740102] [<ffffffffa00e41a5>] ipt_do_table+0x315/0x450 [ip_tables]
[157707.740102] [<ffffffffa00dd129>] ipt_mangle_out+0x99/0x100 [iptable_mangle]
[157707.740102] [<ffffffffa00dd1eb>] iptable_mangle_hook+0x5b/0x60 [iptable_mangle]
[157707.740102] [<ffffffff815aded5>] nf_iterate+0x85/0xc0
[157707.740102] [<ffffffff815b8e50>] ? ip_forward_options+0x200/0x200
[157707.740102] [<ffffffff815adf85>] nf_hook_slow+0x75/0x150
[157707.740102] [<ffffffff815b8e50>] ? ip_forward_options+0x200/0x200
[157707.740102] [<ffffffff815babb2>] __ip_local_out+0xa2/0xb0
[157707.740102] [<ffffffff815babd6>] ip_local_out+0x16/0x30
[157707.740102] [<ffffffff815bbefb>] ip_send_skb+0x1b/0x50
[157707.740102] [<ffffffff815df1d1>] udp_send_skb+0x111/0x2a0
[157707.740102] [<ffffffff815b9070>] ? ip_setup_cork+0x150/0x150
[157707.740102] [<ffffffff815e0286>] udp_sendmsg+0x316/0x960
[157707.740102] [<ffffffff815eabc4>] inet_sendmsg+0x64/0xb0
[157707.740102] [<ffffffff812f31b7>] ? apparmor_socket_sendmsg+0x17/0x20
[157707.740102] [<ffffffff8156a437>] sock_sendmsg+0x117/0x130
[157707.740102] [<ffffffff8119a510>] ? __pollwait+0xf0/0xf0
[157707.740102] [<ffffffff8119a510>] ? __pollwait+0xf0/0xf0
[157707.740102] [<ffffffff8119a510>] ? __pollwait+0xf0/0xf0
[157707.740102] [<ffffffff8156b58d>] ? move_addr_to_user+0xbd/0xd0
[157707.740102] [<ffffffff8156ce7a>] ? move_addr_to_kernel+0x5a/0xa0
[157707.740102] [<ffffffff8156d91d>] sys_sendto+0x13d/0x190
[157707.740102] [<ffffffff8103fcc9>] ? kvm_clock_read+0x19/0x20
[157707.740102] [<ffffffff8103fcd9>] ? kvm_clock_get_cycles+0x9/0x10
[157707.740102] [<ffffffff810a3bd7>] ? getnstimeofday+0x57/0xe0
[157707.740102] [<ffffffff810a3cca>] ? do_gettimeofday+0x1a/0x50
[157707.740102] [<ffffffff816a7029>] system_call_fastpath+0x16/0x1b
[157707.740102] Code: f7 f1 48 8b 8d 70 fe ff ff 4c 63 f2 41 89 d7 49 69 c6 68 01 00 00 48 01 c3 48 8b 83 58 01 00 00 48 2d 58 01 00 00 48 89 c2 eb 20 <44> 39 62 04 0f 85 c0 02 00 00 44 39 6a 08 0f 85 b6 02 00 00 48
[157707.740102] RIP [<ffffffffa00f3fa0>] pkt_queue+0x184/0x48a [xt_OBSF]
[157707.740102] RSP <ffff880212faf578>
[157707.736203] general protection fault: 0000 [#1] SMP
Says that you are doing something horrible in memory (e.g dereferencing a null pointer)
[157707.740102] RIP: 0010:[<ffffffffa00f3fa0>] [<ffffffffa00f3fa0>] pkt_queue+0x184/0x48a
This line is reporting to you the instruction pointer value when your module crashed; it says that it died inside a function named "pkt_queue" after an offset of "0x184".
(btw, the same value appears in the first crash dump, 388 in decimal = 0x184)
Now, you can use objdump to dump the assembly + debug information about your code and you add the address of the function pkt_queue to 0x184 and you get to the offending instruction.
Let's say your pkt_queue function appears(unreasonably hypothetical) at address 0x01 in objdump, it means you should look at line: 0x184 + 0x01 = 0x185 in the assembly to see what's going on.
Objdump allows you view the source + the assembly and line numbers:
objdump -S your_object_file.o this will not only list the assembly but also the corresponding source code assuming the debug symbols are added when compiling.
Oh and for your future reference:https://opensourceforu.com/2011/01/understanding-a-kernel-oops/
You can also use:
eu-addr2line -f -e object_file.o pkt_queue+0x184
Where -f tells the command that the function name is used with line number and -e is the executable or object file containing the line number.
there is also the script scripts/decode_stacktrace.sh in the kernel source code.
You should enable CONFIG_DEBUG_INFO then run the script:
./scripts/decode_stacktrace.sh /path/to/vmlinux /path/to/kernel/tree /path/to/modules/dir < dmesg.log
for example starting in the kernel source code root:
make O=~/kbuild/x86/ -j9
cd ~/kbuild/x86/
make INSTALL_MOD_PATH=~/modpath modules_install
cd -
./scripts/decode_stacktrace.sh ~/kbuild/x86/vmlinux . ~/modpath < crash.log
see https://lwn.net/Articles/592724/

Analyze BSOD WHEA_UNCORRECTABLE_ERROR WIN8 Driver

I have a new Computer for 3 Weeks now and i get a lot of WHEA_UNCORRECTABLE_ERROR BSODs.
I get These Bluescreens random every 30 - 50 minutes.
Here is the dump from WinDbg:
Microsoft (R) Windows Debugger Version 6.2.9200.20512 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.
Loading Dump File [C:\Windows\Minidump\050913-7984-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available
Symbol search path is: SRV*c:\Symbole*http://msdl.microsoft.com/download/symbols
Executable search path is:
Windows 8 Kernel Version 9200 MP (4 procs) Free x64
Product: WinNt, suite: TerminalServer SingleUserTS
Built by: 9200.16551.amd64fre.win8_gdr.130306-1502
Machine Name:
Kernel base = 0xfffff80104018000 PsLoadedModuleList = 0xfffff801042e4b00
Debug session time: Thu May 9 17:12:45.597 2013 (UTC + 2:00)
System Uptime: 0 days 0:00:25.246
Loading Kernel Symbols
...............................................................
................................................................
..................
Loading User Symbols
Loading unloaded module list
.......
*
Bugcheck Analysis *
*
Use !analyze -v to get detailed debugging information.
BugCheck 124, {0, fffffa8008c87028, be200000, 2110a}
Probably caused by : GenuineIntel
Followup: MachineOwner
1: kd> !analyze -v
*
Bugcheck Analysis *
*
WHEA_UNCORRECTABLE_ERROR (124)
A fatal hardware error has occurred. Parameter 1 identifies the type of error
source that reported the error. Parameter 2 holds the address of the
WHEA_ERROR_RECORD structure that describes the error conditon.
Arguments:
Arg1: 0000000000000000, Machine Check Exception
Arg2: fffffa8008c87028, Address of the WHEA_ERROR_RECORD structure.
Arg3: 00000000be200000, High order 32-bits of the MCi_STATUS value.
Arg4: 000000000002110a, Low order 32-bits of the MCi_STATUS value.
Debugging Details:
BUGCHECK_STR: 0x124_GenuineIntel
CUSTOMER_CRASH_COUNT: 1
DEFAULT_BUCKET_ID: WIN8_DRIVER_FAULT
PROCESS_NAME: System
CURRENT_IRQL: f
STACK_TEXT:
fffff880009f9868 fffff8010479193d : 0000000000000124 0000000000000000 fffffa8008c87028 00000000be200000 : nt!KeBugCheckEx
fffff880009f9870 fffff80104178969 : 0000000000000001 fffffa80066d7320 0000000000000000 fffffa8008c87028 : hal!HalBugCheckSystem+0xf9
fffff880009f98b0 fffff801047916e3 : 0000000000000728 0000000000000001 fffff880009f9a10 fffffa80066d7320 : nt!WheaReportHwError+0x249
fffff880009f9910 fffff8010479100c : 0000000000000010 fffffa80066d7320 fffff880009f9ac8 fffffa80066d7320 : hal!HalpMcaReportError+0x53
fffff880009f9a70 fffff80104790f07 : fffffa800678b760 0000000000000001 0000000000000001 0000000000000000 : hal!HalpMceHandlerCore+0xd4
fffff880009f9ac0 fffff80104790d64 : 0000000000000004 0000000000000001 0000000000000000 0000000000000000 : hal!HalpMceHandler+0xe3
fffff880009f9b00 fffff80104791edb : fffffa800678b760 fffff880009f9d30 0000000000000000 0000000000000000 : hal!HalpMceHandlerWithRendezvous+0xd4
fffff880009f9b30 fffff8010407057b : 0000000000000000 0000000000000000 0000000000000000 0000000000000000 : hal!HalHandleMcheck+0x40
fffff880009f9b60 fffff8010407032e : 0000000000000000 0000000000000000 0000000000000000 0000000000000000 : nt!KxMcheckAbort+0x7b
fffff880009f9ca0 fffff8800158e984 : 0000000000000000 0000000000000000 0000000000000000 0000000000000000 : nt!KiMcheckAbort+0x16e
fffff88002e1b888 0000000000000000 : 0000000000000000 0000000000000000 0000000000000000 0000000000000000 : intelppm!MWaitIdle+0x18
STACK_COMMAND: kb
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: GenuineIntel
IMAGE_NAME: GenuineIntel
DEBUG_FLR_IMAGE_TIMESTAMP: 0
FAILURE_BUCKET_ID: 0x124_GenuineIntel_PROCESSOR_CACHE
BUCKET_ID: 0x124_GenuineIntel_PROCESSOR_CACHE
Followup: MachineOwner
I have also reinstalled Windows 3 times now but every time i get These Errors.
Can anyone tell me whats the Problem is?
Greets
This might cause by INTEL CPU driver, for energy management or etc. try not to install intel cpu driver(might delivered with motherboard).

What will happen if two kernel module export same symbol

If two kernel module contain EXPORT_SYMBOL(a), a is defined as: int a, what will happen if two module was inserted? which "a" will be used?
You can't insert duplicate symbols into the kernel. Example:
The xor module loaded in my kernel
nwatkins#kyoto:~$ lsmod | grep xor
xor 4685 1 async_xor
The exported xor_blocks symbol in the xor module
nwatkins#kyoto:~$ nm /lib/modules/2.6.32-24-generic/kernel/crypto/xor.ko | grep xor_blocks
0000000000000000 r __kcrctab_xor_blocks
0000000000000000 r __kstrtab_xor_blocks
0000000000000000 r __ksymtab_xor_blocks
0000000000000bb0 T xor_blocks
Another exported xor_blocks symbol in a module I created
nwatkins#kyoto:~$ nm mod-t1.ko | grep xor
0000000000000000 r __kcrctab_xor_blocks
0000000000000000 r __kstrtab_xor_blocks
0000000000000000 r __ksymtab_xor_blocks
0000000000000000 T xor_blocks
Error reported from insmod
nwatkins#kyoto:~$ sudo insmod mod-t1.ko
insmod: error inserting 'mod-t1.ko': -1 Invalid module format
Duplicate error message from dmesg
[422002.174033] mod_t1: exports duplicate symbol xor_blocks (owned by xor)

Resources