Project

General

Profile

Actions

Bug #1713

closed

suricata3.0 crash

Added by shengxin wang about 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Target version:
-
Affected Versions:
Effort:
Difficulty:
Label:

Description

debug info :

htp_connp_req_data: in state=REQ_CONNECT_CHECK, progress=REQ_HEADERS
htp_connp_req_data: in state=REQ_BODY_DETERMINE, progress=REQ_HEADERS
htp_connp_req_data: in state=REQ_FINALIZE, progress=REQ_HEADERS
htp_connp_req_data: in state=REQ_IDLE, progress=NULL
htp_connp_req_data: returning HTP_STREAM_DATA
Segmentation fault (core dumped)

coredump:
(gdb) bt
#0 0x00007f8741f8c434 in ?? ()
#1 0x0000000000000000 in ?? ()


Files

gdb.txt (15.3 KB) gdb.txt shengxin wang, 02/18/2016 06:18 AM
gdb_new.txt (41.5 KB) gdb_new.txt shengxin wang, 02/19/2016 06:46 AM
gdb_pcp.txt (21.4 KB) gdb_pcp.txt shengxin wang, 02/20/2016 08:11 PM
Actions #1

Updated by shengxin wang about 8 years ago

repeat every time

Actions #2

Updated by Victor Julien about 8 years ago

Please provide more info. What are the steps to reproduce?

Can you get a full backtrace? https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Reporting_Bugs

Actions #3

Updated by shengxin wang about 8 years ago

Thread 2 (Thread 0x7f98a91fc700 (LWP 24760)):
#0 SCACSearch (mpm_ctx=0x369e6a0, mpm_thread_ctx=0x7f98943ff6a0, pmq=0x7f98943ff6d0, buf=0x7f989bc810f2 <Address 0x7f989bc810f2 out of bounds>,
buflen=1428) at util-mpm-ac.c:1325
#1 0x00000000004b2957 in PacketPatternSearchWithStreamCtx (det_ctx=0x7f98943ff5a0, p=0x7f9894373af0) at detect-engine-mpm.c:190
#2 0x0000000000476d77 in DetectMpmPrefilter (de_ctx=0x25532c0, det_ctx=0x7f98943ff5a0, smsg=0x0, p=0x7f9894373af0, flags=4 '\004', alproto=0, has_state=0,
sms_runflags=0x7f98a91fa902 "\003") at detect.c:1086
#3 0x00000000004781f3 in SigMatchSignatures (th_v=0x38faf40, de_ctx=0x25532c0, det_ctx=0x7f98943ff5a0, p=0x7f9894373af0) at detect.c:1462
#4 0x0000000000479577 in Detect (tv=0x38faf40, p=0x7f9894373af0, data=0x7f98943ff5a0, pq=0x446dee0, postpq=0x0) at detect.c:2031
#5 0x00000000005a959b in TmThreadsSlotVarRun (tv=0x38faf40, p=0x7f9894373af0, slot=0x37865d0) at tm-threads.c:132
#6 0x000000000057f861 in TmThreadsSlotProcessPkt (tv=0x38faf40, s=0x37865d0, p=0x7f9894373af0) at tm-threads.h:149
#7 0x000000000058002e in ReceivePfringLoop (tv=0x38faf40, data=0x7f98943748c0, slot=0x48e8630) at source-pfring.c:361
#8 0x00000000005a9e11 in TmThreadsSlotPktAcqLoop (td=0x38faf40) at tm-threads.c:336
#9 0x00007f98dcf829d1 in start_thread () from /lib64/libpthread.so.0
#10 0x00007f98dc461b6d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f98c93fd700 (LWP 24753)):
#0 0x00007f98db2494f0 in ?? ()
#1 0x0000000000000000 in ?? ()
"gdb.txt" 208L, 15657C

build info:

./suricata --build-info
This is Suricata version 3.0 RELEASE
Features: PCAP_SET_BUFF LIBPCAP_VERSION_MAJOR=1 PF_RING AF_PACKET HAVE_PACKET_FANOUT LIBCAP_NG LIBNET1.1 HAVE_HTP_URI_NORMALIZE_HOOK PCRE_JIT HAVE_LIBJANSSON TLS
SIMD support: SSE_4_2 SSE_4_1 SSE_3
Atomic intrisics: 1 2 4 8 16 byte(s)
64-bits, Little-endian architecture
GCC version 4.4.7 20120313 (Red Hat 4.4.7-11), C version 199901
L1 cache line size (CLS)=64
thread local storage method: __thread
compiled with LibHTP v0.5.18, linked against LibHTP v0.5.18

Actions #4

Updated by Victor Julien about 8 years ago

Looks like this is the same issue as #1669.

Are you also on CentOS 6.7?

Actions #5

Updated by shengxin wang about 8 years ago

The os is centos 6.5

