RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1540580 - Radius service crashes with "Bad talloc magic value - unknown value" when using module sql rlm_sql
Summary: Radius service crashes with "Bad talloc magic value - unknown value" when usi...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: freeradius
Version: 7.4
Hardware: Unspecified
OS: Linux
urgent
high
Target Milestone: rc
: ---
Assignee: Alex Scheel
QA Contact: Jaroslav Aster
URL:
Whiteboard:
Depends On:
Blocks: 1551068 1551069
TreeView+ depends on / blocked
 
Reported: 2018-01-31 12:59 UTC by Welterlen Benoit
Modified: 2021-09-09 13:07 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1551068 1551069 (view as bug list)
Environment:
Last Closed: 2018-11-14 17:33:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Experimental fixed SRPM for test (3.01 MB, application/x-rpm)
2018-01-31 12:59 UTC, Welterlen Benoit
no flags Details

Description Welterlen Benoit 2018-01-31 12:59:19 UTC
Created attachment 1388946 [details]
Experimental fixed SRPM for test

Description of problem:
Radius service crashes with "Bad talloc magic value - unknown value" when using module sql rlm_sql because of a double free of a talloc.

Version-Release number of selected component (if applicable):
freeradius-3.0.13-8

How reproducible:
With 

Steps to Reproduce:
1.The crash happens when the radius receives an accounting packet and the sql query does not match to any existing row in the accounting table, i.e. there is not a Start entry in the accounting table.
In the code, the talloc struct is freed 2 times in the loop and the finish part.

Actual results:
crash with :
rlm_sql_mysql: Rows matched: 0  Changed: 0  Warnings: 0
(8) sql: SQL query returned: success
(8) sql: 0 record(s) updated
(8) sql: Trying next query...
(8) sql: Ignoring null query
Bad talloc magic value - unknown value

talloc abort: Bad talloc magic value - unknown value

Expected results:
no crash

Additional info:
Patch :
--- 1/src/modules/rlm_sql/rlm_sql.c     2018-01-31 10:11:36.000000000 +0100
+++ 2/src/modules/rlm_sql/rlm_sql.c     2018-01-31 10:11:50.000000000 +0100
@@ -1439,7 +1439,6 @@
                if (!*expanded) {
                        RDEBUG("Ignoring null query");
                        rcode = RLM_MODULE_NOOP;
-                       talloc_free(expanded);

                        goto finish;
                }

Comment 3 Nikolai Kondrashov 2018-02-01 13:51:13 UTC
Thank you for the report and the fix, Welterlen! Have you talked to upstream about this issue, have they verified the fix is correct to their understanding?

Comment 6 Nikolai Kondrashov 2018-02-13 15:05:31 UTC
Fix appears correct and is submitted upstream: https://github.com/FreeRADIUS/freeradius-server/pull/2180

Thank you, Benoit!

Comment 7 Nikolai Kondrashov 2018-02-13 15:11:23 UTC
Fix merged upstream.

Comment 15 Jaroslav Aster 2018-04-16 10:16:38 UTC
Hi all,

unfortunately I wasn't able to reproduce this bug. I configured radiusd to use mariadb and sent some accounting request via radclient, playing with database and so on, but nothing happen.

Maybe there is some non-standard sql query in /etc/raddb/mods-config/sql/main/mysql/queries.conf?


Note You need to log in before you can comment on or make changes to this bug.