NetBSD Problem Report #60011

From martin@gethsemane.aprisoft.de  Mon Feb 16 16:17:33 2026
Return-Path: <martin@gethsemane.aprisoft.de>
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)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.netbsd.org", Issuer "R13" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 7F1811A9239
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 16 Feb 2026 16:17:33 +0000 (UTC)
Message-Id: <20260216161711.2036AE1FF7A@mail.duskware.de>
Date: Mon, 16 Feb 2026 17:17:06 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: TLS alignment wrong on powerpc
X-Send-Pr-Version: 3.95
X-From4GNATS: "martin@NetBSD.org via gnats" <gnats-admin@NetBSD.org>

>Number:         60011
>Category:       toolchain
>Synopsis:       TLS alignment wrong on powerpc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 16 16:20:00 +0000 2026
>Closed-Date:    Fri Apr 03 06:11:29 +0000 2026
>Last-Modified:  Fri Apr 03 06:11:29 +0000 2026
>Originator:     Martin Husemann
>Release:        NetBSD 11.99.5
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD gethsemane.aprisoft.de 11.99.5 NetBSD 11.99.5 (GETHSEMANE) #448: Mon Feb 16 15:23:34 CET 2026 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/macppc/compile/GETHSEMANE macppc
Architecture: powerpc
Machine: macppc
>Description:

The /usr/tests/libexec/ld.elf_so/t_tls_alignment test fails on powerpc
machines:

tp-start: 1771257800.390513, t_tls_alignment, 1
tc-start: 1771257800.390612, tls_alignment
tc-se:*** Check failed: /work/src/tests/libexec/ld.elf_so/t_tls_alignment.c:60: tls_data.magic1 == MAGIC1 not met
tc-se:*** Check failed: /work/src/tests/libexec/ld.elf_so/t_tls_alignment.c:61: tls_data.magic2 == MAGIC2 not met
tc-se:*** Check failed: /work/src/tests/libexec/ld.elf_so/t_tls_alignment.c:62: tls_data.magic3 == MAGIC3 not met
tc-end: 1771257800.416247, tls_alignment, failed, 3 checks failed; see output for more details

(gdb) x/16i atfu_tls_alignment_body
   0xcb10d2c <atfu_tls_alignment_body>: nop
   0xcb10d30 <atfu_tls_alignment_body+4>:       lis     r10,-21931
   0xcb10d34 <atfu_tls_alignment_body+8>:       addi    r7,r2,-28672
=> 0xcb10d38 <atfu_tls_alignment_body+12>:      ori     r10,r10,43605
   0xcb10d3c <atfu_tls_alignment_body+16>:      lwz     r8,0(r7)
   0xcb10d40 <atfu_tls_alignment_body+20>:      mflr    r0
   0xcb10d44 <atfu_tls_alignment_body+24>:      stwu    r1,-16(r1)
   0xcb10d48 <atfu_tls_alignment_body+28>:      
    bcl     20,4*cr7+so,0xcb10d4c <atfu_tls_alignment_body+32>
   0xcb10d4c <atfu_tls_alignment_body+32>:      cmpw    r8,r10
   0xcb10d50 <atfu_tls_alignment_body+36>:      stw     r30,8(r1)
   0xcb10d54 <atfu_tls_alignment_body+40>:      mflr    r30
   0xcb10d58 <atfu_tls_alignment_body+44>:      addis   r30,r30,2
   0xcb10d5c <atfu_tls_alignment_body+48>:      stw     r0,20(r1)
   0xcb10d60 <atfu_tls_alignment_body+52>:      addi    r30,r30,-30248
   0xcb10d64 <atfu_tls_alignment_body+56>:      
    bne     0xcb10e20 <atfu_tls_alignment_body+244>
   0xcb10d68 <atfu_tls_alignment_body+60>:      lwz     r10,4(r7)
(gdb) p/x $r7
$3 = 0xf2df5048
(gdb) x/40x 0xf2df5048
0xf2df5048:     0x00000000      0x00000000      0x00000000      0x00000000
0xf2df5058:     0x00000000      0x00000000      0x00000000      0x00000000
0xf2df5068:     0x00000000      0x00000000      0x00000000      0x00000000
0xf2df5078:     0x00000000      0x00000000      0xaa55aa55      0xaa55aa55
0xf2df5088:     0x00000000      0x00000000      0x00000000      0x00000000
0xf2df5098:     0x00000000      0x00000000      0x00000000      0x00000000
0xf2df50a8:     0x00000000      0x00000000      0x00000000      0x00000000
0xf2df50b8:     0x00000000      0x00000000      0xc0ffeeee      0xeeeeeeee
0xf2df50c8:     0xff00ff00      0xff00ff00      0x00000000      0x00000000
0xf2df50d8:     0x00000000      0x00000000      0x00000000      0x00000000




>How-To-Repeat:

cd /usr/tests/libexec/ld.elf_so/ && atf-run t_tls_alignment

>Fix:
n/a

>Release-Note:

>Audit-Trail:
From: "Nick Hudson" <skrll@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60011 CVS commit: src/libexec/ld.elf_so
Date: Sun, 15 Mar 2026 13:56:17 +0000

 Module Name:	src
 Committed By:	skrll
 Date:		Sun Mar 15 13:56:17 UTC 2026

 Modified Files:
 	src/libexec/ld.elf_so: tls.c

 Log Message:
 PR/60011: TLS alignment wrong on powerpc

 Fix previous where I only got the alignment right for the architectures
 where the thread pointer points to the struct tcb. Handle the
 architectures that have a thread pointer that is relative to end of the
 struct tcb, e.g. powerpc.

 Hopefully the commit in the tls.c explains what's going on.

 Thanks to riastrah@ and andvar@ for comments/things to fix.


 To generate a diff of this commit:
 cvs rdiff -u -r1.28 -r1.29 src/libexec/ld.elf_so/tls.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->pending-pullups
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Tue, 17 Mar 2026 07:00:50 +0000
State-Changed-Why:
[pullup-11 #216] PR/60011: TLS alignment wrong on powerpc


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60011 CVS commit: [netbsd-11] src/libexec/ld.elf_so
Date: Thu, 2 Apr 2026 17:48:32 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Apr  2 17:48:32 UTC 2026

 Modified Files:
 	src/libexec/ld.elf_so [netbsd-11]: tls.c

 Log Message:
 Pull up following revision(s) (requested by skrll in ticket #216):

 	libexec/ld.elf_so/tls.c: revision 1.29

 PR/60011: TLS alignment wrong on powerpc

 Fix previous where I only got the alignment right for the architectures
 where the thread pointer points to the struct tcb. Handle the
 architectures that have a thread pointer that is relative to end of the
 struct tcb, e.g. powerpc.

 Hopefully the commit in the tls.c explains what's going on.

 Thanks to riastrah@ and andvar@ for comments/things to fix.


 To generate a diff of this commit:
 cvs rdiff -u -r1.23.2.1 -r1.23.2.2 src/libexec/ld.elf_so/tls.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Fri, 03 Apr 2026 06:11:29 +0000
State-Changed-Why:
pullup(s) done


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.