NetBSD Problem Report #58150
From www@netbsd.org Sun Apr 14 13:00:20 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 195161A9239
for <gnats-bugs@gnats.NetBSD.org>; Sun, 14 Apr 2024 13:00:20 +0000 (UTC)
Message-Id: <20240414130018.BC88E1A923C@mollari.NetBSD.org>
Date: Sun, 14 Apr 2024 13:00:18 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: ld.elf_so is missing automatic tests for static thread-local storage error cases
X-Send-Pr-Version: www-1.0
>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!
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.