FreeRADIUS 1.0.4: SEGMENTATION FAULT
Hi all I'm facing a strange behaviour with Freeradius. The daemon starts and is able to authenticate accounts specified in the 'raddb/users' file. But if I uncomment the sql directive in the 'authorize' section (radius.conf), the deamon does not start: radius3:/usr/local/freeradius# radius3:/usr/local/freeradius# sbin/rc.radiusd start Starting FreeRADIUS:Tue Aug 23 17:54:52 2005 : Info: Starting - reading configuration files ... (I have to press ^C to stop the rc script) Running FreeRADIUS in debug mode (radiusd -sfxxyz -l stdout) I get the "Segmentation fault" message (more details is in .txt attachment). Background information - MySQL (v. 4.0.24): the mysql user 'radius' is able to connect to localhost' and has INSERT, SELECT, DELETE, UPDATE privileges - OS: Debian Linux 3.1 (sarge), kernel 2.6.8-2-686-smp - gcc -v: 3.3.5 - configuration command: ./configure --prefix=/usr/local/freeradius \ --with-logdir=/usr/local/freeradius/logs\ --with-radacctdir=/usr/local/freeradius/logs\ --with-raddbdir=/usr/local/freeradius/raddb --with-threads\ --with-ascend-binary \ --disable-shared \ --enable-developer - gdb radiusd: .. Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1076783616 (LWP 9291)] 0x080902ce in lt_dlsym (handle=0x815afc8, symbol=0x8159928 "rlm_sql_mysql") at ltdl.c:3330 3330 lensym = LT_STRLEN (symbol) + LT_STRLEN (handle->loader->sym_prefix) - /etc/hosts: has entries for both 'localhost' and the Internet host name. - strace radiusd: See radtrace-1.txt Note the message open("/usr/local/freeradius/lib/rlm_sql_mysql.la", O_RDONLY) = -1 ENOENT (No such file or directory) In fact I can't find any 'rlm_sql_mysql.la' file. No change removing the '--disable-shared' option. I'm new to FreeRADIUS and so I suspect a misconfiguration. Thanks in advance. Ciao, Davide
BugBuster <bugbuster@libero.it> wrote:
Running FreeRADIUS in debug mode (radiusd -sfxxyz -l stdout) I get the "Segmentation fault" message (more details is in .txt attachment).
You've included everything but the information requested in doc/bugs. My bet is that this is bug #98 http://bugs.freeradius.org/show_bug.cgi?id=98 Alan DeKok.
Hi Alan. I compiled with '--disable-shared' but on Debian Linux FreeRADIUS does not work with MySQL. So I recompiled on Red Hat Enterprise 3 using the same configuration command: ./configure --prefix=/usr/local/freeradius \ --with-logdir=/usr/local/freeradius/logs\ --with-radacctdir=/usr/local/freeradius/logs\ --with-raddbdir=/usr/local/freeradius/raddb --with-threads\ --with-ascend-binary \ --disable-shared \ --enable-developer This time radiusd starts and listens for requests. Unfortunately this does not solve my problem. Any ideas ? Thank you. Davide On Tuesday 23 August 2005 19:02, Alan DeKok wrote:
BugBuster <bugbuster@libero.it> wrote:
Running FreeRADIUS in debug mode (radiusd -sfxxyz -l stdout) I get the "Segmentation fault" message (more details is in .txt attachment).
You've included everything but the information requested in doc/bugs.
My bet is that this is bug #98
http://bugs.freeradius.org/show_bug.cgi?id=98
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
BugBuster wrote:
I compiled with '--disable-shared' but on Debian Linux FreeRADIUS does not work with MySQL.
On Debian, compile FreeRADIUS with the command dpkg-buildpackage. This will prior check whether all the necessary packages are installed on your system. $ cd freeradius-1.0.4 $ fakeroot dpkg-buildpackage -b $ sudo dpkg -i ../freeradius_1.0.4-0_i386.deb -- Nicolas Baradakis
You've included everything but the information requested in doc/bugs.
My bet is that this is bug #98
http://bugs.freeradius.org/show_bug.cgi?id=98
Alan DeKok.
Alan : What I have found when using rlm_sql_mysql in FreeBSD ( and probably other OS ) is that radiusd segfault happens if num_sql_socks is set to > 1. I got the same results even when disabling shared libs. Take a look at the debug output of gdb : ============================================================ [snip] rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (sql): Attempting to connect to radius@localhost:/radius rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_mysql #0 rlm_sql_mysql: Starting connect to MySQL server for #0 rlm_sql (sql): Connected new DB handle, #0 rlm_sql (sql): starting 1 rlm_sql (sql): Attempting to connect rlm_sql_mysql #1 Program received signal SIGSEGV, Segmentation fault. 0x483b7a48 in sql_init_socket (sqlsocket=0x8092720, config=0x8096300) at sql_mysql.c:71 71 memset(mysql_sock, 0, sizeof(*mysql_sock)); (gdb) ================================================ Regards Richard Cotrina
"Richard Cotrina" <rcc@speedy.net.pe> wrote:
Program received signal SIGSEGV, Segmentation fault. 0x483b7a48 in sql_init_socket (sqlsocket=0x8092720, config=0x8096300) at sql_mysql.c:71 71 memset(mysql_sock, 0, sizeof(*mysql_sock));
What is the value of mysql_sock? Is the data it's pointing to of the right size? From reading the code, I'm not sure how the memset would die... Alan DeKok.
On Wed, 24 Aug 2005, Alan DeKok wrote:
Program received signal SIGSEGV, Segmentation fault. 0x483b7a48 in sql_init_socket (sqlsocket=0x8092720, config=0x8096300) at sql_mysql.c:71 71 memset(mysql_sock, 0, sizeof(*mysql_sock));
What is the value of mysql_sock?
The value used for num_sql_sock is 5. That's the default value in sql.conf. The value of mysql_sock shown by gdb is : (gdb) display mysql_sock 1: mysql_sock = (rlm_sql_mysql_sock *) 0x5f6c7173 I added more info at : http://bugs.freeradius.org/show_bug.cgi?id=271 Richard Cotrina
Richard Cotrina <rcc@speedy.net.pe> wrote:
(gdb) display mysql_sock 1: mysql_sock = (rlm_sql_mysql_sock *) 0x5f6c7173
That's bad. That's very bad. It's the ASCII string "sql_", interpreted as a pointer on an x86 machine. No wonder it crashes. The short answer is that there appears to be some memory corruption. Can you print out the contents of "sqlsocket", too? Both the structure contents, and the *hex* contents of that area of memory. It looks like the sqlsocket pointer that's being passed is bad. Alan DeKok.
Alan DeKok wrote:
Richard Cotrina <rcc@speedy.net.pe> wrote:
(gdb) display mysql_sock 1: mysql_sock = (rlm_sql_mysql_sock *) 0x5f6c7173
That's bad. That's very bad. It's the ASCII string "sql_", interpreted as a pointer on an x86 machine. No wonder it crashes.
The short answer is that there appears to be some memory corruption. Can you print out the contents of "sqlsocket", too? Both the structure contents, and the *hex* contents of that area of memory.
It looks like the sqlsocket pointer that's being passed is bad.
The infringing pointer "mysql_sock" contains the return value of a "malloc" three lines above. Perhaps something messed up the memory so badly that malloc returns garbage. It's not easy to find out where the problem is : on my system (Debian), I can run radiusd in valgrind with num_sql_socks = 20 and I get no errors from valgrind. -- Nicolas Baradakis
(gdb) display mysql_sock 1: mysql_sock = (rlm_sql_mysql_sock *) 0x5f6c7173
That's bad. That's very bad. It's the ASCII string "sql_", interpreted as a pointer on an x86 machine. No wonder it crashes.
The short answer is that there appears to be some memory corruption. Can you print out the contents of "sqlsocket", too? Both the structure contents, and the *hex* contents of that area of memory.
These values are what I've got : (gdb) display sqlsocket 1: sqlsocket = (SQLSOCK *) 0x8092720 (gdb) x 0x8092720 0x8092720: 0x00000001 (gdb) info stack 0x8092720 #0 0x483b7a48 in sql_init_socket (sqlsocket=0x8092720, config=0x8096300) at sql_mysql.c:71 #1 0x483660b5 in connect_single_socket (sqlsocket=0x8092720, inst=0x8092680) at sql.c:70 #2 0x4836621f in sql_init_socketpool (inst=0x8092680) at sql.c:130 #3 0x48364905 in rlm_sql_instantiate (conf=0x8093840, instance=0x815e508) at rlm_sql.c:707 #4 0x80544ad in find_module_instance (instname=0x80946e0 "sql") at modules.c:358 #5 0x80556fa in do_compile_modsingle (component=1, ci=0x80977e0, filename=0x805e6c7 "radiusd.conf", grouptype=0, modname=0xbfbfeacc) at modcall.c:814 #6 0x805576a in compile_modsingle (component=1, ci=0x80977e0, filename=0x805e6c7 "radiusd.conf", modname=0xbfbfeacc) at modcall.c:829 #7 0x80548be in load_component_section (cs=0x8097720, comp=1, filename=0x805e6c7 "radiusd.conf") at modules.c:568 #8 0x8054d3e in setup_modules () at modules.c:858 #9 0x804c87c in main (argc=2, argv=0xbfbffc20) at radiusd.c:960 (gdb) f #0 0x483b7a48 in sql_init_socket (sqlsocket=0x8092720, config=0x8096300) at sql_mysql.c:71 71 memset(mysql_sock, 0, sizeof(*mysql_sock));
"Richard Cotrina" <rcc@speedy.net.pe> wrote:
Can you print out the contents of "sqlsocket", too? Both the structure contents, and the *hex* contents of that area of memory.
These values are what I've got :
(gdb) display sqlsocket 1: sqlsocket = (SQLSOCK *) 0x8092720
(gdb) x 0x8092720 0x8092720: 0x00000001
And the *rest* of the data? It may be easier to give me an account on the machine. Email me privately, and I'll get you a copy of my SSH key. Alan DeKok.
participants (4)
-
Alan DeKok -
BugBuster -
Nicolas Baradakis -
Richard Cotrina