lkml.org 
[lkml]   [2018]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH ghak32 V2 02/13] audit: check children and threading before allowing containerid
Date
Check if a task has existing children or co-threads and refuse to set
the container ID if either are present. Failure to check this could
permit games where a child scratches its parent's back to work around
inheritance and double-setting policy.

Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
---
kernel/auditsc.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 29c8482..a6b0a52 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -2087,6 +2087,10 @@ static int audit_set_containerid_perm(struct task_struct *task, u64 containerid)
/* if we don't have caps, reject */
if (!capable(CAP_AUDIT_CONTROL))
return -EPERM;
+ /* if task has children or is not single-threaded, deny */
+ if (!list_empty(&task->children) ||
+ !(thread_group_leader(task) && thread_group_empty(task)))
+ return -EPERM;
/* if containerid is unset, allow */
if (!audit_containerid_set(task))
return 0;
--
1.8.3.1
\
 
 \ /
  Last update: 2018-03-16 10:12    [W:0.515 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site