Fri 31 Aug 2007 10:22:59 AM UTC, comment #2:
Seems pretty much similar to what I've experienced. I got segfault with free() at the same point. (Using CVS version as of 2007-08-31 11:00:00 GMT+3)
(gdb) bt
#0 0xb7d2c709 in free () from /lib/tls/i686/cmov/libc.so.6
#1 0xb7e295b4 in gn_sms_send (data=0x4e, state=0x8078790) at gsm-sms.c:1328
#2 0x0804a641 in A_SendSMSMessage (data=0x8074930) at lowlevel.c:285
#3 0x0804acb3 in Connect (phone=0x80568b0) at lowlevel.c:418
Somehow data->raw_sms pointer gets messed up when SMS message is sent. (And then free() messes up with data pointer.) Trivial workaround is to store malloc'd pointer seperately and use it for free(). At least it fixes problems for me.
RCS file: /sources/gnokii/gnokii/common/gsm-sms.c,v
retrieving revision 1.164
diff -u -r1.164 gsm-sms.c
--- gsm-sms.c 29 Jul 2007 17:41:43 -0000 1.164
+++ gsm-sms.c 31 Aug 2007 10:13:58 -0000
@@ -1299,10 +1299,11 @@
GNOKII_API gn_error gn_sms_send(gn_data data, struct gn_statemachine state)
{
gn_error error = GN_ERR_NONE;
+ void *rawsms;
if (!data->sms) return GN_ERR_INTERNALERROR;
- data->raw_sms = malloc(sizeof(*data->raw_sms));
+ rawsms = data->raw_sms = malloc(sizeof(*data->raw_sms));
memset(data->raw_sms, 0, sizeof(*data->raw_sms));
data->raw_sms->status = GN_SMS_Sent;
@@ -1325,7 +1326,7 @@
dprintf("Sending\n");
error = gn_sm_functions(GN_OP_SendSMS, data, state);
cleanup:
- free(data->raw_sms);
+ free(rawsms);
data->raw_sms = NULL;
return error;
}
(file #13843)
|
Fri 20 Jul 2007 06:08:19 AM UTC, original submission:
I use smsd with mysql and the daemon crashes after a new message is sent. The message is sent by the phone, then smsd crashes and the flags on outbox database are not updated.
I tried with several versions of gnokii, without success. This debug was made using the lastest (today) version from CVS.
GNOKII Version 0.6.17cvs
smsd - version 1.4-cvs (20041011)
Phone Model: Samsung SGH-E350E
----gnokiirc---------------------
[global]
port = /dev/ttyACM0
model = AT
initlength = default
connection = serial
use_locking = yes
serial_baudrate = 9600
handshake = software
smsc_timeout = 10
[gnokiid]
bindir = /usr/sbin/
[connect_script]
TELEPHONE = 12345678
[disconnect_script]
[logging]
debug = on
rlpdebug = off
xdebug = off
-------------------------------------------------------
DEBUG OUTPUT:
LOG: debug mask is 0x1
Config read from file /etc/gnokiirc.
Lockfile /var/lock/LCK..ttyACM0 is stale. Overriding it..
phone instance config:
model: AT
port_device: /dev/ttyACM0
connection_type: 0
init_length: 0
serial_baudrate: 9600
serial_write_usleep: -1
hardware_handshake: 0
require_dcd: 0
smsc_timeout: 100
connect_script:
disconnect_script:
rfcomm_cn: 1
sm_retry: off
Initializing AT capable mobile phone ...
Serial device: opening device /dev/ttyACM0
Serial device: setting RTS to high and DTR to high
Message sent: 0x00 / 0x0004
41 54 5a 0d | ATZ
write: [ATZ<cr>]
read : [ATZ<cr><cr><lf>OK<cr><lf>]
Message received: 0x00 / 0x000a
02 41 54 5a 0d 0d 0a 4f 4b 0d | ATZ OK
Received message type 00
Message sent: 0x00 / 0x0005
41 54 45 31 0d | ATE1
write: [ATE1<cr>]
read : [ATE1<cr><cr><lf>OK<cr><lf>]
Message received: 0x00 / 0x000b
02 41 54 45 31 0d 0d 0a 4f 4b 0d | ATE1 OK
Received message type 00
Message sent: 0x00 / 0x000a
41 54 2b 43 4d 45 45 3d 31 0d | AT+CMEE=1
write: [AT+CMEE=1<cr>]
read : [AT+CMEE=1<cr><cr><lf>OK<cr><lf>]
Message received: 0x00 / 0x0010
02 41 54 2b 43 4d 45 45 3d 31 0d 0d 0a 4f 4b 0d | AT+CMEE=1 OK
Received message type 00
Message sent: 0x06 / 0x0008
41 54 2b 43 47 4d 4d 0d | AT+CGMM
write: [AT+CGMM<cr>]
read : [AT+CGMM<cr><cr><lf>SAMSUNG SGH-E350E<cr><lf><cr><lf>OK<cr><lf>]
Message received: 0x06 / 0x0023
02 41 54 2b 43 47 4d 4d 0d 0d 0a 53 41 4d 53 55 | AT+CGMM SAMSU
4e 47 20 53 47 48 2d 45 33 35 30 45 0d 0a 0d 0a | NG SGH-E350E
4f 4b 0d | OK
Received message type 06
Message sent: 0x06 / 0x0008
41 54 2b 43 47 4d 49 0d | AT+CGMI
write: [AT+CGMI<cr>]
read : [AT+CGMI<cr><cr><lf>SAMSUNG<cr><lf><cr><lf>OK<cr><lf>]
Message received: 0x06 / 0x0019
02 41 54 2b 43 47 4d 49 0d 0d 0a 53 41 4d 53 55 | AT+CGMI SAMSU
4e 47 0d 0a 0d 0a 4f 4b 0d | NG OK
Received message type 06
Message sent: 0x61 / 0x0009
41 54 2b 43 53 43 53 3f 0d | AT+CSCS?
write: [AT+CSCS?<cr>]
read : [AT+CSCS?<cr><cr><lf>+CSCS: "GSM"<cr><lf><cr><lf>OK<cr><lf>]
Message received: 0x61 / 0x001f
02 41 54 2b 43 53 43 53 3f 0d 0d 0a 2b 43 53 43 | AT+CSCS? +CSC
53 3a 20 22 47 53 4d 22 0d 0a 0d 0a 4f 4b 0d | S: "GSM" OK
Received message type 61
Initialisation completed
Message sent: 0x06 / 0x0008
41 54 2b 43 47 4d 4d 0d | AT+CGMM
write: [AT+CGMM<cr>]
read : [AT+CGMM<cr><cr><lf>SAMSUNG SGH-E350E<cr><lf><cr><lf>OK<cr><lf>]
Message received: 0x06 / 0x0023
02 41 54 2b 43 47 4d 4d 0d 0d 0a 53 41 4d 53 55 | AT+CGMM SAMSU
4e 47 20 53 47 48 2d 45 33 35 30 45 0d 0a 0d 0a | NG SGH-E350E
4f 4b 0d | OK
Received message type 06
Message sent: 0x00 / 0x000d
41 54 2b 43 50 4d 53 3d 22 53 4d 22 0d | AT+CPMS="SM"
write: [AT+CPMS="SM"<cr>]
read : [AT+CPMS="SM"<cr><cr><lf>+CPMS: 0,50,0,50,0,50<cr><lf><cr><lf>OK<cr><lf>]
Message received: 0x00 / 0x002c
02 41 54 2b 43 50 4d 53 3d 22 53 4d 22 0d 0d 0a | AT+CPMS="SM"
2b 43 50 4d 53 3a 20 30 2c 35 30 2c 30 2c 35 30 | +CPMS: 0,50,0,50
2c 30 2c 35 30 0d 0a 0d 0a 4f 4b 0d | ,0,50 OK
Received message type 00
Message sent: 0x12 / 0x0009
41 54 2b 43 50 4d 53 3f 0d | AT+CPMS?
write: [AT+CPMS?<cr>]
read : [AT+CPMS?<cr><cr><lf>+CPMS: "SM",0,50,"SM",0,50,"SM",0,50<cr><lf><cr><lf>OK<cr><lf>]
Message received: 0x12 / 0x0037
02 41 54 2b 43 50 4d 53 3f 0d 0d 0a 2b 43 50 4d | AT+CPMS? +CPM
53 3a 20 22 53 4d 22 2c 30 2c 35 30 2c 22 53 4d | S: "SM",0,50,"SM
22 2c 30 2c 35 30 2c 22 53 4d 22 2c 30 2c 35 30 | ",0,50,"SM",0,50
0d 0a 0d 0a 4f 4b 0d | OK
Received message type 12
Message sent: 0x23 / 0x0009
41 54 2b 43 53 43 41 3f 0d | AT+CSCA?
write: [AT+CSCA?<cr>]
read : [AT+CSCA?<cr><cr><lf>+CSCA: "+553191938200",145<cr><lf><cr><lf>OK<cr><lf>]
Message received: 0x23 / 0x002d
02 41 54 2b 43 53 43 41 3f 0d 0d 0a 2b 43 53 43 | AT+CSCA? +CSC
41 3a 20 22 2b 35 35 33 31 39 31 39 33 38 32 30 | A: "+55319193820
30 22 2c 31 34 35 0d 0a 0d 0a 4f 4b 0d | 0",145 OK
Received message type 23
General Data Coding
dcs: 0x0
Length: 0x90
user_data_length: 0x7e
ValidityIndicator: 2
user_data: 50E953C82C364120A40E657D27A1A06158FC0659CB7272F915CBC95C311BCE25ABD15C32590A549CD3C3E4B70E457C5E9D 2910314C0FEB5046791AA4ACB34132180826D3CD64BA9A0C249452413218EC96023D85531D6A284D5293C32013D40221DF733AA8EA969 7C3637458CC2E8350B19CCC15B3E15CB21ACD2593A552
Sending
Message sent: 0x63 / 0x000a
41 54 2b 43 4d 47 46 3d 30 0d | AT+CMGF=0
write: [AT+CMGF=0<cr>]
read : [AT+CMGF=0<cr><cr><lf>OK<cr><lf>]
Message received: 0x63 / 0x0010
02 41 54 2b 43 4d 47 46 3d 30 0d 0d 0a 4f 4b 0d | AT+CMGF=0 OK
Received message type 63
PDU mode set
Sending initial sequence
Message sent: 0x64 / 0x000c
41 54 2b 43 4d 47 53 3d 31 33 39 0d | AT+CMGS=139
write: [AT+CMGS=139<cr>]
read : [AT+CMGS=139<cr><cr><lf>> ]
Message received: 0x64 / 0x0010
01 41 54 2b 43 4d 47 53 3d 31 33 39 0d 0d 0a 3e | AT+CMGS=139 >
Received message type 64
Got response 0
Sending frame: 079155131939280011000A8153198973220000AA9050E953C82C364120A40E657D27A1A06158FC0659CB7272F915CB C95C311BCE25ABD15C32590A549CD3C3E4B70E457C5E9D2910314C0FEB5046791AA4ACB34132180826D3CD64BA9A0C249452413218EC9 6023D85531D6A284D5293C32013D40221DF733AA8EA9697C3637458CC2E8350B19CCC15B3E15CB21ACD2593A552
Message sent: 0x21 / 0x0127
30 37 39 31 35 35 31 33 31 39 33 39 32 38 30 30 | 0791551319392800
31 31 30 30 30 41 38 31 35 33 31 39 38 39 37 33 | 11000A8153198973
32 32 30 30 30 30 41 41 39 30 35 30 45 39 35 33 | 220000AA9050E953
43 38 32 43 33 36 34 31 32 30 41 34 30 45 36 35 | C82C364120A40E65
37 44 32 37 41 31 41 30 36 31 35 38 46 43 30 36 | 7D27A1A06158FC06
35 39 43 42 37 32 37 32 46 39 31 35 43 42 43 39 | 59CB7272F915CBC9
35 43 33 31 31 42 43 45 32 35 41 42 44 31 35 43 | 5C311BCE25ABD15C
33 32 35 39 30 41 35 34 39 43 44 33 43 33 45 34 | 32590A549CD3C3E4
42 37 30 45 34 35 37 43 35 45 39 44 32 39 31 30 | B70E457C5E9D2910
33 31 34 43 30 46 45 42 35 30 34 36 37 39 31 41 | 314C0FEB5046791A
41 34 41 43 42 33 34 31 33 32 31 38 30 38 32 36 | A4ACB34132180826
44 33 43 44 36 34 42 41 39 41 30 43 32 34 39 34 | D3CD64BA9A0C2494
35 32 34 31 33 32 31 38 45 43 39 36 30 32 33 44 | 52413218EC96023D
38 35 35 33 31 44 36 41 32 38 34 44 35 32 39 33 | 85531D6A284D5293
43 33 32 30 31 33 44 34 30 32 32 31 44 46 37 33 | C32013D40221DF73
33 41 41 38 45 41 39 36 39 37 43 33 36 33 37 34 | 3AA8EA9697C36374
35 38 43 43 32 45 38 33 35 30 42 31 39 43 43 43 | 58CC2E8350B19CCC
31 35 42 33 45 31 35 43 42 32 31 41 43 44 32 35 | 15B3E15CB21ACD25
39 33 41 35 35 32 1a | 93A552
write: [079155131939280011000A8153198973220000AA9050E953C82C364120A40E657D27A1A06158FC0659CB7272F915CBC95C311 BCE25ABD15C32590A549CD3C3E4B70E457C5E9D2910314C0FEB5046791AA4ACB34132180826D3CD64BA9A0C249452413218EC96023D85 531D6A284D5293C32013D40221DF733AA8EA9697C3637458CC2E8350B19CCC15B3E15CB21ACD2593A552^Z]
read : [079155131939280011000A8153198973220000AA9050E953C82C364120A40E657D27A1A06158FC0659CB7272F915CBC95C311 BCE25ABD15C32590A549CD3C3E4B70E457C5E9D2910314C0FEB5046791AA4ACB34132180826D3CD64BA9A0C249452413218EC96023D85 531D6A284D5293C32013D40221DF733AA8EA9697C3637458CC2E8350B19CCC15B3E15CB21ACD2593A552^Z<cr><lf>+CMGS: 107<cr>< lf><cr><lf>OK<cr><lf>]
Message received: 0x21 / 0x013b
02 30 37 39 31 35 35 31 33 31 39 33 39 32 38 30 | 079155131939280
30 31 31 30 30 30 41 38 31 35 33 31 39 38 39 37 | 011000A815319897
33 32 32 30 30 30 30 41 41 39 30 35 30 45 39 35 | 3220000AA9050E95
33 43 38 32 43 33 36 34 31 32 30 41 34 30 45 36 | 3C82C364120A40E6
35 37 44 32 37 41 31 41 30 36 31 35 38 46 43 30 | 57D27A1A06158FC0
36 35 39 43 42 37 32 37 32 46 39 31 35 43 42 43 | 659CB7272F915CBC
39 35 43 33 31 31 42 43 45 32 35 41 42 44 31 35 | 95C311BCE25ABD15
43 33 32 35 39 30 41 35 34 39 43 44 33 43 33 45 | C32590A549CD3C3E
34 42 37 30 45 34 35 37 43 35 45 39 44 32 39 31 | 4B70E457C5E9D291
30 33 31 34 43 30 46 45 42 35 30 34 36 37 39 31 | 0314C0FEB5046791
41 41 34 41 43 42 33 34 31 33 32 31 38 30 38 32 | AA4ACB3413218082
36 44 33 43 44 36 34 42 41 39 41 30 43 32 34 39 | 6D3CD64BA9A0C249
34 35 32 34 31 33 32 31 38 45 43 39 36 30 32 33 | 452413218EC96023
44 38 35 35 33 31 44 36 41 32 38 34 44 35 32 39 | D85531D6A284D529
33 43 33 32 30 31 33 44 34 30 32 32 31 44 46 37 | 3C32013D40221DF7
33 33 41 41 38 45 41 39 36 39 37 43 33 36 33 37 | 33AA8EA9697C3637
34 35 38 43 43 32 45 38 33 35 30 42 31 39 43 43 | 458CC2E8350B19CC
43 31 35 42 33 45 31 35 43 42 32 31 41 43 44 32 | C15B3E15CB21ACD2
35 39 33 41 35 35 32 1a 0d 0a 2b 43 4d 47 53 3a | 593A552 +CMGS:
20 31 30 37 0d 0a 0d 0a 4f 4b 0d | 107 OK
Received message type 21
Message sent okay
- glibc detected *** /usr/local/sbin/smsd: double free or corruption (!prev): 0x09931e40 ***
======= Backtrace: =========
/lib/libc.so.6[0x1f01e0]
/lib/libc.so.6(__libc_free+0x77)[0x1f072b]
/usr/local/sbin/smsd[0x804a671]
/usr/local/sbin/smsd[0x804ac09]
/lib/libpthread.so.0[0x65fbd4]
/lib/libc.so.6(__clone+0x5e)[0x2574fe]
======= Memory map: ========
00111000-0017c000 r-xp 00000000 03:01 4778698 /usr/local/lib/libgnokii.so.3.2.0
0017c000-00180000 rwxp 0006b000 03:01 4778698 /usr/local/lib/libgnokii.so.3.2.0
00180000-00189000 rwxp 00180000 00:00 0
00189000-0018b000 r-xp 00000000 03:01 8731986 /lib/libdl-2.3.6.so
0018b000-0018c000 r-xp 00001000 03:01 8731986 /lib/libdl-2.3.6.so
0018c000-0018d000 rwxp 00002000 03:01 8731986 /lib/libdl-2.3.6.so
0018d000-002b0000 r-xp 00000000 03:01 8731978 /lib/libc-2.3.6.so
002b0000-002b2000 r-xp 00122000 03:01 8731978 /lib/libc-2.3.6.so
002b2000-002b4000 rwxp 00124000 03:01 8731978 /lib/libc-2.3.6.so
002b4000-002b6000 rwxp 002b4000 00:00 0
002b6000-002b8000 r-xp 00000000 03:01 5103726 /usr/local/lib/smsd/libmysql.so
002b8000-002b9000 rwxp 00002000 03:01 5103726 /usr/local/lib/smsd/libmysql.so
002b9000-002fe000 r-xp 00000000 03:01 5007124 /usr/lib/mysql/libmysqlclient.so.14.0.0
002fe000-003d8000 rwxp 00045000 03:01 5007124 /usr/lib/mysql/libmysqlclient.so.14.0.0
003d8000-003db000 rwxp 003d8000 00:00 0
003db000-003fe000 r-xp 00000000 03:01 8731988 /lib/libm-2.3.6.so
003fe000-003ff000 r-xp 00022000 03:01 8731988 /lib/libm-2.3.6.so
003ff000-00400000 rwxp 00023000 03:01 8731988 /lib/libm-2.3.6.so
00488000-00489000 r-xp 00000000 03:01 4840420 /usr/lib/gconv/ISO8859-1.so
00489000-0048b000 rwxp 00000000 03:01 4840420 /usr/lib/gconv/ISO8859-1.so
004cf000-004e9000 r-xp 00000000 03:01 8731976 /lib/ld-2.3.6.so
004e9000-004ea000 r-xp 00019000 03:01 8731976 /lib/ld-2.3.6.so
004ea000-004eb000 rwxp 0001a000 03:01 8731976 /lib/ld-2.3.6.so
00545000-00546000 r-xp 00545000 00:00 0
00618000-0061e000 r-xp 00000000 03:01 4786460 /usr/lib/libusb-0.1.so.4.4.2
0061e000-00620000 rwxp 00005000 03:01 4786460 /usr/lib/libusb-0.1.so.4.4.2
00645000-00657000 r-xp 00000000 03:01 4782899 /usr/lib/libz.so.1.2.2.2
00657000-00658000 rwxp 00011000 03:01 4782899 sh: line 1: 26668 Abortado /usr/local/sbin/sms d --user smsd --password xxxxx --db smsd --host xxxxxx --module mysql -f /var/log/smsd.log -i 10
|