[root@bjzjm01-op-sec029007 ~]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final
[root@bjzjm01-op-sec029007 ~]#

Actions #6

Updated by shengxin wang about 8 years ago

the isssue 1669 is not resolved ? right?

The second issue is : the stack from the coredump can not find eth functuion, why?

Actions #7

Updated by shengxin wang about 8 years ago

it is always repeating.
how to debug it? what can I do it .
1)I teste suricata2.0.7, it exist this problem.
20 I use pcap mod ,it exist this problem

Actions #8

Updated by Victor Julien about 8 years ago

Can you reproduce the problem with a pcap file? If so, can you share that (privately)?

Actions #9

Updated by shengxin wang about 8 years ago

the traffic is 2G/s so the pacp file is too large.

I can share it . even you can see it through teamviewer or other IM .

Actions #10

Updated by Victor Julien about 8 years ago

Could you try something first?

git clone https://github.com/inliniac/suricata -b dev-fix-htp-v0
cd suricata
git clone https://github.com/glongo/libhtp -b 0.5.x
bash autogen.sh
./configure <your configure options>
make
make install

And see if that crashes too?

Actions #11

Updated by shengxin wang about 8 years ago

ok I try it

Actions #12

Updated by shengxin wang about 8 years ago

I use your version , it crash too.
I use dmesg find :
RxPcapeth0714224: segfault at 8 ip 00007f64aa8d28a2 sp 00007f6499a32110 error 4
RxPcapeth0614223: segfault at 8 ip 00007f64aa8d28a2 sp 00007f649a6c8110 error 4
RxPcapeth0414221: segfault at 8 ip 00007f64aa8d28a2 sp 00007f649bff4110 error 4
RxPcapeth0732382: segfault at 0 ip 00007f2381d7d4f0 sp 00007f2378d9c110 error 4
RxPcapeth0832383: segfault at 0 ip 00007f2381d7d4f0 sp 00007f235fff4110 error 4
RxPcapeth0532380: segfault at 0 ip 00007f2381d7d4f0 sp 00007f237a6c8110 error 4

Actions #13

Updated by shengxin wang about 8 years ago

Actions #14

Updated by Victor Julien about 8 years ago

That thread 19 backtrace looks bad:

Thread 19 (Thread 0x7f98ca5fe700 (LWP 24752)):
#0  0x0000000000479c8f in PacketCreateMask (p=0x0, mask=0x0, alproto=0, has_state=73640512, smsg=0x7f98bc385390, app_decoder_events=32664) at detect.c:2380
#1  0x000000000047815e in SigMatchSignatures (th_v=0x463aa40, de_ctx=0x25532c0, det_ctx=0x7f98bc3ff5a0, p=0x7f98bc373af0) at detect.c:1450
#2  0x0000000000479577 in Detect (tv=0x463aa40, p=0x7f98bc373af0, data=0x7f98bc3ff5a0, pq=0x463e260, postpq=0x0) at detect.c:2031
#3  0x00000000005a959b in TmThreadsSlotVarRun (tv=0x463aa40, p=0x7f98bc373af0, slot=0x4226b90) at tm-threads.c:132
#4  0x000000000057f861 in TmThreadsSlotProcessPkt (tv=0x463aa40, s=0x4226b90, p=0x7f98bc373af0) at tm-threads.h:149
#5  0x000000000058002e in ReceivePfringLoop (tv=0x463aa40, data=0x7f98bc3748c0, slot=0x4479880) at source-pfring.c:361
#6  0x00000000005a9e11 in TmThreadsSlotPktAcqLoop (td=0x463aa40) at m-threads.c:336
#7  0x00007f98dcf829d1 in start_thread () from /lib64/libpthread.so.0
#8  0x00007f98dc461b6d in clone () from /lib64/libc.so.6

Could you print *p for the frames below 0, so frames 1 to 5?

Actions #15

Updated by shengxin wang about 8 years ago

I use pcap ,no pf_ring
I find crash too.
this is new gdb_pcap.txt

Actions #16

Updated by shengxin wang about 8 years ago

I doubt something crash the stack, and so the crash stack is ??, no symobol tables

Actions #17

Updated by shengxin wang about 8 years ago

Victor Julien wrote:

That thread 19 backtrace looks bad:
[...]

Could you print *p for the frames below 0, so frames 1 to 5?

the core file is not exitsted. I alaways test the suricata to find priblems. so many core file .

Actions #18

Updated by shengxin wang about 8 years ago

RxPcapeth11155513: segfault at 8 ip 00007f2df80fd73b sp 00007f2de52c6220 error 4
[root@bjzjm01-op-sec029007 bin]# add
addftinfo addgnupghome addpart addr2line adduser
[root@bjzjm01-op-sec029007 bin]# addr2line -e suricata 00007f2df80fd73b
??:0

