From nobody Sun Oct 05 06:37:37 2025 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cfXl56NQ5z6Bklf for ; Sun, 05 Oct 2025 06:37:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cfXl55Dk4z4Gwc for ; Sun, 05 Oct 2025 06:37:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759646257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UCObILYYc9tOjoG/ZCb0jKjOSNxlYYa21xvrCinDlDw=; b=lq6dVtBQbPqv9Y0R2rl1x1lbFp5UPUncp0vD7mmOvb0CheGlwAdUgDUr+Dd35E59LkVh98 9pEybqb90H7UjY8I+U1B3ytnW686TDSTFVzP9mf4DjI3iYrW/eVsBPWYlaOHbL4+pQ/QGB 8cCJ5fZrOMgzFjgZEWlXC9cO3Nl9nNU9P5RJOC1U80bP7eCfqf5AhUdrnCFfTvddS7gdyW T2JuKPm41mMqhDesVT5o/6yE72STJkRIJOV/e2LjVLJBISxI/zKoA8en1qrHWwI9E2WJBn p1AMGiuonvixvC51tpf639N2hNrZ5uNZaI3uYxPUHHD/LtjOAOElIjROjkWcqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759646257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UCObILYYc9tOjoG/ZCb0jKjOSNxlYYa21xvrCinDlDw=; b=m+pom5itxPvUtNCFWv/VSiOs9ICQaSWW1CKrGWjz4h/1lwbLwqkcapkb2ejbBRXIhJz1u1 xZXW52IOz3lkX9l1Zo+PurHv5Ymr8G1XJLtigSQcZyx5p7aitHbvcOQVdZvNuMaImEsKob J6/B2xwzwL2UkWBOlnl93FDiSEZUM33ByHzf7puXcp5SpZtRXTLfrCVWll/yJYfV1dR+dJ F2J8B5OHOesQzwW5TPcrK8oFL6G0P94w6fwvVTY1ZBqglQAnW55hfAdzrZ/x0JAUOIhQFg g9vbVgzaZSBWp4IIE/S/nVEWDGm8o4tjAUfBhgeF2bGMEWnVUQtl1ywn48dYNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759646257; a=rsa-sha256; cv=none; b=wyoqXtWnYiWN2y9gNGNnOhE2Ak/fQ+/VNjBlkCT8YO4l55RRzKgsmYEE6sGRT6H8GuZqvz WX0civZZ54kF5eGRmg1mT39Z24U1wFYFwTarncAcjat67g7xaD/tqa+9yEOeeEv0CA83FB lZphzDRbwkKpZx/Xo5HUyXxlB7fw2dL6BG3YjwNtbot5YNhK9djMrpRy1gDPPTh3kix6Hi 33iQD9QhIXPjtdmW1+4t1p1s5FrWvd4SRLAvu65Gyg1RkZbSUbwzR0Lfb60f4MOBbnR/xd uJLhm2COUUfxqcr2eEPeXwhU4KUyAwGSI9d6eSNqa2x0FPu7J5ZblR6ANVqY9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cfXl54rH6z1GWC for ; Sun, 05 Oct 2025 06:37:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 5956bbq1001459 for ; Sun, 5 Oct 2025 06:37:37 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 5956bbIW001458 for bugs@FreeBSD.org; Sun, 5 Oct 2025 06:37:37 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 290008] 15.0-ALPHA4 aarch64: ptrace PT_SETREGS issue Date: Sun, 05 Oct 2025 06:37:37 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 15.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: pjfloyd@wanadoo.fr X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D290008 Bug ID: 290008 Summary: 15.0-ALPHA4 aarch64: ptrace PT_SETREGS issue Product: Base System Version: 15.0-CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: pjfloyd@wanadoo.fr I'm having an issue with ptrace PT_SETREGS on FreeBSD 15.0-ALPHA4 (and ALPH= A3) on aarch64. I don't know exactly when this started since I don't regularly update my CURRENT VMs. This seems to be a regression related to FreeBSD 15. It worked OK with Free= BSD 14.0 14.1 and works OK with 14.3. What should happen. ------------------- The purpose of the code is to force a call to a polling function if the inferior is blocked in system calls. 1. Call ptrace PT_GETREGS to get the stack pointer 2. Set the registers for the polling function a) ELR the address of the polling function b) LR a phony address (0 - the polling function will return via longjmp(= )) c) SP based on what we got with PT_GETREGS d) X0 argument to the polling function, a check value of 0x8BADF00D e) Call ptrace PT_CONTINUE What is happening ----------------- All the above works OK apart from X0. Instead of seeing 0x8BADF00D the valu= e is 4 which triggers an assert. How to reproduce ---------------- On FreeBSD 15.0-ALPAH4 arm64. You'll need gmake, gdb and autotools installe= d. glt clone https://sourceware.org/git/valgrind.git cd valgrind ./autogen.sh ./configure gmake make sure that you have two terminals In terminal 1 in the valgrind directory run ./vg-in-place --tool=3Dnone --vgdb-eror=3D0 sleep 10000 In terminal 2 run gdb then at the gdb prompt - replace {path} with the = path containing the valgrind directory target remote | {path}/valgrind/coregrind/vgdb then continue then ctrl-c You should get the following (possibly with slightly different line numbers= ): valgrind: m_gdbserver/m_gdbserver.c:883 (void vgPlain_invoke_gdbserver(int, int)): Assertion 'check =3D=3D 0x8BADF00D' failed. host stacktrace: =3D=3D2874=3D=3D at 0x380A902C: show_sched_status_wrk (m_libcassert.c:42= 6) =3D=3D2874=3D=3D by 0x380A9353: report_and_quit (m_libcassert.c:497) =3D=3D2874=3D=3D by 0x380A932F: vgPlain_assert_fail (m_libcassert.c:564) =3D=3D2874=3D=3D by 0x38180CB3: vgPlain_invoke_gdbserver (m_gdbserver.c:= 883) =3D=3D2874=3D=3D by 0xFFFFFFFFFFFFFFFF: ??? sched status: running_tid=3D0 Thread 1: status =3D VgTs_WaitSys syscall 240 (lwpid 100170) =3D=3D2874=3D=3D at 0x4D27BF4: _nanosleep (in /lib/libsys.so.7) =3D=3D2874=3D=3D by 0x4010ECF: ??? (in /bin/sleep) =3D=3D2874=3D=3D by 0x49718BB: __libc_start1 (in /lib/libc.so.7) =3D=3D2874=3D=3D by 0x4010C9B: ??? (in /bin/sleep) client stack range: [0x1FBFFFC000 0x1FC0000FFF] client SP: 0x1FC00009A0 valgrind stack range: [0x100278E000 0x100288DFFF] top usage: 12688 of 10485= 76 I've already tried quite a few things 1. Reading back the registers, they are identical. 2 Reading the instructions from the address put in ELR they match what I s= ee in the binary with objdump. 3. Adding a second argument works OK. The value that I put in X1 appears as= the second argument. 4. Tried using clang 19 on FreeBSD 14.3 (19 is the default compiler on Free= BSD 15), and it worked OK. I've looked a bit at the FreeBSD kernel code. I don't really know my way around, but nothing struck me as a possible cause. I'll see if I can produce a smaller reproducer. --=20 You are receiving this mail because: You are the assignee for the bug.=