Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jul 2019 12:08:08 +0000
From:      bugzilla-noreply@freebsd.org
To:        threads@FreeBSD.org
Subject:   [Bug 239142] pthread_set_name_np no longer allows NULL to clear the thread name
Message-ID:  <bug-239142-13406@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D239142

            Bug ID: 239142
           Summary: pthread_set_name_np no longer allows NULL to clear the
                    thread name
           Product: Base System
           Version: 12.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: threads
          Assignee: threads@FreeBSD.org
          Reporter: lew@perftech.com

pthread_set_name_np() previously allowed a NULL pointer to clear the thread
name.

In FreeBSD 12.0, the library will dereference the null pointer, leading to a
segment violation.

In /usr/src/lib/libthr/thread/thr_info.c, we have:

static void
thr_set_name_np(struct pthread *thread, const char *name)
{

        free(thread->name);
        thread->name =3D strdup(name);
}

The last line of the function should more correctly be:

        thread->name =3D name ? strdup(name) : NULL;

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-239142-13406>