unable to fetch pauth registers: Invalid argument.

Bug #2012509 reported by Heinrich Schuchardt
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gdb (Ubuntu)
New
Undecided
Unassigned

Bug Description

I am running Ubuntu Lunar on an arm64 Lenovo X13s using the kernel 6.2.0-1003-laptop from ppa:ubuntu-concept/x13s. The kernel is configured with CONFIG_ARM64_PTR_AUTH=y.

Debugging a trivial hello world program fails:

GNU gdb (Ubuntu 13.1-2ubuntu2) 13.1
Reading symbols from ./test...
(gdb) r
Starting program: /home/user/temp/test
unable to fetch pauth registers: Invalid argument.

The message relates to this statement:

gdb/aarch64-linux-nat.c:371:
ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_PAC_MASK, &iovec);

When using

set tdesc filename target.xml

with a target.xml file without the org.gnu.gdb.aarch64.pauth feature debugging works fine.

Revision history for this message
Heinrich Schuchardt (xypron) wrote (last edit ):

https://<email address hidden>/
introduced hwcaps PACA (for address authentication) and PACG (for generic
authentication). These are present in /proc/cpuinfo:

Features:
fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp uscat ilrcpc flagm paca pacg

Revision history for this message
Heinrich Schuchardt (xypron) wrote :

The problem to read the pauth registers is reproducible with a simple C program:

#define _GNU_SOURCE
#include <elf.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ptrace.h>
#include <sys/uio.h>
#include <sys/wait.h>
#include <unistd.h>

#define LEN 16384

int main()
{
        long ret;
        struct iovec iovec;
        pid_t pid;

        pid = fork();
        if (!pid) {
                sleep(1);
                return 0;
        }
        ret = ptrace(PTRACE_ATTACH, pid, NULL, NULL);
        if (ret == -1) {
                perror("PTRACE_ATTACH failed");
                return 1;
        }
        iovec.iov_base = malloc(LEN);
        iovec.iov_len = LEN;
        wait(NULL);
        // ret = ptrace (PTRACE_GETREGSET, pid, NT_PRSTATUS, &iovec);
        ret = ptrace (PTRACE_GETREGSET, pid, NT_ARM_PAC_MASK, &iovec);
        if (ret == -1) {
                perror("PTRACE_GETREGSET");
                return 1;
        }
        printf("PTRACE_GETREGSET succeeded\n");
        return 0;
}

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.