NetBSD Problem Report #54185

From mgorny@pomiocikbsd.local  Thu May  9 16:47:47 2019
Return-Path: <mgorny@pomiocikbsd.local>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 14A837A172
	for <>; Thu,  9 May 2019 16:47:47 +0000 (UTC)
Message-Id: <20190509051037.2C82744B8B0@pomiocikbsd.local>
Date: Thu,  9 May 2019 07:10:37 +0200 (CEST)
Subject: PT_{G,S}ETXMMREGS not implemented in compat32
X-Send-Pr-Version: 3.95

>Number:         54185
>Category:       port-amd64
>Synopsis:       PT_{G,S}ETXMMREGS ptrace() requests are not implemented in compat32 on amd64
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 09 16:50:00 +0000 2019
>Originator:     Michał Górny
>Release:        NetBSD 8.99.37
System: NetBSD pomiocikbsd.local 8.99.37 NetBSD 8.99.37 (GENERIC) #0: Fri May 3 22:06:59 CEST 2019 root@pomiocikbsd.local:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
It seems that the PT_GETXMMREGS and PT_SETXMMREGS ptrace() requests
are not implemented in compat32 of amd64 kernel.  When trying to run
a test I've written for i386, I get the following failure:

failed: /usr/src/tests/lib/libc/sys/t_ptrace_x86_wait.h:2438:
ptrace(PT_GETXMMREGS, child, &fpr, 0) != -1: Not supported

With PT_GETFPREGS correctly emulating i386 API, this makes it
impossible to query XMM registers of a 32-bit program via ptrace
(unless I'm mistaken).

cat > test.c <<EOF

#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#undef _NDEBUG
#include <assert.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main()
	char out[512];
	int ret;
	int pid;
	int st;

	pid = fork();
	assert(pid != -1);
	if (pid == 0)
		assert(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);

	assert(wait(&st) == pid);

	ret = ptrace(PT_GETXMMREGS, pid, out, 0);
	if (ret == -1)
		perror("ptrace(PT_GETXMMREGS) failed");

	return 0;


cc -m32 test.c

FTR, I don't consider this very important since I'll be working
on adding full xsave support via a new ptrace() request.  When done,
it will probably render using i386-specific PT_GETXMMREGS unnecessary.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.