Commit 8fb402bc authored by Erik Bosman's avatar Erik Bosman Committed by Ingo Molnar

generic, x86: add prctl commands PR_GET_TSC and PR_SET_TSC

This patch adds prctl commands that make it possible
to deny the execution of timestamp counters in userspace.
If this is not implemented on a specific architecture,
prctl will return -EINVAL.
ned-off-by: default avatarErik Bosman <ejbosman@cs.vu.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 5deb45e3
...@@ -67,4 +67,10 @@ ...@@ -67,4 +67,10 @@
#define PR_CAPBSET_READ 23 #define PR_CAPBSET_READ 23
#define PR_CAPBSET_DROP 24 #define PR_CAPBSET_DROP 24
/* Get/set the process' ability to use the timestamp counter instruction */
#define PR_GET_TSC 25
#define PR_SET_TSC 26
# define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */
# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */
#endif /* _LINUX_PRCTL_H */ #endif /* _LINUX_PRCTL_H */
...@@ -67,6 +67,12 @@ ...@@ -67,6 +67,12 @@
#ifndef SET_ENDIAN #ifndef SET_ENDIAN
# define SET_ENDIAN(a,b) (-EINVAL) # define SET_ENDIAN(a,b) (-EINVAL)
#endif #endif
#ifndef GET_TSC_CTL
# define GET_TSC_CTL(a) (-EINVAL)
#endif
#ifndef SET_TSC_CTL
# define SET_TSC_CTL(a) (-EINVAL)
#endif
/* /*
* this is where the system-wide overflow UID and GID are defined, for * this is where the system-wide overflow UID and GID are defined, for
...@@ -1737,7 +1743,12 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, ...@@ -1737,7 +1743,12 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
#else #else
return -EINVAL; return -EINVAL;
#endif #endif
case PR_GET_TSC:
error = GET_TSC_CTL(arg2);
break;
case PR_SET_TSC:
error = SET_TSC_CTL(arg2);
break;
default: default:
error = -EINVAL; error = -EINVAL;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment