Skip to content

Commit 46f7ecb

Browse files
committed
ptrace: Remove unused ptrace_may_access_sched() and MODE_IBRS
The IBPB control code in x86 removed the usage. Remove the functionality which was introduced for this. Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Tom Lendacky <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Tim Chen <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Casey Schaufler <[email protected]> Cc: Asit Mallick <[email protected]> Cc: Arjan van de Ven <[email protected]> Cc: Jon Masters <[email protected]> Cc: Waiman Long <[email protected]> Cc: Greg KH <[email protected]> Cc: Dave Stewart <[email protected]> Cc: Kees Cook <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 4c71a2b commit 46f7ecb

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

include/linux/ptrace.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,12 @@ extern void exit_ptrace(struct task_struct *tracer, struct list_head *dead);
6464
#define PTRACE_MODE_NOAUDIT 0x04
6565
#define PTRACE_MODE_FSCREDS 0x08
6666
#define PTRACE_MODE_REALCREDS 0x10
67-
#define PTRACE_MODE_SCHED 0x20
68-
#define PTRACE_MODE_IBPB 0x40
6967

7068
/* shorthands for READ/ATTACH and FSCREDS/REALCREDS combinations */
7169
#define PTRACE_MODE_READ_FSCREDS (PTRACE_MODE_READ | PTRACE_MODE_FSCREDS)
7270
#define PTRACE_MODE_READ_REALCREDS (PTRACE_MODE_READ | PTRACE_MODE_REALCREDS)
7371
#define PTRACE_MODE_ATTACH_FSCREDS (PTRACE_MODE_ATTACH | PTRACE_MODE_FSCREDS)
7472
#define PTRACE_MODE_ATTACH_REALCREDS (PTRACE_MODE_ATTACH | PTRACE_MODE_REALCREDS)
75-
#define PTRACE_MODE_SPEC_IBPB (PTRACE_MODE_ATTACH_REALCREDS | PTRACE_MODE_IBPB)
7673

7774
/**
7875
* ptrace_may_access - check whether the caller is permitted to access
@@ -90,20 +87,6 @@ extern void exit_ptrace(struct task_struct *tracer, struct list_head *dead);
9087
*/
9188
extern bool ptrace_may_access(struct task_struct *task, unsigned int mode);
9289

93-
/**
94-
* ptrace_may_access - check whether the caller is permitted to access
95-
* a target task.
96-
* @task: target task
97-
* @mode: selects type of access and caller credentials
98-
*
99-
* Returns true on success, false on denial.
100-
*
101-
* Similar to ptrace_may_access(). Only to be called from context switch
102-
* code. Does not call into audit and the regular LSM hooks due to locking
103-
* constraints.
104-
*/
105-
extern bool ptrace_may_access_sched(struct task_struct *task, unsigned int mode);
106-
10790
static inline int ptrace_reparented(struct task_struct *child)
10891
{
10992
return !same_thread_group(child->real_parent, child->parent);

kernel/ptrace.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,6 @@ static int ptrace_check_attach(struct task_struct *child, bool ignore_state)
261261

262262
static int ptrace_has_cap(struct user_namespace *ns, unsigned int mode)
263263
{
264-
if (mode & PTRACE_MODE_SCHED)
265-
return false;
266-
267264
if (mode & PTRACE_MODE_NOAUDIT)
268265
return has_ns_capability_noaudit(current, ns, CAP_SYS_PTRACE);
269266
else
@@ -331,16 +328,9 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode)
331328
!ptrace_has_cap(mm->user_ns, mode)))
332329
return -EPERM;
333330

334-
if (mode & PTRACE_MODE_SCHED)
335-
return 0;
336331
return security_ptrace_access_check(task, mode);
337332
}
338333

339-
bool ptrace_may_access_sched(struct task_struct *task, unsigned int mode)
340-
{
341-
return __ptrace_may_access(task, mode | PTRACE_MODE_SCHED);
342-
}
343-
344334
bool ptrace_may_access(struct task_struct *task, unsigned int mode)
345335
{
346336
int err;

0 commit comments

Comments
 (0)