Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 May 2021 09:33:36 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 916f3dba4523 - main - linux(4): make arch_prctl(2) support GET_CET_STATUS, report unknown codes
Message-ID:  <202105060933.1469XaJI040982@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=916f3dba4523d1b2d478538875d45df56b20bcdb

commit 916f3dba4523d1b2d478538875d45df56b20bcdb
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-05-06 08:33:35 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2021-05-06 08:33:42 +0000

    linux(4): make arch_prctl(2) support GET_CET_STATUS, report unknown codes
    
    This is largely a no-op, to make future debugging slightly easier.
    
    Sponsored By:   EPSRC
    Differential Revision:  https://reviews.freebsd.org/D30035
---
 sys/amd64/linux/linux.h         | 1 +
 sys/amd64/linux/linux_machdep.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h
index cf9f5cccb287..dc4986817d11 100644
--- a/sys/amd64/linux/linux.h
+++ b/sys/amd64/linux/linux.h
@@ -431,6 +431,7 @@ struct l_pollfd {
 #define LINUX_ARCH_SET_FS		0x1002
 #define LINUX_ARCH_GET_FS		0x1003
 #define LINUX_ARCH_GET_GS		0x1004
+#define LINUX_ARCH_CET_STATUS		0x3001
 
 #define	linux_copyout_rusage(r, u)	copyout(r, u, sizeof(*r))
 
diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c
index a82ab411daa1..d2f9d0cacd3c 100644
--- a/sys/amd64/linux/linux_machdep.c
+++ b/sys/amd64/linux/linux_machdep.c
@@ -242,6 +242,7 @@ linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap)
 int
 linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args)
 {
+	unsigned long long cet[3];
 	struct pcb *pcb;
 	int error;
 
@@ -275,7 +276,12 @@ linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args)
 		error = copyout(&pcb->pcb_gsbase, PTRIN(args->addr),
 		    sizeof(args->addr));
 		break;
+	case LINUX_ARCH_CET_STATUS:
+		memset(cet, 0, sizeof(cet));
+		error = copyout(&cet, PTRIN(args->addr), sizeof(cet));
+		break;
 	default:
+		linux_msg(td, "unsupported arch_prctl code %#x", args->code);
 		error = EINVAL;
 	}
 	return (error);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105060933.1469XaJI040982>