From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9BE643889C31; Sun, 8 Aug 2021 05:15:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BE643889C31 From: "alxchk at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug nptl/24776] pthread_key_create, pthread_setspecific are incompatible with dlmopen Date: Sun, 08 Aug 2021 05:15:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: nptl X-Bugzilla-Version: 2.30 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: alxchk at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: security- X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2021 05:15:25 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D24776 Oleksii Shevchuk changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alxchk at gmail dot com --- Comment #11 from Oleksii Shevchuk --- /tmp > cat ldr.c=20 #define _GNU_SOURCE #include #include #include #include int main() { pthread_key_t key =3D 0xFFFFFFFF; pthread_key_create(&key, NULL); pthread_setspecific(key, (void*) 0xDEADBEEF); printf("[tid=3D%lx] Key created: %u with value %p\n", pthread_self(), k= ey, pthread_getspecific(key)); printf("[New LMID]\n"); void *ldr2 =3D dlmopen(LM_ID_NEWLM, "./ldr2.so", RTLD_NOW | RTLD_LOCAL); if (!ldr2) { printf("ERR: %s\n", dlerror()); return -1; } printf("[Base LMID]\n"); ldr2 =3D dlmopen(LM_ID_BASE, "./ldr2.so", RTLD_NOW | RTLD_LOCAL); if (!ldr2) { printf("ERR: %s\n", dlerror()); return -1; } return 0; } /tmp > cat ldr2.c #define _GNU_SOURCE #include #include void init(int, char*[], char*[]) { pthread_key_t key =3D 0xFFFFFFFF; pthread_key_create(&key, NULL); printf("[tid=3D%lx] Key created: %u\n", pthread_self(), key); printf("[tid=3D%lx] Key value: %p\n", pthread_self(), pthread_getspecific(key)); } __attribute__((section(".init_array"))) void (* __init)(int, char*[], char*= []) =3D init; /tmp > gcc -o ldr ldr.c -pthread -ldl /tmp > gcc -shared -o ldr2.so ldr2.c -pthread=20=20=20=20=20 /tmp > ./ldr [tid=3D7fe649b0a740] Key created: 0 with value 0xdeadbeef [New LMID] [tid=3D7fe649b0a740] Key created: 0 [tid=3D7fe649b0a740] Key value: 0xdeadbeef [Base LMID] [tid=3D7fe649b0a740] Key created: 2 [tid=3D7fe649b0a740] Key value: (nil) Pain.. --=20 You are receiving this mail because: You are on the CC list for the bug.=