Bug #2986
closed
GNU TLS fallback: segfault on gnutls_rnd()
Added by fixeria about 6 years ago.
Updated about 6 years ago.
Description
According to the GNU TLS documentation, prior to 3.3.0 the library has to be
initialized by calling gnutls_global_init():
https://www.gnutls.org/manual/html_node/Initialization.html
while the recent versions are being initialized on load. This causes
segfault on osmo_get_rand_id() if a library version is lower than 3.3.0...
At the same time, in the configure.am we require gnutls >= 2.12.0.
- Related to Bug #2982: make check: sgsn test failed added
- Related to Bug #2981: make check: mgcp test failed added
- Related to Bug #2983: OsmoMSC crashes on LUR added
I have the following suggestions:
- Bump the minimal required version to 3.3.0;
- Initialize the library when libosmocore is loaded (DSO):
__attribute__((constructor))
static void on_dso_load_gnutls(void)
{
gnutls_global_init();
}
debian/wheezy (old-old-stable): 2.12.20-8+deb7u5
debian/jessie (old-stabe): 3.3.8-6+deb8u
debian/stretch (stable): 3.5.8-5+deb9u3
ubuntu/14.04 LTS: 3.2.11
ubuntu/16.04 LTS: 3.4.10
- Assignee changed from lynxis to laforge
laforge: can we increase the minimal version to 3.3.0?
sysmobts 201705: is using 3.5.9
sysmobts 201310: is using 2.12.23
So we would loose sysmobts 201310 and ubuntu 14.04
- Status changed from New to In Progress
- Assignee changed from laforge to lynxis
I think we should simply introduce an
#if GNUTLS_VERSION < 3.3.0
gnutls_global_init();
#endif
I would assume it's pretty straight-forward to do, and not a big burden
in order to gain wider backwards compatibility.
I've tried to reproduce this test in a vm with debian wheezy, but it didn't worked out.
/* compile with
* gcc -g -o test_osmo_get_rand_id /tmp/test_osmo_get_rand_id.c -l osmocore -l osmogsm
*/
#include <stdio.h>
#include <stdlib.h>
#include <osmocom/gsm/gsm_utils.h>
int main() {
char buffer[16] = { 0 };
printf("%s\n", osmo_hexdump(buffer, 16));
int rc = osmo_get_rand_id(buffer, 16);
printf("%s\n", osmo_hexdump(buffer, 16));
printf("rc = %d\n", rc);
exit(0);
}
- % Done changed from 0 to 100
- Status changed from In Progress to Feedback
- Status changed from Feedback to Stalled
- % Done changed from 100 to 90
- Status changed from Stalled to Resolved
- % Done changed from 90 to 100
Also available in: Atom
PDF