Thread local storage issue

Floyd Brown flobro30101 at gmail.com
Tue Mar 17 17:49:23 UTC 2020


Using 2019.11 and I having issues with mkfs.ext4 (mke2fs) with a segfault
in libuuid, more specifically lib/randutils.c:67:
...
#ifdef DO_JRAND_MIX
        ul_jrand_seed[0] = getpid() ^ (tv.tv_sec & 0xFFFF);
...

ul_jrand_seed is defined as follows:

#ifdef HAVE_TLS
#define THREAD_LOCAL static __thread
#else
#define THREAD_LOCAL static
#endif

#if defined(__linux__) && defined(__NR_gettid) && defined(HAVE_JRAND48)
#define DO_JRAND_MIX
THREAD_LOCAL unsigned short ul_jrand_seed[3];
#endif


When attempting to store the result  in the ul_jrand_seed[0], we get a
segfault. Using GDB, i attempted to look at the variable address which is
reported as invalid.

I have NTPL enabled in my busybox build but ---?

What am I missing? I undefined the THREAD_LOCAL define for the variable and
it works.

Any Idea what I am missing?



Thanks

Floyd Brown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.zip
Type: application/zip
Size: 18215 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20200317/baabed95/attachment.zip>


More information about the uClibc mailing list