NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-amd64/54185: PT_{G,S}ETXMMREGS not implemented in compat32



>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
>Organization:
NetBSD
>Environment:
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
>Description:
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).

>How-To-Repeat:
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);
		raise(SIGSTOP);
		_exit(0);
	}

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

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

	return 0;
}

EOF

cc -m32 test.c
./a.out

>Fix:
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.



Home | Main Index | Thread Index | Old Index