NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/58150: ld.elf_so is missing automatic tests for static thread-local storage error cases



>Number:         58150
>Category:       bin
>Synopsis:       ld.elf_so is missing automatic tests for static thread-local storage error cases
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 14 13:05:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9
>Organization:
The NetBSD_elf.so Foundation
>Environment:
>Description:
There are two error cases in static thread-local storage, the `initial-exec' model, that ld.elf_so rejects:

    263 	if (_rtld_tls_static_space) {
    264 		if (obj->tlsinitsize) {
    265 			_rtld_error("%s: Use of initialized "
    266 			    "Thread Local Storage with model initial-exec "
    267 			    "and dlopen is not supported",
    268 			    obj->path);
    269 			return -1;
    270 		}
    271 		if (next_offset > _rtld_tls_static_space) {
    272 			_rtld_error("%s: No space available "
    273 			    "for static Thread Local Storage",
    274 			    obj->path);
    275 			return -1;
    276 		}
    277 	}

https://nxr.netbsd.org/xref/src/libexec/ld.elf_so/tls.c?r=1.19#263

We added an extensive set of automatic tests for extern TLS last year when working on https://gnats.netbsd.org/57445 and https://gnats.netbsd.org/50277, but I can't find an automatic test that verifies these edge cases fail gracefully, with these error messages in dlerror on dlopen or with these error messages to stderr on exec.
>How-To-Repeat:
search for automatic tests of these error cases
>Fix:
Yes, please!



Home | Main Index | Thread Index | Old Index