I use pcap mode , all crash in RxPcapeth
RxPcapeth0733263: segfault at 28 ip 00007fc87965160f sp 00007fc85bff4110 error 4
RxPcapeth0633262: segfault at 28 ip 00007fc87965160f sp 00007fc8712c6110 error 4

RxPcapeth0244649: segfault at 28 ip 00007ffbe30484f0 sp 00007ffbe2118110 error 4
RxPcapeth0745517: segfault at 0 ip 00007f9bfcc085d3 sp 00007f9be3d5f110 error 4
RxPcapeth0345513: segfault at 0 ip 00007f9bfcc085d3 sp 00007f9bfb042110 error 4

RxPcapeth08232145: segfault at 48 ip 00007fe04038d3c0 sp 00007fe0266c8110 error 4
RxPcapeth06232143: segfault at 48 ip 00007fe04038d3c0 sp 00007fe027ff4110 error 4

RxPcapeth06238331: segfault at 8 ip 00007f29e99b76ff sp 00007f29e179d110 error 4
RxPcapeth05238330: segfault at 8 ip 00007f29e99b76ff sp 00007f29e2433110 error 4

RxPcapeth11155513: segfault at 8 ip 00007f2df80fd73b sp 00007f2de52c6220 error 4

Actions #19

Updated by Victor Julien about 8 years ago

You can also run Suricata inside gdb:
gdb -ex run --args suricata <suri options>

Then when it crashes you can just do a 'bt' right away.

Actions #20

Updated by shengxin wang about 8 years ago

Victor Julien wrote:

You can also run Suricata inside gdb:
gdb -ex run --args suricata <suri options>

Then when it crashes you can just do a 'bt' right away.

[root@bjzjm01-op-sec029007 bin]# gdb -ex run --args ./suricata --runmode=workers -i eth0 -i eth1
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/&gt;...
Reading symbols from /data/sec/kids/usr/bin/suricata...done.
Starting program: /data/sec/kids/usr/bin/suricata --runmode=workers -i eth0 -i eth1

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffbffff700 (LWP 177821)]
0x00007ffff4fc23c0 in ?? ()
Missing separate debuginfos, use: debuginfo-install file-libs-5.04-21.el6.x86_64 glibc-2.12-1.149.el6_6.9.x86_64 libnet-1.1.6-7.el6.x86_64 libpcap-1.4.0-1.20130826git2dbcaa1.el6.x86_64 numactl-2.0.9-2.el6.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb)
(gdb)
(gdb)
(gdb) bt
#0 0x00007ffff4fc23c0 in ?? ()
#1 0x0000000002569b60 in ?? ()
#2 0x00007ffff4fc22c0 in ?? ()
#3 0x0000000000000001 in ?? ()
#4 0x0000000000000dac in ?? ()
#5 0x00007fffb83743be in ?? ()
#6 0x0000000000000dac in ?? ()
#7 0x00007fffb83743be in ?? ()
#8 0x00007fffb83742fa in ?? ()
#9 0x00007fffb83742f9 in ?? ()
#10 0x00007fffdc6ce01f in ?? ()
#11 0x00007fffb83742fb in ?? ()
#12 0x0000000000000002 in ?? ()
#13 0x00000000032ab2a0 in ?? ()
#14 0x0000000000000000 in ?? ()

i uee your method , but it take no effect.
how I do next?

Actions #21

Updated by shengxin wang about 8 years ago

Hi
I resolved the bug.
but I comment the code ,then no crash
suricata-3.0/src/flow.c
void FlowHandlePacket(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p) {
return; //add by me

Actions #22

Updated by Victor Julien about 8 years ago

Did you compile with debug symbols? (CFLAGS="-ggdb")

Wrt the change you made: that disables 70% of Suricata's functionality, so it's not really helpful :)

Actions #23

Updated by shengxin wang about 8 years ago

Victor Julien wrote:

Did you compile with debug symbols? (CFLAGS="-ggdb")

Wrt the change you made: that disables 70% of Suricata's functionality, so it's not really helpful :)

I use CFLAGS="-ggdb -o0" other thread stack is ok .
so I think there exist heap or stack overflow.
what need I do next?

Actions #24

Updated by Victor Julien about 8 years ago

Can you provide a fresh backtrace?

Actions #25

Updated by Victor Julien about 8 years ago

Could you try running the code in https://github.com/inliniac/suricata/pull/1912 ?

Actions #26

Updated by shengxin wang about 8 years ago

Victor Julien wrote:

Could you try running the code in https://github.com/inliniac/suricata/pull/1912 ?

i try it . it is all the same.

Actions #27

Updated by Victor Julien about 8 years ago

Can you try 3.0.1RC1? If it crashes, can you give full backtrace?

Actions #28

Updated by Victor Julien almost 8 years ago

Possibly related to #1805

Actions #29

Updated by Andreas Herz over 7 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF